win: clear PIXMAP_STALE in {unmap,destroy}_win_start

Also make sure unmapped/destroyed windows don't have PIXMAP_STALE flag
set.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-09-29 00:09:40 +01:00
parent 0fc6f9aee2
commit f493447b33
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 14 additions and 9 deletions

View File

@ -345,16 +345,13 @@ void win_process_flags(session_t *ps, struct managed_win *w) {
// Check to make sure the window is still mapped, otherwise we
// won't be able to rebind pixmap after releasing it, yet we might
// still need the pixmap for rendering.
if (w->state != WSTATE_UNMAPPING && w->state != WSTATE_DESTROYING) {
assert(w->state != WSTATE_UNMAPPING && w->state != WSTATE_DESTROYING);
if ((w->flags & WIN_FLAGS_PIXMAP_NONE) == 0) {
// Must release images first, otherwise breaks
// NVIDIA driver
win_release_pixmap(ps->backend_data, w);
}
win_bind_pixmap(ps->backend_data, w);
} else {
assert(w->win_image);
}
}
if ((w->flags & WIN_FLAGS_SHADOW_STALE) != 0) {
@ -1854,6 +1851,10 @@ bool destroy_win_start(session_t *ps, struct win *w) {
mw->state = WSTATE_DESTROYING;
mw->a.map_state = XCB_MAP_STATE_UNMAPPED;
mw->in_openclose = true;
// Clear PIXMAP_STALE flag, since the window is destroyed there is no
// pixmap available so STALE doesn't make sense.
mw->flags &= ~WIN_FLAGS_PIXMAP_STALE;
}
// don't need win_ev_stop because the window is gone anyway
@ -1904,6 +1905,10 @@ void unmap_win_start(session_t *ps, struct managed_win *w) {
w->state = WSTATE_UNMAPPING;
w->opacity_target = win_calc_opacity_target(ps, w, false);
// Clear PIXMAP_STALE flag, since the window is unmapped there is no pixmap
// available so STALE doesn't make sense.
w->flags &= ~WIN_FLAGS_PIXMAP_STALE;
// don't care about properties anymore
win_ev_stop(ps, &w->base);