fix-bug-515: always adjust floating position when moving to another output
Floating con position needs to be adjusted when moving to another output, regardless of whether or not the target workspace is visible.
This commit is contained in:
parent
1fbe070f03
commit
a5012f6021
19
src/con.c
19
src/con.c
|
@ -608,23 +608,23 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
||||||
next = ws;
|
next = ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If moving to a visible workspace, call show so it can be considered
|
if (source_output != dest_output) {
|
||||||
* focused. Must do before attaching because workspace_show checks to see
|
|
||||||
* if focused container is in its area. */
|
|
||||||
if (source_output != dest_output &&
|
|
||||||
workspace_is_visible(workspace)) {
|
|
||||||
workspace_show(workspace->name);
|
|
||||||
|
|
||||||
if (fix_coordinates && con->type == CT_FLOATING_CON) {
|
|
||||||
DLOG("Floating window, fixing coordinates\n");
|
|
||||||
/* Take the relative coordinates of the current output, then add them
|
/* Take the relative coordinates of the current output, then add them
|
||||||
* to the coordinate space of the correct output */
|
* to the coordinate space of the correct output */
|
||||||
|
if (fix_coordinates && con->type == CT_FLOATING_CON) {
|
||||||
|
DLOG("Floating window, fixing coordinates\n");
|
||||||
uint32_t rel_x = (con->rect.x - source_output->rect.x);
|
uint32_t rel_x = (con->rect.x - source_output->rect.x);
|
||||||
uint32_t rel_y = (con->rect.y - source_output->rect.y);
|
uint32_t rel_y = (con->rect.y - source_output->rect.y);
|
||||||
con->rect.x = dest_output->rect.x + rel_x;
|
con->rect.x = dest_output->rect.x + rel_x;
|
||||||
con->rect.y = dest_output->rect.y + rel_y;
|
con->rect.y = dest_output->rect.y + rel_y;
|
||||||
} else DLOG("Not fixing coordinates, fix_coordinates flag = %d\n", fix_coordinates);
|
} else DLOG("Not fixing coordinates, fix_coordinates flag = %d\n", fix_coordinates);
|
||||||
|
|
||||||
|
/* If moving to a visible workspace, call show so it can be considered
|
||||||
|
* focused. Must do before attaching because workspace_show checks to see
|
||||||
|
* if focused container is in its area. */
|
||||||
|
if (workspace_is_visible(workspace)) {
|
||||||
|
workspace_show(workspace->name);
|
||||||
|
|
||||||
/* Don’t warp if told so (when dragging floating windows with the
|
/* Don’t warp if told so (when dragging floating windows with the
|
||||||
* mouse for example) */
|
* mouse for example) */
|
||||||
if (dont_warp)
|
if (dont_warp)
|
||||||
|
@ -632,6 +632,7 @@ void con_move_to_workspace(Con *con, Con *workspace, bool fix_coordinates, bool
|
||||||
else
|
else
|
||||||
x_set_warp_to(&(con->rect));
|
x_set_warp_to(&(con->rect));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DLOG("Re-attaching container to %p / %s\n", next, next->name);
|
DLOG("Re-attaching container to %p / %s\n", next, next->name);
|
||||||
/* 5: re-attach the con to the parent of this focused container */
|
/* 5: re-attach the con to the parent of this focused container */
|
||||||
|
|
Loading…
Reference in New Issue