From: Michael Stapelberg Date: Wed, 25 Feb 2009 00:44:34 +0000 (+0100) Subject: Bugfix: when a window is unmapped, correctly pass focus to the next one and cleanup... X-Git-Tag: 3.a~153 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=90fa720c6ff7a9ea2dca78eb553e09b5f9553e51;p=i3%2Fi3 Bugfix: when a window is unmapped, correctly pass focus to the next one and cleanup the table --- diff --git a/i3.config b/i3.config index 0e5ff21b..4a9468b0 100644 --- a/i3.config +++ b/i3.config @@ -39,3 +39,5 @@ bind Mod1+16 7 bind Mod1+17 8 bind Mod1+18 9 bind Mod1+19 0 + +bind Mod1+36 exec /usr/pkg/bin/urxvt diff --git a/src/handlers.c b/src/handlers.c index e1edd5c6..04f427db 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -329,9 +329,13 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *c, xcb_unmap_notify_ } if (client->container != NULL) { + Client *to_focus = CIRCLEQ_NEXT_OR_NULL(&(client->container->clients), client, clients); + if (to_focus == NULL) + to_focus = CIRCLEQ_PREV_OR_NULL(&(client->container->clients), client, clients); if (client->container->currently_focused == client) - client->container->currently_focused = NULL; + client->container->currently_focused = to_focus; CIRCLEQ_REMOVE(&(client->container->clients), client, clients); + set_focus(c, to_focus); } printf("child of 0x%08x.\n", client->frame); @@ -339,6 +343,9 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *c, xcb_unmap_notify_ xcb_destroy_window(c, client->frame); xcb_flush(c); table_remove(byParent, client->frame); + + cleanup_table(client->container->workspace); + free(client); render_layout(c);