aboutsummaryrefslogtreecommitdiff
path: root/backend/libinput/pointer.c
diff options
context:
space:
mode:
authorJosé Expósito <jose.exposito89@gmail.com>2021-07-12 19:50:44 +0200
committerSimon Ser <contact@emersion.fr>2021-09-27 15:30:31 +0200
commit52d249193190c44d1f1d07c36ae57f1dfa16a9e0 (patch)
treec9c7db9f7d807dbcce33334bdf7fac17e2237f97 /backend/libinput/pointer.c
parent95970b361960e5b8786eaa608d66f18b15d86efb (diff)
backend/libinput: send hold gesture events
Receive hold gesture events from libinput and emit the appropiate wlr_pointer signal.
Diffstat (limited to 'backend/libinput/pointer.c')
-rw-r--r--backend/libinput/pointer.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/backend/libinput/pointer.c b/backend/libinput/pointer.c
index 2e799df6..520f98dc 100644
--- a/backend/libinput/pointer.c
+++ b/backend/libinput/pointer.c
@@ -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);
+}