aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-03-01 09:35:11 +0100
committerDrew DeVault <sir@cmpwn.com>2019-03-01 12:36:19 -0700
commite8f012c993e0584f8c7eb4ff1bb6367bd9f30f9e (patch)
treeb9889c1a90797d29722f06be138f6d2e59209147
parent2fde5c95d887406e2ffa561f127ba6ddee521b33 (diff)
downloadwlroots-e8f012c993e0584f8c7eb4ff1bb6367bd9f30f9e.tar.xz
seat: only store serial if pressing a button
The grab serial can be used to start a pointer grab. A button pressed event should be used for this purpose. Thus, we should only save the grab serial if it's the first button pressed event we send. This commit makes it so the serial is not saved if a button is released while another button is still pressed.
-rw-r--r--types/seat/wlr_seat_pointer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/types/seat/wlr_seat_pointer.c b/types/seat/wlr_seat_pointer.c
index 9a216fd6..1aabea0f 100644
--- a/types/seat/wlr_seat_pointer.c
+++ b/types/seat/wlr_seat_pointer.c
@@ -356,7 +356,8 @@ uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat,
struct wlr_seat_pointer_grab *grab = wlr_seat->pointer_state.grab;
uint32_t serial = grab->interface->button(grab, time, button, state);
- if (serial && wlr_seat->pointer_state.button_count == 1) {
+ if (serial && wlr_seat->pointer_state.button_count == 1 &&
+ state == WL_POINTER_BUTTON_STATE_PRESSED) {
wlr_seat->pointer_state.grab_serial = serial;
}