aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2019-03-04 21:04:16 +1000
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-04 12:50:47 -0500
commit0c1605784de3385ecd143fd26d17fac8cfea9b43 (patch)
treed4c4dc0ebdf1e9406991549ad72e5dbd3fa0a5b3
parentsway.1.scd: document environment vars set by sway (diff)
downloadsway-0c1605784de3385ecd143fd26d17fac8cfea9b43.tar.gz
sway-0c1605784de3385ecd143fd26d17fac8cfea9b43.tar.zst
sway-0c1605784de3385ecd143fd26d17fac8cfea9b43.zip
Allow concurrent clicks
If two cursor buttons are pressed at the same time, the client will now be notified of the second button press. The main reason for not sending the concurrent presses was due to an early return in dispatch_cursor_button if a seatop is in progress. This patch makes it call seat_pointer_notify_button prior to returning. But it also has to make sure there's not a mismatch in events such as a release without a press. Prior to this patch, the down seatop would send press and release events in its begin and finish functions. No other seatops did this. A press event would be sent prior to starting tiling drag, but never an associated release. After this patch, no seatops send their own press or release events. We send them prior to calling the seatop begin functions, then the first part of dispatch_cursor_button handles all presses during seatops and when releasing the seatop.
-rw-r--r--sway/input/cursor.c7
-rw-r--r--sway/input/seatop_down.c3
2 files changed, 7 insertions, 3 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 44b5ff14..b96fde88 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -613,6 +613,7 @@ 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 return; 617 return;
617 } 618 }
618 619
@@ -681,6 +682,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
681 if (cont && resize_edge && button == BTN_LEFT && 682 if (cont && resize_edge && button == BTN_LEFT &&
682 state == WLR_BUTTON_PRESSED && !is_floating) { 683 state == WLR_BUTTON_PRESSED && !is_floating) {
683 seat_set_focus_container(seat, cont); 684 seat_set_focus_container(seat, cont);
685 seat_pointer_notify_button(seat, time_msec, button, state);
684 seatop_begin_resize_tiling(seat, cont, button, edge); 686 seatop_begin_resize_tiling(seat, cont, button, edge);
685 return; 687 return;
686 } 688 }
@@ -711,6 +713,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
711 } 713 }
712 cursor_set_image(seat->cursor, image, NULL); 714 cursor_set_image(seat->cursor, image, NULL);
713 seat_set_focus_container(seat, cont); 715 seat_set_focus_container(seat, cont);
716 seat_pointer_notify_button(seat, time_msec, button, state);
714 seatop_begin_resize_tiling(seat, cont, button, edge); 717 seatop_begin_resize_tiling(seat, cont, button, edge);
715 return; 718 return;
716 } 719 }
@@ -726,6 +729,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
726 cont = cont->parent; 729 cont = cont->parent;
727 } 730 }
728 seat_set_focus_container(seat, cont); 731 seat_set_focus_container(seat, cont);
732 seat_pointer_notify_button(seat, time_msec, button, state);
729 seatop_begin_move_floating(seat, cont, button); 733 seatop_begin_move_floating(seat, cont, button);
730 return; 734 return;
731 } 735 }
@@ -736,6 +740,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
736 state == WLR_BUTTON_PRESSED) { 740 state == WLR_BUTTON_PRESSED) {
737 // Via border 741 // Via border
738 if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) { 742 if (button == BTN_LEFT && resize_edge != WLR_EDGE_NONE) {
743 seat_pointer_notify_button(seat, time_msec, button, state);
739 seatop_begin_resize_floating(seat, cont, button, resize_edge); 744 seatop_begin_resize_floating(seat, cont, button, resize_edge);
740 return; 745 return;
741 } 746 }
@@ -753,6 +758,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
753 WLR_EDGE_RIGHT : WLR_EDGE_LEFT; 758 WLR_EDGE_RIGHT : WLR_EDGE_LEFT;
754 edge |= cursor->cursor->y > floater->y + floater->height / 2 ? 759 edge |= cursor->cursor->y > floater->y + floater->height / 2 ?
755 WLR_EDGE_BOTTOM : WLR_EDGE_TOP; 760 WLR_EDGE_BOTTOM : WLR_EDGE_TOP;
761 seat_pointer_notify_button(seat, time_msec, button, state);
756 seatop_begin_resize_floating(seat, floater, button, edge); 762 seatop_begin_resize_floating(seat, floater, button, edge);
757 return; 763 return;
758 } 764 }
@@ -784,6 +790,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
784 if (surface && cont && state == WLR_BUTTON_PRESSED) { 790 if (surface && cont && state == WLR_BUTTON_PRESSED) {
785 seat_set_focus_container(seat, cont); 791 seat_set_focus_container(seat, cont);
786 seatop_begin_down(seat, cont, time_msec, button, sx, sy); 792 seatop_begin_down(seat, cont, time_msec, button, sx, sy);
793 seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED);
787 return; 794 return;
788 } 795 }
789 796
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c
index 33f9b31a..7f394095 100644
--- a/sway/input/seatop_down.c
+++ b/sway/input/seatop_down.c
@@ -40,8 +40,6 @@ static void handle_finish(struct sway_seat *seat, uint32_t time_msec) {
40 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); 40 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
41 cursor_send_pointer_motion(cursor, 0, node, surface, sx, sy); 41 cursor_send_pointer_motion(cursor, 0, node, surface, sx, sy);
42 } 42 }
43 seat_pointer_notify_button(seat, time_msec,
44 seat->seatop_button, WLR_BUTTON_RELEASED);
45} 43}
46 44
47static void handle_abort(struct sway_seat *seat) { 45static void handle_abort(struct sway_seat *seat) {
@@ -82,6 +80,5 @@ void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
82 seat->seatop_data = e; 80 seat->seatop_data = e;
83 seat->seatop_button = button; 81 seat->seatop_button = button;
84 82
85 seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED);
86 container_raise_floating(con); 83 container_raise_floating(con);
87} 84}