diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-27 03:06:37 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2018-08-27 03:06:37 -0400 |
commit | 11c1619f300f076adaa55aa54f996a59f8dada67 (patch) | |
tree | 0b9d4f41cc64e9feb77873c708f27d3c538ac214 /sway/tree | |
parent | d6a5dfc913ba958d38af907ddb7acd7483a1cee7 (diff) |
Stop floaters from snapping on move to new output
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/arrange.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index 60e5b951..8d67116a 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -216,16 +216,18 @@ static void arrange_workspace(struct sway_container *workspace) { // Adjust any floating containers double diff_x = workspace->x - prev_x; double diff_y = workspace->y - prev_y; - for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) { - struct sway_container *floater = - workspace->sway_workspace->floating->items[i]; - container_floating_translate(floater, diff_x, diff_y); - double center_x = floater->x + floater->width / 2; - double center_y = floater->y + floater->height / 2; - struct wlr_box workspace_box; - container_get_box(workspace, &workspace_box); - if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { - container_floating_move_to_center(floater); + if (diff_x != 0 || diff_y != 0) { + for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) { + struct sway_container *floater = + workspace->sway_workspace->floating->items[i]; + container_floating_translate(floater, diff_x, diff_y); + double center_x = floater->x + floater->width / 2; + double center_y = floater->y + floater->height / 2; + struct wlr_box workspace_box; + container_get_box(workspace, &workspace_box); + if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { + container_floating_move_to_center(floater); + } } } |