]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly cleanup stack_windows when setting clients to floating
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 30 May 2009 09:35:32 +0000 (11:35 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 30 May 2009 09:35:32 +0000 (11:35 +0200)
This fixes ticket #44

include/client.h
src/client.c
src/commands.c
src/floating.c
src/handlers.c

index 2547c52fb0817b185bc5453f38b696da6bd49f54..252f36196836170fba2e3f62c8ae0381b9e2dd21 100644 (file)
@@ -20,7 +20,7 @@
  * one or because it was unmapped
  *
  */
-void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container);
+void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container, bool remove_from_focusstack);
 
 /**
  * Warps the pointer into the given client (in the middle of it, to be specific), therefore
index f4df06ae623b6b3cb8b6b57063a03d8b5d944f12..9eb345654431b15c7b853e0887801b6dcefd6306 100644 (file)
  * one or because it was unmapped
  *
  */
-void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container) {
+void client_remove_from_container(xcb_connection_t *conn, Client *client, Container *container, bool remove_from_focusstack) {
         CIRCLEQ_REMOVE(&(container->clients), client, clients);
 
-        SLIST_REMOVE(&(container->workspace->focus_stack), client, Client, focus_clients);
+        if (remove_from_focusstack)
+                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 */
index d3ef90f204aa31e43d37a4381a6015ee36a4dd6c..811f1676e4e6f8e6d55269b598b80fe051cbb939 100644 (file)
@@ -242,7 +242,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 */
-        client_remove_from_container(conn, current_client, container);
+        client_remove_from_container(conn, current_client, container, true);
 
         if (new->currently_focused != NULL)
                 CIRCLEQ_INSERT_AFTER(&(new->clients), new->currently_focused, current_client, clients);
@@ -505,7 +505,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
 
         assert(to_container != NULL);
 
-        client_remove_from_container(conn, current_client, container);
+        client_remove_from_container(conn, current_client, container, true);
         if (container->workspace->fullscreen_client == current_client)
                 container->workspace->fullscreen_client = NULL;
 
index 3e8c1c07d8eacad93c4e2d31b2e4d6b566e987b7..7ee53638ddeb85a355920d4b394a911ef50d3e77 100644 (file)
@@ -23,6 +23,7 @@
 #include "xcb.h"
 #include "debug.h"
 #include "layout.h"
+#include "client.h"
 
 /* On which border was the dragging initiated? */
 typedef enum { BORDER_LEFT, BORDER_RIGHT, BORDER_TOP, BORDER_BOTTOM} border_t;
@@ -78,7 +79,7 @@ void toggle_floating_mode(xcb_connection_t *conn, Client *client) {
         LOG("Entering floating for client %08x\n", client->child);
 
         /* Remove the client of its container */
-        CIRCLEQ_REMOVE(&(con->clients), client, clients);
+        client_remove_from_container(conn, client, con, false);
         client->container = NULL;
 
         if (con->currently_focused == client) {
index 8f164cd2412ce54053648530614a3585fd8b228b..7682aaf0ecf5e2e81a60427e6329de9c10c07cba 100644 (file)
@@ -534,7 +534,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
                         con->workspace->fullscreen_client = NULL;
 
                 /* Remove the client from the list of clients */
-                client_remove_from_container(conn, client, con);
+                client_remove_from_container(conn, client, con, true);
 
                 /* Set focus to the last focused client in this container */
                 con->currently_focused = get_last_focused_client(conn, con, NULL);