core: fix missing damage when window closed
If window is closed when fading is not enabled, the window might be destroyed before we can add the window extent to damage. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
ad3ec8cada
commit
8155e5e453
|
@ -228,12 +228,10 @@ static bool run_fade(session_t *ps, win **_w, unsigned steps) {
|
||||||
w->opacity = w->opacity_tgt;
|
w->opacity = w->opacity_tgt;
|
||||||
}
|
}
|
||||||
if (w->opacity == w->opacity_tgt) {
|
if (w->opacity == w->opacity_tgt) {
|
||||||
// We have reached target opacity, wrapping up.
|
// We have reached target opacity.
|
||||||
// Note, we reach here after we have rendered the window with the target
|
// We don't call win_check_fade_finished here because that could destroy
|
||||||
// opacity at least once. If the window is destroyed because it is faded
|
// the window, but we still need the damage info from this window
|
||||||
// out, there is no need to add damage here.
|
|
||||||
log_debug("Fading finished for window %#010x %s", w->id, w->name);
|
log_debug("Fading finished for window %#010x %s", w->id, w->name);
|
||||||
win_check_fade_finished(ps, _w);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,6 +452,16 @@ static win *paint_preprocess(session_t *ps, bool *fade_running) {
|
||||||
*fade_running = true;
|
*fade_running = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add window to damaged area if its opacity changes
|
||||||
|
// If was_painted == false, and to_paint is also false, we don't care
|
||||||
|
// If was_painted == false, but to_paint is true, damage will be added in
|
||||||
|
// the loop below
|
||||||
|
if (was_painted && w->opacity != opacity_old) {
|
||||||
|
add_damage_from_win(ps, w);
|
||||||
|
}
|
||||||
|
|
||||||
|
win_check_fade_finished(ps, &w);
|
||||||
|
|
||||||
if (!w) {
|
if (!w) {
|
||||||
// the window might have been destroyed because fading finished
|
// the window might have been destroyed because fading finished
|
||||||
continue;
|
continue;
|
||||||
|
@ -473,14 +481,6 @@ static win *paint_preprocess(session_t *ps, bool *fade_running) {
|
||||||
if (was_painted && w->mode != mode_old) {
|
if (was_painted && w->mode != mode_old) {
|
||||||
w->reg_ignore_valid = false;
|
w->reg_ignore_valid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add window to damaged area if its opacity changes
|
|
||||||
// If was_painted == false, and to_paint is also false, we don't care
|
|
||||||
// If was_painted == false, but to_paint is true, damage will be added in
|
|
||||||
// the loop below
|
|
||||||
if (was_painted && w->opacity != opacity_old) {
|
|
||||||
add_damage_from_win(ps, w);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Opacity will not change, from now on.
|
// Opacity will not change, from now on.
|
||||||
|
|
Loading…
Reference in New Issue