From aa742146f195efd1c94b530281ed07d524bc9289 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sun, 17 Mar 2019 03:27:29 +0000 Subject: [PATCH] win: put window into UNMAPPED state before mapping Make sure before the mapping operation begins, the window is always in UNUNMAPPED state. This makes it easier to reason about things, such as resource availability, etc. Signed-off-by: Yuxuan Shui --- src/win.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/win.c b/src/win.c index fe9a8bb..e8e2a3a 100644 --- a/src/win.c +++ b/src/win.c @@ -1623,11 +1623,17 @@ void map_win(session_t *ps, win *w) { log_debug("Mapping (%#010x \"%s\")", w->id, w->name); + assert(w->state != WSTATE_DESTROYING); if (w->state != WSTATE_UNMAPPED && w->state != WSTATE_UNMAPPING) { log_warn("Mapping an already mapped window"); return; } + if (w->state == WSTATE_UNMAPPING) { + win_skip_fading(ps, &w); + assert(w); + } + // We stopped processing window size change when we were unmapped, refresh the // size of the window xcb_get_geometry_cookie_t gcookie = xcb_get_geometry(ps->c, w->id);