diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2019-03-06 18:54:41 +1000 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-03-11 14:55:54 +0100 |
commit | d16845d5f0f7ea0316fb9d5e2b7d20b78ca41991 (patch) | |
tree | 3db6efe184aa5c311ecc89140f3f340f25db0687 /sway/input/cursor.c | |
parent | stringop.c: refactor a few functions (diff) | |
download | sway-d16845d5f0f7ea0316fb9d5e2b7d20b78ca41991.tar.gz sway-d16845d5f0f7ea0316fb9d5e2b7d20b78ca41991.tar.zst sway-d16845d5f0f7ea0316fb9d5e2b7d20b78ca41991.zip |
Don't send button events to surfaces when dragging or resizing
It turns out sending button events during all seat operations is not
desirable. This patch introduces a new property
`seatop_impl.allows_events` which allows each operation to define
whether button events should be passed to the surface or not.
The `down` seat operation is the only one that supports this. As all the
other seatops don't support it, the calls to seat_pointer_notify_button
prior to starting them have been removed.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index b96fde88..ef03c6aa 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -613,7 +613,9 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
613 | } else { | 613 | } else { |
614 | state_erase_button(cursor, button); | 614 | state_erase_button(cursor, button); |
615 | } | 615 | } |
616 | seat_pointer_notify_button(seat, time_msec, button, state); | 616 | if (seatop_allows_events(seat)) { |
617 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
618 | } | ||
617 | return; | 619 | return; |
618 | } | 620 | } |
619 | 621 | ||
@@ -682,7 +684,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
682 | if (cont && resize_edge && button == BTN_LEFT && | 684 | if (cont && resize_edge && button == BTN_LEFT && |
683 | state == WLR_BUTTON_PRESSED && !is_floating) { | 685 | state == WLR_BUTTON_PRESSED && !is_floating) { |
684 | seat_set_focus_container(seat, cont); | 686 | seat_set_focus_container(seat, cont); |
685 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
686 | seatop_begin_resize_tiling(seat, cont, button, edge); | 687 | seatop_begin_resize_tiling(seat, cont, button, edge); |
687 | return; | 688 | return; |
688 | } | 689 | } |
@@ -713,7 +714,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
713 | } | 714 | } |
714 | cursor_set_image(seat->cursor, image, NULL); | 715 | cursor_set_image(seat->cursor, image, NULL); |
715 | seat_set_focus_container(seat, cont); | 716 | seat_set_focus_container(seat, cont); |
716 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
717 | seatop_begin_resize_tiling(seat, cont, button, edge); | 717 | seatop_begin_resize_tiling(seat, cont, button, edge); |
718 | return; | 718 | return; |
719 | } | 719 | } |
@@ -729,7 +729,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
729 | cont = cont->parent; | 729 | cont = cont->parent; |
730 | } | 730 | } |
731 | seat_set_focus_container(seat, cont); | 731 | seat_set_focus_container(seat, cont); |
732 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
733 | seatop_begin_move_floating(seat, cont, button); | 732 | seatop_begin_move_floating(seat, cont, button); |
734 | return; | 733 | return; |
735 | } | 734 | } |
@@ -740,7 +739,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
740 | state == WLR_BUTTON_PRESSED) { | 739 | state == WLR_BUTTON_PRESSED) { |
741 | // Via border | 740 | // Via border |
742 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { | 741 | if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { |
743 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
744 | seatop_begin_resize_floating(seat, cont, button, resize_edge); | 742 | seatop_begin_resize_floating(seat, cont, button, resize_edge); |
745 | return; | 743 | return; |
746 | } | 744 | } |
@@ -758,7 +756,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
758 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; | 756 | WLR_EDGE_RIGHT : WLR_EDGE_LEFT; |
759 | edge |= cursor->cursor->y > floater->y + floater->height / 2 ? | 757 | edge |= cursor->cursor->y > floater->y + floater->height / 2 ? |
760 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; | 758 | WLR_EDGE_BOTTOM : WLR_EDGE_TOP; |
761 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
762 | seatop_begin_resize_floating(seat, floater, button, edge); | 759 | seatop_begin_resize_floating(seat, floater, button, edge); |
763 | return; | 760 | return; |
764 | } | 761 | } |
@@ -775,8 +772,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor, | |||
775 | seat_set_focus(seat, node); | 772 | seat_set_focus(seat, node); |
776 | } | 773 | } |
777 | 774 | ||
778 | seat_pointer_notify_button(seat, time_msec, button, state); | ||
779 | |||
780 | // If moving a container by it's title bar, use a threshold for the drag | 775 | // If moving a container by it's title bar, use a threshold for the drag |
781 | if (!mod_pressed && config->tiling_drag_threshold > 0) { | 776 | if (!mod_pressed && config->tiling_drag_threshold > 0) { |
782 | seatop_begin_move_tiling_threshold(seat, cont, button); | 777 | seatop_begin_move_tiling_threshold(seat, cont, button); |