]> git.sur5r.net Git - i3/i3/commitdiff
Fix the coords of floating cons when moving workspaces.
authorFernando Tarlá Cardoso Lemos <fernandotcl@gmail.com>
Sun, 29 Jan 2012 18:22:43 +0000 (16:22 -0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 15 Feb 2012 18:03:37 +0000 (18:03 +0000)
Fixes floating containers seemingly showing up in the wrong
workspace after moving workspaces containing floating containers.

We must *always* fix the coordinates of floating containers when
moving workspaces across outputs. That's because the coordinates
of floating containers are *not* relative to the workspaces.

src/commands.c

index f570d6d8a78524ec0ab59d6ba0b6008d6f82ea9e..da8bccbae19e962f2b43392b514ab396cedbcbe6 100644 (file)
@@ -822,6 +822,7 @@ char *cmd_move_workspace_to_output(Match *current_match, char *name) {
             ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"init\"}");
         }
 
+        /* detach from the old output and attach to the new output */
         bool workspace_was_visible = workspace_is_visible(ws);
         Con *old_content = ws->parent;
         con_detach(ws);
@@ -833,6 +834,12 @@ char *cmd_move_workspace_to_output(Match *current_match, char *name) {
             workspace_show(focus_ws);
         }
         con_attach(ws, content, false);
+
+        /* fix the coordinates of the floating containers */
+        Con *floating_con;
+        TAILQ_FOREACH(floating_con, &(ws->floating_head), floating_windows)
+            floating_fix_coordinates(floating_con, &(old_content->rect), &(content->rect));
+
         ipc_send_event("workspace", I3_IPC_EVENT_WORKSPACE, "{\"change\":\"move\"}");
         if (workspace_was_visible) {
             /* Focus the moved workspace on the destination output. */