From fed6ac5b090f17e90d2b31d31dcc933014c6bf97 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 17 Mar 2019 03:05:09 +0000 Subject: [PATCH] win: release window image before rebind Previously we try to keep the image data until the rebind succeeds. This way even if the rebind fails, we still have something to display. But that triggers a NVIDIA driver bug. Basically you cannot have more than one names (XIDs) of a window pixmap. NVIDIA driver doesn't like that, and binding the pixmap with its aliases will fail. This can sometimes happen if we name the new pixmap before freeing the old one during rebind, and the pixmap doesn't actually change (i.e. the rebind is unnecessary, could happen because of X event handling complications). Signed-off-by: Yuxuan Shui --- src/win.c | 9 +-------- src/win.h | 2 +- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/win.c b/src/win.c index ae730d2..fe9a8bb 100644 --- a/src/win.c +++ b/src/win.c @@ -226,17 +226,10 @@ bool win_bind_image(session_t *ps, win *w) { } bool win_try_rebind_image(session_t *ps, win *w) { - void *new_image, *new_shadow; - if (!_win_bind_image(ps, w, &new_image, &new_shadow)) { - return false; - } - log_trace("Freeing old window image"); win_release_image(ps->backend_data, w); - w->shadow_image = new_shadow; - w->win_image = new_image; - return true; + return win_bind_image(ps, w); } /** diff --git a/src/win.h b/src/win.h index 39f9e17..cdab3e6 100644 --- a/src/win.h +++ b/src/win.h @@ -291,7 +291,7 @@ void win_release_image(backend_t *base, win *w); bool must_use win_bind_image(session_t *ps, win *w); /// Attempt a rebind of window's images. If that failed, the original images are kept. -bool win_try_rebind_image(session_t *ps, win *w); +bool must_use win_try_rebind_image(session_t *ps, win *w); int win_get_name(session_t *ps, win *w); int win_get_role(session_t *ps, win *w); winmode_t attr_pure win_calc_mode(const win *w);