Merge remote-tracking branch 'fix/clear-shadow-stale-on-unmap' into next

This commit is contained in:
Yuxuan Shui
2020-10-23 17:27:40 +01:00
5 changed files with 66 additions and 3 deletions

View File

@@ -2038,10 +2038,28 @@ bool destroy_win_start(session_t *ps, struct win *w) {
}
if (w->managed) {
// Clear PIXMAP_STALE flag, since the window is destroyed there is no
// pixmap available so STALE doesn't make sense.
// Clear IMAGES_STALE flags since the window is destroyed: Clear
// PIXMAP_STALE as there is no pixmap available anymore, so STALE doesn't
// make sense.
// XXX Clear SHADOW_STALE as setting/clearing flags on a destroyed window
// doesn't work leading to an inconsistent state where the shadow is
// refreshed but the flags are stuck in STALE.
// Do this before changing the window state to destroying
win_clear_flags(mw, WIN_FLAGS_PIXMAP_STALE);
win_clear_flags(mw, WIN_FLAGS_IMAGES_STALE);
// If size/shape/position information is stale, win_process_update_flags
// will update them and add the new window extents to damage. Since the
// window has been destroyed, we cannot get the complete information at
// this point, so we just add what we currently have to the damage.
if (win_check_flags_any(mw, WIN_FLAGS_SIZE_STALE | WIN_FLAGS_POSITION_STALE)) {
add_damage_from_win(ps, mw);
}
// Clear some flags about stale window information. Because now the window
// is destroyed, we can't update them anyway.
win_clear_flags(mw, WIN_FLAGS_SIZE_STALE | WIN_FLAGS_POSITION_STALE |
WIN_FLAGS_PROPERTY_STALE |
WIN_FLAGS_FACTOR_CHANGED | WIN_FLAGS_CLIENT_STALE);
// Update state flags of a managed window
mw->state = WSTATE_DESTROYING;