]> git.sur5r.net Git - i3/i3/blobdiff - src/randr.c
Merge branch 'master' into next
[i3/i3] / src / randr.c
index f69d15a8cc97a38a329bf48f2c44f8f988e333bb..b691a3326a42640b2b0082399f8efd19310a7d01 100644 (file)
@@ -358,6 +358,19 @@ void init_ws_for_output(Output *output, Con *content) {
             workspace_show(previous);
         }
 
+        /* Render the output on which the workspace was to get correct Rects.
+         * Then, we need to work with the "content" container, since we cannot
+         * be sure that the workspace itself was rendered at all (in case it’s
+         * invisible, it won’t be rendered). */
+        render_con(workspace_out, false);
+        Con *ws_out_content = output_get_content(workspace_out);
+
+        Con *floating_con;
+        TAILQ_FOREACH(floating_con, &(workspace->floating_head), floating_windows)
+            /* NB: We use output->con here because content is not yet rendered,
+             * so it has a rect of {0, 0, 0, 0}. */
+            floating_fix_coordinates(floating_con, &(ws_out_content->rect), &(output->con->rect));
+
         con_detach(workspace);
         con_attach(workspace, content, false);
 
@@ -681,7 +694,7 @@ void randr_query_outputs(void) {
                     DLOG("Fixing the coordinates of floating containers\n");
                     Con *floating_con;
                     TAILQ_FOREACH(floating_con, &(current->floating_head), floating_windows)
-                        floating_fix_coordinates(floating_con, &(old_content->rect), &(first_content->rect));
+                        floating_fix_coordinates(floating_con, &(output->con->rect), &(first->con->rect));
                     DLOG("Done, next\n");
                 }
                 DLOG("re-attached all workspaces\n");