mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
seat/pointer: handle duplicate presses/releases correctly
This commit is contained in:
parent
775817e278
commit
8730ca9661
3 changed files with 36 additions and 17 deletions
|
|
@ -61,22 +61,12 @@ void handle_pointer_button(struct libinput_event *event,
|
|||
.time_msec = usec_to_msec(libinput_event_pointer_get_time_usec(pevent)),
|
||||
.button = libinput_event_pointer_get_button(pevent),
|
||||
};
|
||||
// Ignore events which aren't a seat-wide state change. For instance, if
|
||||
// the same button is pressed twice on the same seat, ignore the second
|
||||
// press.
|
||||
uint32_t seat_count = libinput_event_pointer_get_seat_button_count(pevent);
|
||||
switch (libinput_event_pointer_get_button_state(pevent)) {
|
||||
case LIBINPUT_BUTTON_STATE_PRESSED:
|
||||
wlr_event.state = WL_POINTER_BUTTON_STATE_PRESSED;
|
||||
if (seat_count != 1) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case LIBINPUT_BUTTON_STATE_RELEASED:
|
||||
wlr_event.state = WL_POINTER_BUTTON_STATE_RELEASED;
|
||||
if (seat_count != 0) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
wl_signal_emit_mutable(&pointer->events.button, &wlr_event);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue