]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix coordinates when moving a floating window to a different output
authorMichael Stapelberg <michael@stapelberg.de>
Wed, 24 Aug 2011 20:54:10 +0000 (22:54 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 24 Aug 2011 20:54:10 +0000 (22:54 +0200)
src/con.c

index bf94d460fb5f0980d9f32bee90a41ecb82ccaa0f..a67fa2c3d81d48c0026278aed98bab430e86b3b7 100644 (file)
--- a/src/con.c
+++ b/src/con.c
@@ -592,6 +592,16 @@ void con_move_to_workspace(Con *con, Con *workspace) {
         workspace_is_visible(workspace)) {
         workspace_show(workspace->name);
 
+        if (con->type == CT_FLOATING_CON) {
+            DLOG("Floating window, fixing coordinates\n");
+            /* Take the relative coordinates of the current output, then add them
+             * to the coordinate space of the correct output */
+            uint32_t rel_x = (con->rect.x - source_output->rect.x);
+            uint32_t rel_y = (con->rect.y - source_output->rect.y);
+            con->rect.x = dest_output->rect.x + rel_x;
+            con->rect.y = dest_output->rect.y + rel_y;
+        }
+
         /* Unset warp_to if target con is floating.  Otherwise, set warp_to to
          * current target container. */
         if (con->type == CT_FLOATING_CON)