From: Michael Stapelberg Date: Wed, 24 Aug 2011 20:54:10 +0000 (+0200) Subject: Bugfix: Fix coordinates when moving a floating window to a different output X-Git-Tag: 4.0.2~25^2~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1d9a2abc05d7022a31c807bbc5a0f5f793b31e61;p=i3%2Fi3 Bugfix: Fix coordinates when moving a floating window to a different output --- 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)