2017-06-13 16:27:15 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2019-07-27 10:53:54 +02:00
|
|
|
#include <wayland-server-core.h>
|
2017-06-21 16:27:45 +02:00
|
|
|
#include <wlr/interfaces/wlr_pointer.h>
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <wlr/types/wlr_pointer.h>
|
2017-06-13 16:27:15 +02:00
|
|
|
|
2017-08-14 15:55:48 +02:00
|
|
|
void wlr_pointer_init(struct wlr_pointer *pointer,
|
2022-01-31 16:20:01 +01:00
|
|
|
const struct wlr_pointer_impl *impl, const char *name) {
|
2022-02-09 22:14:56 +01:00
|
|
|
wlr_input_device_init(&pointer->base, WLR_INPUT_DEVICE_POINTER, name);
|
2022-01-31 16:20:01 +01:00
|
|
|
pointer->base.pointer = pointer;
|
|
|
|
|
2017-06-13 16:27:15 +02:00
|
|
|
pointer->impl = impl;
|
|
|
|
wl_signal_init(&pointer->events.motion);
|
|
|
|
wl_signal_init(&pointer->events.motion_absolute);
|
|
|
|
wl_signal_init(&pointer->events.button);
|
|
|
|
wl_signal_init(&pointer->events.axis);
|
2019-01-26 11:04:05 +01:00
|
|
|
wl_signal_init(&pointer->events.frame);
|
2019-01-25 23:51:38 +01:00
|
|
|
wl_signal_init(&pointer->events.swipe_begin);
|
|
|
|
wl_signal_init(&pointer->events.swipe_update);
|
|
|
|
wl_signal_init(&pointer->events.swipe_end);
|
|
|
|
wl_signal_init(&pointer->events.pinch_begin);
|
|
|
|
wl_signal_init(&pointer->events.pinch_update);
|
|
|
|
wl_signal_init(&pointer->events.pinch_end);
|
pointer: add hold pointer event definition
As touchpad touches are generally fully abstracted, a client cannot
currently know when a user is interacting with the touchpad without
moving. This is solved by hold gestures.
Hold gestures are notifications about one or more fingers being held
down on the touchpad without significant movement.
Hold gestures are primarily designed for two interactions:
- Hold to interact: where a hold gesture is active for some time a
menu could pop up, some object could be selected, etc.
- Hold to cancel: where e.g. kinetic scrolling is currently active,
the start of a hold gesture can be used to stop the scroll.
Unlike swipe and pinch, hold gestures, by definition, do not have
movement, so there is no need for an "update" stage in the gesture.
Create two structs, wlr_event_pointer_hold_begin and
wlr_event_pointer_hold_end, to represent hold gesture events and the
signals to emit them: wlr_pointer->pointer.hold_begin/hold_end.
2021-07-12 19:50:09 +02:00
|
|
|
wl_signal_init(&pointer->events.hold_begin);
|
|
|
|
wl_signal_init(&pointer->events.hold_end);
|
2017-06-13 16:27:15 +02:00
|
|
|
}
|
|
|
|
|
2022-03-02 19:57:28 +01:00
|
|
|
void wlr_pointer_finish(struct wlr_pointer *pointer) {
|
2022-01-31 16:20:01 +01:00
|
|
|
wlr_input_device_finish(&pointer->base);
|
2017-06-13 16:27:15 +02:00
|
|
|
}
|