diff options
author | emersion <contact@emersion.fr> | 2019-02-28 19:22:47 +0100 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-28 23:02:06 -0500 |
commit | 88b283c55713c45968e2df5f8b89a40a0b32f720 (patch) | |
tree | 4fad7681ca82cf833920731624ce9f52df709bc0 /sway | |
parent | 416c6ecb99f90a7c84cce0b106401652692a4681 (diff) |
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')
-rw-r--r-- | sway/input/cursor.c | 6 | ||||
-rw-r--r-- | sway/input/seat.c | 4 | ||||
-rw-r--r-- | sway/input/seatop_down.c | 9 | ||||
-rw-r--r-- | sway/input/seatop_move_floating.c | 2 | ||||
-rw-r--r-- | sway/input/seatop_move_tiling.c | 2 | ||||
-rw-r--r-- | sway/input/seatop_resize_floating.c | 2 | ||||
-rw-r--r-- | sway/input/seatop_resize_tiling.c | 2 |
7 files changed, 14 insertions, 13 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 87811550..44b5ff14 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c @@ -606,8 +606,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, // Handle existing seat operation if (seat_doing_seatop(seat)) { if (button == seat->seatop_button && state == WLR_BUTTON_RELEASED) { - seatop_finish(seat); - seat_pointer_notify_button(seat, time_msec, button, state); + seatop_finish(seat, time_msec); } if (state == WLR_BUTTON_PRESSED) { state_add_button(cursor, button); @@ -784,8 +783,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor, // Handle mousedown on a container surface if (surface && cont && state == WLR_BUTTON_PRESSED) { seat_set_focus_container(seat, cont); - seat_pointer_notify_button(seat, time_msec, button, state); - seatop_begin_down(seat, cont, button, sx, sy); + seatop_begin_down(seat, cont, time_msec, button, sx, sy); return; } diff --git a/sway/input/seat.c b/sway/input/seat.c index a16d3f27..9888ddfc 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -1211,9 +1211,9 @@ void seatop_motion(struct sway_seat *seat, uint32_t time_msec) { } } -void seatop_finish(struct sway_seat *seat) { +void seatop_finish(struct sway_seat *seat, uint32_t time_msec) { if (seat->seatop_impl && seat->seatop_impl->finish) { - seat->seatop_impl->finish(seat); + seat->seatop_impl->finish(seat, time_msec); } free(seat->seatop_data); seat->seatop_data = NULL; 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) { e->moved = true; } -static void handle_finish(struct sway_seat *seat) { +static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { struct seatop_down_event *e = seat->seatop_data; struct sway_cursor *cursor = seat->cursor; // 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) { cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy); cursor_send_pointer_motion(cursor, 0, node, surface, sx, sy); } + seat_pointer_notify_button(seat, time_msec, + seat->seatop_button, WLR_BUTTON_RELEASED); } static void handle_abort(struct sway_seat *seat) { @@ -60,8 +62,8 @@ static const struct sway_seatop_impl seatop_impl = { .unref = handle_unref, }; -void seatop_begin_down(struct sway_seat *seat, - struct sway_container *con, uint32_t button, int sx, int sy) { +void seatop_begin_down(struct sway_seat *seat, struct sway_container *con, + uint32_t time_msec, uint32_t button, int sx, int sy) { seatop_abort(seat); struct seatop_down_event *e = @@ -80,5 +82,6 @@ void seatop_begin_down(struct sway_seat *seat, seat->seatop_data = e; seat->seatop_button = button; + seat_pointer_notify_button(seat, time_msec, button, WLR_BUTTON_PRESSED); container_raise_floating(con); } diff --git a/sway/input/seatop_move_floating.c b/sway/input/seatop_move_floating.c index 08e3a5a4..8a48a968 100644 --- a/sway/input/seatop_move_floating.c +++ b/sway/input/seatop_move_floating.c @@ -17,7 +17,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { desktop_damage_whole_container(e->con); } -static void handle_finish(struct sway_seat *seat) { +static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { struct seatop_move_floating_event *e = seat->seatop_data; // We "move" the container to its own location diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index 1e548f5a..4b5aa81e 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -226,7 +226,7 @@ static bool is_parallel(enum sway_container_layout layout, return layout_is_horiz == edge_is_horiz; } -static void handle_finish(struct sway_seat *seat) { +static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { struct seatop_move_tiling_event *e = seat->seatop_data; if (!e->target_node) { diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index 12851b40..bf6c7ab4 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c @@ -142,7 +142,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { arrange_container(con); } -static void handle_finish(struct sway_seat *seat) { +static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { cursor_set_image(seat->cursor, "left_ptr", NULL); } diff --git a/sway/input/seatop_resize_tiling.c b/sway/input/seatop_resize_tiling.c index cb0f723d..db32065c 100644 --- a/sway/input/seatop_resize_tiling.c +++ b/sway/input/seatop_resize_tiling.c @@ -49,7 +49,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { } } -static void handle_finish(struct sway_seat *seat) { +static void handle_finish(struct sway_seat *seat, uint32_t time_msec) { cursor_set_image(seat->cursor, "left_ptr", NULL); } |