From 8d639f41e96d38357d43169471700b88c8dd3a29 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 23 Feb 2019 00:11:29 +0000 Subject: [PATCH] Make sure only MAPPED state can transition to FADING win_update_focused transition window into FADING without checking their current state, resulting into unmapping windows being brought into FADING state and stops unmapping. Signed-off-by: Yuxuan Shui --- src/win.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/win.c b/src/win.c index 862c97d..fdad309 100644 --- a/src/win.c +++ b/src/win.c @@ -970,8 +970,14 @@ void win_update_focused(session_t *ps, win *w) { // Always recalculate the window target opacity, since some opacity-related // options depend on the output value of win_is_focused_real() instead of // w->focused + double opacity_tgt_old = w->opacity_tgt; w->opacity_tgt = win_calc_opacity_target(ps, w); - w->state = WSTATE_FADING; + if (opacity_tgt_old != w->opacity_tgt && w->state == WSTATE_MAPPED) { + // Only MAPPED can transition to FADING + assert(w->state != WSTATE_DESTROYING && w->state != WSTATE_UNMAPPING && + w->state != WSTATE_UNMAPPED); + w->state = WSTATE_FADING; + } } /**