Make sure window cannot enter fading when unredirected

Firstly, this breaks the assumption that when we redirect the screen,
all window is either mapped or unmapped, causing a assertion failure.

Secondly, if transition window into fading when the screen is not
redirected, the fading will not progress until the screen is redirected,
probably not the desired result.

Fixes #246

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-10-11 18:01:13 +01:00
parent 93f0d80572
commit 1ca01ec456
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
2 changed files with 7 additions and 1 deletions

View File

@ -468,11 +468,14 @@ static inline void ev_property_notify(session_t *ps, xcb_property_notify_event_t
win_update_opacity_prop(ps, w);
// we cannot receive OPACITY change when window is destroyed
assert(w->state != WSTATE_DESTROYING);
w->opacity_target = win_calc_opacity_target(ps, w, false);
if (w->state == WSTATE_MAPPED) {
// See the winstate_t transition table
w->state = WSTATE_FADING;
}
w->opacity_target = win_calc_opacity_target(ps, w, false);
if (!ps->redirected) {
CHECK(!win_skip_fading(ps, w));
}
}
}

View File

@ -121,6 +121,9 @@ static void win_update_focused(session_t *ps, struct managed_win *w) {
if (opacity_target_old != w->opacity_target && w->state == WSTATE_MAPPED) {
// Only MAPPED can transition to FADING
w->state = WSTATE_FADING;
if (!ps->redirected) {
CHECK(!win_skip_fading(ps, w));
}
}
}