]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Correctly handle floating windows when unmapping, fix focus bug when moving
authorMichael Stapelberg <michael@stapelberg.de>
Thu, 25 Jun 2009 11:31:58 +0000 (13:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 25 Jun 2009 11:31:58 +0000 (13:31 +0200)
src/commands.c
src/handlers.c
src/util.c

index f15921b49148a3ebd432ebc13cc4293ad2f4828a..507fdf6d9f6221d2c4ba4dd36761499becd10a09 100644 (file)
@@ -481,8 +481,10 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
 
         floating_assign_to_workspace(client, t_ws);
 
+        bool target_invisible = t_ws->screen->current_workspace != t_ws->num;
+
         /* If we’re moving it to an invisible screen, we need to unmap it */
-        if (t_ws->screen->current_workspace != t_ws->num) {
+        if (target_invisible) {
                 LOG("This workspace is not visible, unmapping\n");
                 xcb_unmap_window(conn, client->frame);
         } else {
@@ -504,7 +506,8 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
 
         render_layout(conn);
 
-        set_focus(conn, client, true);
+        if (!target_invisible)
+                set_focus(conn, client, true);
 }
 
 /*
index 11c8e576258e3a8f6762c4c7955b4b9ed3607517..383207f81639d242b37aa271122d67c182669e3c 100644 (file)
@@ -598,6 +598,8 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
                 if ((con->currently_focused != NULL) && ((con == CUR_CELL) || client->fullscreen))
                         set_focus(conn, con->currently_focused, true);
         } else if (client_is_floating(client)) {
+                LOG("Removing from floating clients\n");
+                TAILQ_REMOVE(&(client->workspace->floating_clients), client, floating_clients);
                 SLIST_REMOVE(&(client->workspace->focus_stack), client, Client, focus_clients);
         }
 
@@ -606,11 +608,6 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
                 SLIST_REMOVE(&(client->workspace->screen->dock_clients), client, Client, dock_clients);
         }
 
-        if (client->floating) {
-                LOG("Removing from floating clients\n");
-                TAILQ_REMOVE(&(client->workspace->floating_clients), client, floating_clients);
-        }
-
         LOG("child of 0x%08x.\n", client->frame);
         xcb_reparent_window(conn, client->child, root, 0, 0);
         xcb_destroy_window(conn, client->frame);
index 9bb42872011aef91ddc6694b3750d7b9eb15f91a..bccb9941bb1ce0ff27291de6fd3294b027605409 100644 (file)
@@ -258,6 +258,7 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) {
         int unmapped_clients = 0;
         FOR_TABLE(u_ws)
                 CIRCLEQ_FOREACH(client, &(u_ws->table[cols][rows]->clients), clients) {
+                        LOG("unmapping normal client %p / %p / %p\n", client, client->frame, client->child);
                         xcb_unmap_window(conn, client->frame);
                         unmapped_clients++;
                 }
@@ -267,6 +268,8 @@ void unmap_workspace(xcb_connection_t *conn, Workspace *u_ws) {
                 if (!client_is_floating(client))
                         continue;
 
+                LOG("unmapping floating client %p / %p / %p\n", client, client->frame, client->child);
+
                 xcb_unmap_window(conn, client->frame);
                 unmapped_clients++;
         }