Bugfix: when a window is unmapped, correctly pass focus to the next one and cleanup the table

This commit is contained in:
Michael Stapelberg 2009-02-25 01:44:34 +01:00
parent 761e8c07e0
commit 90fa720c6f
2 changed files with 10 additions and 1 deletions

View File

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

View File

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