From: Michael Stapelberg Date: Wed, 1 Apr 2009 10:02:22 +0000 (+0200) Subject: Bugfix: Correctly remove client from container when moving to another workspace X-Git-Tag: 3.a-bf1~59 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=75a35319c9cd31c99a9aeb53626278bd6b6b0009;p=i3%2Fi3 Bugfix: Correctly remove client from container when moving to another workspace This fixes ticket #16 --- diff --git a/src/commands.c b/src/commands.c index 3a27a117..36589b10 100644 --- a/src/commands.c +++ b/src/commands.c @@ -219,6 +219,7 @@ static void move_current_window(xcb_connection_t *conn, direction_t direction) { /* Remove it from the old container and put it into the new one */ remove_client_from_container(conn, current_client, container); CIRCLEQ_INSERT_TAIL(&(new->clients), current_client, clients); + SLIST_INSERT_HEAD(&(new->workspace->focus_stack), current_client, focus_clients); /* Update data structures */ current_client->container = new; @@ -424,8 +425,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa assert(to_container != NULL); - CIRCLEQ_REMOVE(&(container->clients), current_client, clients); - SLIST_REMOVE(&(container->workspace->focus_stack), current_client, Client, focus_clients); + remove_client_from_container(conn, current_client, container); CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients); SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients); diff --git a/src/handlers.c b/src/handlers.c index 7f4b491c..e912350c 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -586,10 +586,6 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti /* Remove the client from the list of clients */ remove_client_from_container(conn, client, con); - /* Remove from the focus stack */ - LOG("Removing from focus stack\n"); - SLIST_REMOVE(&(con->workspace->focus_stack), client, Client, focus_clients); - /* Set focus to the last focused client in this container */ con->currently_focused = NULL; Client *focus_client; diff --git a/src/util.c b/src/util.c index d38e4e8a..24c42912 100644 --- a/src/util.c +++ b/src/util.c @@ -191,6 +191,8 @@ char *convert_utf8_to_ucs2(char *input, int *real_strlen) { void remove_client_from_container(xcb_connection_t *conn, Client *client, Container *container) { CIRCLEQ_REMOVE(&(container->clients), client, clients); + SLIST_REMOVE(&(container->workspace->focus_stack), client, Client, focus_clients); + /* 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) {