]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Assign floating cons to correct workspace when moving between monitors (Thank...
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 18 Apr 2011 16:44:39 +0000 (18:44 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 18 Apr 2011 16:44:39 +0000 (18:44 +0200)
Fixes: #371
src/floating.c

index 6cc9a16817adbac4574f5b7538cf18fc5fc44e93..0f65343044143abcfdfe4df5ad1f1620cb1736b7 100644 (file)
@@ -235,6 +235,30 @@ DRAGGING_CB(drag_window_callback) {
     render_con(con, false);
     x_push_node(con, true);
     xcb_flush(conn);
+
+    /* Check if we cross workspace boundaries while moving */
+    Output *output = get_output_containing(
+        con->rect.x + (con->rect.width / 2),
+        con->rect.y + (con->rect.height / 2));
+
+    if (!output) {
+        ELOG("No output found at destination coordinates?\n");
+        return;
+    }
+
+    if (con_get_output(con) == output->con) {
+        DLOG("still the same ws\n");
+        return;
+    }
+
+    DLOG("Need to re-assign!\n");
+
+    Con *content = output_get_content(output->con);
+    Con *ws = TAILQ_FIRST(&(content->nodes_head));
+    DLOG("Moving con %p / %s to workspace %p / %s\n", con, con->name, ws, ws->name);
+    con_move_to_workspace(con, ws);
+    con_focus(con_descend_focused(con));
+    tree_render();
 }
 
 /*