From 1d9a2abc05d7022a31c807bbc5a0f5f793b31e61 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 24 Aug 2011 22:54:10 +0200 Subject: [PATCH] Bugfix: Fix coordinates when moving a floating window to a different output --- src/con.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/con.c b/src/con.c index bf94d460..a67fa2c3 100644 --- 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) -- 2.39.5