mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-16 08:56:26 -05:00
backend/libinput: send hold gesture events
Receive hold gesture events from libinput and emit the appropiate wlr_pointer signal.
This commit is contained in:
parent
95970b3619
commit
52d2491931
3 changed files with 50 additions and 0 deletions
|
|
@ -260,3 +260,41 @@ void handle_pointer_pinch_end(struct libinput_event *event,
|
|||
};
|
||||
wlr_signal_emit_safe(&wlr_dev->pointer->events.pinch_end, &wlr_event);
|
||||
}
|
||||
|
||||
void handle_pointer_hold_begin(struct libinput_event *event,
|
||||
struct libinput_device *libinput_dev) {
|
||||
struct wlr_input_device *wlr_dev =
|
||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||
if (!wlr_dev) {
|
||||
wlr_log(WLR_DEBUG, "Got a pointer gesture event for a device with no pointers?");
|
||||
return;
|
||||
}
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_hold_begin wlr_event = {
|
||||
.device = wlr_dev,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.fingers = libinput_event_gesture_get_finger_count(gevent),
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_dev->pointer->events.hold_begin, &wlr_event);
|
||||
}
|
||||
|
||||
void handle_pointer_hold_end(struct libinput_event *event,
|
||||
struct libinput_device *libinput_dev) {
|
||||
struct wlr_input_device *wlr_dev =
|
||||
get_appropriate_device(WLR_INPUT_DEVICE_POINTER, libinput_dev);
|
||||
if (!wlr_dev) {
|
||||
wlr_log(WLR_DEBUG, "Got a pointer gesture event for a device with no pointers?");
|
||||
return;
|
||||
}
|
||||
struct libinput_event_gesture *gevent =
|
||||
libinput_event_get_gesture_event(event);
|
||||
struct wlr_event_pointer_hold_end wlr_event = {
|
||||
.device = wlr_dev,
|
||||
.time_msec =
|
||||
usec_to_msec(libinput_event_gesture_get_time_usec(gevent)),
|
||||
.cancelled = libinput_event_gesture_get_cancelled(gevent),
|
||||
};
|
||||
wlr_signal_emit_safe(&wlr_dev->pointer->events.hold_end, &wlr_event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue