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
|
@ -316,6 +316,14 @@ void handle_libinput_event(struct wlr_libinput_backend *backend,
|
|||
case LIBINPUT_EVENT_GESTURE_PINCH_END:
|
||||
handle_pointer_pinch_end(event, libinput_dev);
|
||||
break;
|
||||
#if LIBINPUT_HAS_HOLD_GESTURES
|
||||
case LIBINPUT_EVENT_GESTURE_HOLD_BEGIN:
|
||||
handle_pointer_hold_begin(event, libinput_dev);
|
||||
break;
|
||||
case LIBINPUT_EVENT_GESTURE_HOLD_END:
|
||||
handle_pointer_hold_end(event, libinput_dev);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
wlr_log(WLR_DEBUG, "Unknown libinput event %d", event_type);
|
||||
break;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -66,6 +66,10 @@ void handle_pointer_pinch_update(struct libinput_event *event,
|
|||
struct libinput_device *device);
|
||||
void handle_pointer_pinch_end(struct libinput_event *event,
|
||||
struct libinput_device *device);
|
||||
void handle_pointer_hold_begin(struct libinput_event *event,
|
||||
struct libinput_device *device);
|
||||
void handle_pointer_hold_end(struct libinput_event *event,
|
||||
struct libinput_device *device);
|
||||
|
||||
struct wlr_switch *create_libinput_switch(
|
||||
struct libinput_device *device);
|
||||
|
|
Loading…
Reference in New Issue