From ecbfee9f022378b6ea4ffe40daa1fa1fd6400b68 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Thu, 6 Aug 2009 00:37:39 +0200 Subject: [PATCH] =?UTF-8?q?Bugfix:=20Correctly=20unmap=20stack=20windows?= =?UTF-8?q?=20and=20don=E2=80=99t=20re-map=20them=20too=20early?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client.c | 2 ++ src/layout.c | 2 +- src/util.c | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client.c b/src/client.c index 81430b2f..5ed5cf97 100644 --- a/src/client.c +++ b/src/client.c @@ -39,9 +39,11 @@ void client_remove_from_container(xcb_connection_t *conn, Client *client, Contai /* If the container will be empty now and is in stacking mode, we need to unmap the stack_win */ if (CIRCLEQ_EMPTY(&(container->clients)) && container->mode == MODE_STACK) { + LOG("Unmapping stack window\n"); struct Stack_Window *stack_win = &(container->stack_win); stack_win->rect.height = 0; xcb_unmap_window(conn, stack_win->window); + xcb_flush(conn); } } diff --git a/src/layout.c b/src/layout.c index 9cc41a0c..d90460a4 100644 --- a/src/layout.c +++ b/src/layout.c @@ -334,7 +334,7 @@ void render_container(xcb_connection_t *conn, Container *container) { /* Check if we need to remap our stack title window, it gets unmapped when the container is empty in src/handlers.c:unmap_notify() */ - if (stack_win->rect.height == 0) + if (stack_win->rect.height == 0 && num_clients > 0) xcb_map_window(conn, stack_win->window); /* Check if we need to reconfigure our stack title window */ diff --git a/src/util.c b/src/util.c index d09dafe2..8b400864 100644 --- a/src/util.c +++ b/src/util.c @@ -424,7 +424,9 @@ void switch_layout_mode(xcb_connection_t *conn, Container *container, int mode) XCB_EVENT_MASK_EXPOSURE; /* …our window needs to be redrawn */ struct Stack_Window *stack_win = &(container->stack_win); - stack_win->window = create_window(conn, rect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, true, mask, values); + stack_win->window = create_window(conn, rect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, false, mask, values); + + stack_win->rect.height = 0; /* Initialize the entry for our cached pixmap. It will be * created as soon as it’s needed (see cached_pixmap_prepare). */