diff options
author | Richard Grenville <[email protected]> | 2013-03-18 11:48:28 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-03-18 13:29:14 +0800 |
commit | 848103bc3447f814c51cb818836533e18e018bf5 (patch) | |
tree | 9a70634e2384200f06ff1f712136039f1ff4acef /compton.c | |
parent | 17f7d31a5282d55182aec8938d52e13379dcc2bb (diff) | |
download | tdebase-848103bc3447f814c51cb818836533e18e018bf5.tar.gz tdebase-848103bc3447f814c51cb818836533e18e018bf5.zip |
Bug fix: GLX: ARGB texture too dark & Jitter when resize & others
- GLX backend: Fix a bug that ARGB windows / shadows are rendered too
dark. Thanks to derhass in FreeNode/##opengl for help.
- GLX backend: Fix a problem that during window resize the content looks
jittering, by letting compton fetch pixmap sizes with XGetGeometry()
instead of relying on window width/height, which could be inaccurate
during window resize. Negative effect on performance. Thanks to M4he
for reporting. (#7)
- Add .desktop file. Thanks to quequotion for providing it. (#97)
- Avoid checking presence of window pixmap, because they may not exist
with very old X Composite implementations.
- Add workaround for a strange window restack issue when compton
receieves a ConfigureNotify with non-existent new above window.
- Add debugging function hexdump(). Extra sanity checks on various
places.
Diffstat (limited to 'compton.c')
-rw-r--r-- | compton.c | 36 |
1 files changed, 26 insertions, 10 deletions
@@ -474,6 +474,7 @@ win_build_shadow(session_t *ps, win *w, double opacity) { w->shadow_paint.pixmap = shadow_pixmap_argb; w->shadow_paint.pict = shadow_picture_argb; + bool success = paint_bind_tex(ps, &w->shadow_paint, shadow_image->width, shadow_image->height, 32, true); XFreeGC(ps->dpy, gc); @@ -863,8 +864,7 @@ get_root_tile(session_t *ps) { ps->root_tile_paint.pixmap = pixmap; #ifdef CONFIG_VSYNC_OPENGL if (BKEND_GLX == ps->o.backend) - return glx_bind_pixmap(ps, &ps->root_tile_paint.ptex, ps->root_tile_paint.pixmap, - ps->root_width, ps->root_height, ps->depth); + return glx_bind_pixmap(ps, &ps->root_tile_paint.ptex, ps->root_tile_paint.pixmap, 0, 0, 0); #endif return true; @@ -1437,8 +1437,10 @@ win_paint_win(session_t *ps, win *w, XserverRegion reg_paint) { } } // GLX: Build texture - if (!paint_bind_tex(ps, &w->paint, w->widthb, w->heightb, - w->pictfmt->depth, w->pixmap_damaged)) { + // Let glx_bind_pixmap() determine pixmap size, because if the user + // is resizing windows, the width and height we get may not be up-to-date, + // causing the jittering issue M4he reported in #7. + if (!paint_bind_tex(ps, &w->paint, 0, 0, 0, w->pixmap_damaged)) { printf_errf("(%#010lx): Failed to bind texture. Expect troubles.", w->id); } w->pixmap_damaged = false; @@ -2633,21 +2635,33 @@ restack_win(session_t *ps, win *w, Window new_above) { } if (old_above != new_above) { - win **prev; + win **prev = NULL, **prev_old = NULL; - /* unhook */ + // unhook for (prev = &ps->list; *prev; prev = &(*prev)->next) { if ((*prev) == w) break; } - *prev = w->next; + prev_old = prev; + + bool found = false; - /* rehook */ + // rehook for (prev = &ps->list; *prev; prev = &(*prev)->next) { - if ((*prev)->id == new_above && !(*prev)->destroyed) + if ((*prev)->id == new_above && !(*prev)->destroyed) { + found = true; break; + } } + if (!found) { + printf_errf("(%#010lx, %#010lx): " + "Failed to found new above window.", w->id, new_above); + return; + } + + *prev_old = w->next; + w->next = *prev; *prev = w; @@ -2668,7 +2682,9 @@ restack_win(session_t *ps, win *w, Window new_above) { desc = ""; if (c->destroyed) desc = "(D) "; - printf("%#010lx \"%s\" %s-> ", c->id, window_name, desc); + printf("%#010lx \"%s\" %s", c->id, window_name, desc); + if (c->next) + printf("-> "); if (to_free) { XFree(window_name); |