From: Michael Stapelberg Date: Thu, 5 Mar 2009 16:08:57 +0000 (+0100) Subject: Bugfix: Correctly set currently_focused when clients are destroyed X-Git-Tag: 3.a~89 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=76c201f94074ff258f3b7916b84509f4efb804df;p=i3%2Fi3 Bugfix: Correctly set currently_focused when clients are destroyed --- diff --git a/src/handlers.c b/src/handlers.c index 36f4378b..f7ddc587 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -446,8 +446,16 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti printf("Removing from focus stack\n"); SLIST_REMOVE(&(con->workspace->focus_stack), client, Client, focus_clients); - /* Remove from currently_focused */ + /* Set currently_focused to the next client which will get focus in this + particular container. This does not necessarily correspond with the client + that will be focused next */ con->currently_focused = NULL; + Client *focus_client; + SLIST_FOREACH(focus_client, &(con->workspace->focus_stack), focus_clients) + if (focus_client->container == con) { + con->currently_focused = focus_client; + break; + } /* Actually set focus, if there is a window which should get it */ if (!SLIST_EMPTY(&(con->workspace->focus_stack)))