win: clear STALE_IMAGE flag in map_win

Clear the STALE_IMAGE flag set by win_update_bounding_shape to avoid an
unnecessary image data invalidation.

Mainly to workaround a NVIDIA bug. For more detailed explanation, see
commit 8f67c6190c281955846589d8769385f30e7c5d23

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-17 00:55:04 +00:00
parent b10f0bbc67
commit 312643c454
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 14 additions and 7 deletions

View File

@ -1712,13 +1712,6 @@ void map_win(session_t *ps, win *w) {
w->state = WSTATE_MAPPING;
w->opacity_tgt = win_calc_opacity_target(ps, w);
// TODO win_update_bounding_shape below will immediately
// reinit w->win_data, not very efficient
if (ps->redirected && ps->o.experimental_backends) {
if (!win_bind_image(ps, w)) {
w->flags |= WIN_FLAGS_IMAGE_ERROR;
}
}
log_debug("Window %#010x has opacity %f, opacity target is %f", w->id, w->opacity,
w->opacity_tgt);
@ -1732,6 +1725,20 @@ void map_win(session_t *ps, win *w) {
// update. (Issue #35)
win_update_bounding_shape(ps, w);
// Reset the STALE_IMAGE flag set by win_update_bounding_shape. Because we are
// just about to bind the image, no way that's stale.
//
// Also because NVIDIA driver doesn't like seeing the same pixmap under different
// ids, so avoid naming the pixmap again when it didn't actually change.
w->flags &= ~WIN_FLAGS_STALE_IMAGE;
// Bind image after update_bounding_shape, so the shadow has the correct size.
if (ps->redirected && ps->o.experimental_backends) {
if (!win_bind_image(ps, w)) {
w->flags |= WIN_FLAGS_IMAGE_ERROR;
}
}
#ifdef CONFIG_DBUS
// Send D-Bus signal
if (ps->o.dbus) {