Bugfix: Correctly remove client from container when moving to another workspace

This fixes ticket #16
This commit is contained in:
Michael Stapelberg 2009-04-01 12:02:22 +02:00
parent 0520714aa0
commit 75a35319c9
3 changed files with 4 additions and 6 deletions

View File

@ -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 it from the old container and put it into the new one */
remove_client_from_container(conn, current_client, container); remove_client_from_container(conn, current_client, container);
CIRCLEQ_INSERT_TAIL(&(new->clients), current_client, clients); CIRCLEQ_INSERT_TAIL(&(new->clients), current_client, clients);
SLIST_INSERT_HEAD(&(new->workspace->focus_stack), current_client, focus_clients);
/* Update data structures */ /* Update data structures */
current_client->container = new; 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); assert(to_container != NULL);
CIRCLEQ_REMOVE(&(container->clients), current_client, clients); remove_client_from_container(conn, current_client, container);
SLIST_REMOVE(&(container->workspace->focus_stack), current_client, Client, focus_clients);
CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients); CIRCLEQ_INSERT_TAIL(&(to_container->clients), current_client, clients);
SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients); SLIST_INSERT_HEAD(&(to_container->workspace->focus_stack), current_client, focus_clients);

View File

@ -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 the client from the list of clients */
remove_client_from_container(conn, client, con); 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 */ /* Set focus to the last focused client in this container */
con->currently_focused = NULL; con->currently_focused = NULL;
Client *focus_client; Client *focus_client;

View File

@ -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) { void remove_client_from_container(xcb_connection_t *conn, Client *client, Container *container) {
CIRCLEQ_REMOVE(&(container->clients), client, clients); 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 /* If the container will be empty now and is in stacking mode, we need to
unmap the stack_win */ unmap the stack_win */
if (CIRCLEQ_EMPTY(&(container->clients)) && container->mode == MODE_STACK) { if (CIRCLEQ_EMPTY(&(container->clients)) && container->mode == MODE_STACK) {