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.
This commit is contained in:
Richard Grenville
2013-03-18 11:48:28 +08:00
parent b6a99334ce
commit 1a88e3d0c5
6 changed files with 128 additions and 42 deletions

View File

@@ -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;
/* rehook */
bool found = false;
// 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);