diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-27 13:44:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-27 13:44:08 -0400 |
commit | 98ef29c22878c256dea5b4f0d1eaf556bfcb145f (patch) | |
tree | 4e6db1e7ea1edf864c700b2c110b3388f2bdf1e1 | |
parent | Merge pull request #2494 from RyanDwyer/fix-overflowing-subsurfaces (diff) | |
parent | Stop floaters from snapping on move to new output (diff) | |
download | sway-98ef29c22878c256dea5b4f0d1eaf556bfcb145f.tar.gz sway-98ef29c22878c256dea5b4f0d1eaf556bfcb145f.tar.zst sway-98ef29c22878c256dea5b4f0d1eaf556bfcb145f.zip |
Merge pull request #2523 from RedSoxFan/fix-floating-drag-outputs
Stop floaters from snapping on move to new output
-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) { | |||
216 | // Adjust any floating containers | 216 | // Adjust any floating containers |
217 | double diff_x = workspace->x - prev_x; | 217 | double diff_x = workspace->x - prev_x; |
218 | double diff_y = workspace->y - prev_y; | 218 | double diff_y = workspace->y - prev_y; |
219 | for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) { | 219 | if (diff_x != 0 || diff_y != 0) { |
220 | struct sway_container *floater = | 220 | for (int i = 0; i < workspace->sway_workspace->floating->length; ++i) { |
221 | workspace->sway_workspace->floating->items[i]; | 221 | struct sway_container *floater = |
222 | container_floating_translate(floater, diff_x, diff_y); | 222 | workspace->sway_workspace->floating->items[i]; |
223 | double center_x = floater->x + floater->width / 2; | 223 | container_floating_translate(floater, diff_x, diff_y); |
224 | double center_y = floater->y + floater->height / 2; | 224 | double center_x = floater->x + floater->width / 2; |
225 | struct wlr_box workspace_box; | 225 | double center_y = floater->y + floater->height / 2; |
226 | container_get_box(workspace, &workspace_box); | 226 | struct wlr_box workspace_box; |
227 | if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { | 227 | container_get_box(workspace, &workspace_box); |
228 | container_floating_move_to_center(floater); | 228 | if (!wlr_box_contains_point(&workspace_box, center_x, center_y)) { |
229 | container_floating_move_to_center(floater); | ||
230 | } | ||
229 | } | 231 | } |
230 | } | 232 | } |
231 | 233 | ||