aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_down.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2019-02-28 19:22:47 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-03-04 12:50:47 -0500
commitacb23fe89199c3c7a86f2bc94904114f2fbab4a7 (patch)
tree215c1173962ae6ae179b5fc9d2268af9c112f22c /sway/input/seatop_down.c
parenttray: fix pixmap colors (diff)
downloadsway-acb23fe89199c3c7a86f2bc94904114f2fbab4a7.tar.gz
sway-acb23fe89199c3c7a86f2bc94904114f2fbab4a7.tar.zst
sway-acb23fe89199c3c7a86f2bc94904114f2fbab4a7.zip
seat: don't send button release when not pressed
All seat operations except "down" eat the button pressed event and don't send it to clients. Thus, when ending such seat operations we shouldn't send the button released event. This commit moves the logic used to send pressed/released into the "down" operation.
Diffstat (limited to 'sway/input/seatop_down.c')
-rw-r--r--sway/input/seatop_down.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c
index c2256c9a..33f9b31a 100644
--- a/sway/input/seatop_down.c
+++ b/sway/input/seatop_down.c
@@ -24,7 +24,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) {
24 e->moved = true; 24 e->moved = true;
25} 25}
26 26
27static void handle_finish(struct sway_seat *seat) { 27static void handle_finish(struct sway_seat *seat, uint32_t time_msec) {
28 struct seatop_down_event *e = seat->seatop_data; 28 struct seatop_down_event *e = seat->seatop_data;
29 struct sway_cursor *cursor = seat->cursor; 29 struct sway_cursor *cursor = seat->cursor;
30 // Set the cursor's previous coords to the x/y at the start of the 30 // Set the cursor's previous coords to the x/y at the start of the
@@ -40,6 +40,8 @@ static void handle_finish(struct sway_seat *seat) {
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);
43} 45}
44 46
45static void handle_abort(struct sway_seat *seat) { 47static void handle_abort(struct sway_seat *seat) {
@@ -60,8 +62,8 @@ static const struct sway_seatop_impl seatop_impl = {
60 .unref = handle_unref, 62 .unref = handle_unref,
61}; 63};
62 64
63void seatop_begin_down(struct sway_seat *seat, 65void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
64 struct sway_container *con, uint32_t button, int sx, int sy) { 66 uint32_t time_msec, uint32_t button, int sx, int sy) {
65 seatop_abort(seat); 67 seatop_abort(seat);
66 68
67 struct seatop_down_event *e = 69 struct seatop_down_event *e =
@@ -80,5 +82,6 @@ void seatop_begin_down(struct sway_seat *seat,
80 seat->seatop_data = e; 82 seat->seatop_data = e;
81 seat->seatop_button = button; 83 seat->seatop_button = button;
82 84
85 seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED);
83 container_raise_floating(con); 86 container_raise_floating(con);
84} 87}