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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-03-17 03:27:29 +00:00
parent fed6ac5b09
commit aa742146f1
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 6 additions and 0 deletions

View File

@ -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);