diff options
author | Thayne McCombs <astrothayne@gmail.com> | 2020-01-21 23:05:39 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-27 11:27:47 +0200 |
commit | b20d52f71d6567b26199050ac0a2735eefd5a985 (patch) | |
tree | ae7403f35fe8c7c3f10619ebe807cdc1e8146525 | |
parent | Keep windows in bounds on move to position mouse (diff) | |
download | sway-b20d52f71d6567b26199050ac0a2735eefd5a985.tar.gz sway-b20d52f71d6567b26199050ac0a2735eefd5a985.tar.zst sway-b20d52f71d6567b26199050ac0a2735eefd5a985.zip |
Use wlr_output_layout_output_at to get output for move to cursor
-rw-r--r-- | sway/commands/move.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 23d392f9..c1d1fade 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -766,19 +766,18 @@ static struct cmd_results *cmd_move_to_position_pointer( | |||
766 | double ly = cursor->y - container->height / 2; | 766 | double ly = cursor->y - container->height / 2; |
767 | 767 | ||
768 | /* Correct target coordinates to be in bounds (on screen). */ | 768 | /* Correct target coordinates to be in bounds (on screen). */ |
769 | for (int i = 0; i < root->outputs->length; ++i) { | 769 | struct wlr_output *output = wlr_output_layout_output_at( |
770 | struct wlr_box box; | 770 | root->output_layout, cursor->x, cursor->y); |
771 | output_get_box(root->outputs->items[i], &box); | 771 | if (output) { |
772 | if (wlr_box_contains_point(&box, cursor->x, cursor->y)) { | 772 | struct wlr_box *box = |
773 | lx = fmax(lx, box.x); | 773 | wlr_output_layout_get_box(root->output_layout, output); |
774 | ly = fmax(ly, box.y); | 774 | lx = fmax(lx, box->x); |
775 | if (lx + container->width > box.x + box.width) { | 775 | ly = fmax(ly, box->y); |
776 | lx = box.x + box.width - container->width; | 776 | if (lx + container->width > box->x + box->width) { |
777 | } | 777 | lx = box->x + box->width - container->width; |
778 | if (ly + container->height > box.y + box.height) { | 778 | } |
779 | ly = box.y + box.height - container->height; | 779 | if (ly + container->height > box->y + box->height) { |
780 | } | 780 | ly = box->y + box->height - container->height; |
781 | break; | ||
782 | } | 781 | } |
783 | } | 782 | } |
784 | 783 | ||