aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-30 11:40:15 +0200
committerSimon Ser <contact@emersion.fr>2021-07-08 09:12:17 +0200
commit22fd411bc3e77da5ec2e866b6e52e1bf16f69815 (patch)
tree2343548dbbc3ba8b416a079bff0ce4947d276909
parentc1902cdb3f98908e5b52b9c2def9ebc0dd1ebc01 (diff)
cursor: add touch frame event
-rw-r--r--include/wlr/types/wlr_cursor.h1
-rw-r--r--types/wlr_cursor.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h
index 71eddc43..f5a016f4 100644
--- a/include/wlr/types/wlr_cursor.h
+++ b/include/wlr/types/wlr_cursor.h
@@ -63,6 +63,7 @@ struct wlr_cursor {
struct wl_signal touch_down;
struct wl_signal touch_motion;
struct wl_signal touch_cancel;
+ struct wl_signal touch_frame;
struct wl_signal tablet_tool_axis;
struct wl_signal tablet_tool_proximity;
diff --git a/types/wlr_cursor.c b/types/wlr_cursor.c
index 2bc22668..3d75505b 100644
--- a/types/wlr_cursor.c
+++ b/types/wlr_cursor.c
@@ -37,6 +37,7 @@ struct wlr_cursor_device {
struct wl_listener touch_up;
struct wl_listener touch_motion;
struct wl_listener touch_cancel;
+ struct wl_listener touch_frame;
struct wl_listener tablet_tool_axis;
struct wl_listener tablet_tool_proximity;
@@ -105,6 +106,7 @@ struct wlr_cursor *wlr_cursor_create(void) {
wl_signal_init(&cur->events.touch_down);
wl_signal_init(&cur->events.touch_motion);
wl_signal_init(&cur->events.touch_cancel);
+ wl_signal_init(&cur->events.touch_frame);
// tablet tool signals
wl_signal_init(&cur->events.tablet_tool_tip);
@@ -163,6 +165,7 @@ static void cursor_device_destroy(struct wlr_cursor_device *c_device) {
wl_list_remove(&c_device->touch_up.link);
wl_list_remove(&c_device->touch_motion.link);
wl_list_remove(&c_device->touch_cancel.link);
+ wl_list_remove(&c_device->touch_frame.link);
} else if (dev->type == WLR_INPUT_DEVICE_TABLET_TOOL) {
wl_list_remove(&c_device->tablet_tool_axis.link);
wl_list_remove(&c_device->tablet_tool_proximity.link);
@@ -525,6 +528,12 @@ static void handle_touch_cancel(struct wl_listener *listener, void *data) {
wlr_signal_emit_safe(&device->cursor->events.touch_cancel, event);
}
+static void handle_touch_frame(struct wl_listener *listener, void *data) {
+ struct wlr_cursor_device *device =
+ wl_container_of(listener, device, touch_frame);
+ wlr_signal_emit_safe(&device->cursor->events.touch_frame, NULL);
+}
+
static void handle_tablet_tool_tip(struct wl_listener *listener, void *data) {
struct wlr_event_tablet_tool_tip *event = data;
struct wlr_cursor_device *device;
@@ -663,6 +672,9 @@ static struct wlr_cursor_device *cursor_device_create(
wl_signal_add(&device->touch->events.cancel, &c_device->touch_cancel);
c_device->touch_cancel.notify = handle_touch_cancel;
+
+ wl_signal_add(&device->touch->events.frame, &c_device->touch_frame);
+ c_device->touch_frame.notify = handle_touch_frame;
} else if (device->type == WLR_INPUT_DEVICE_TABLET_TOOL) {
wl_signal_add(&device->tablet->events.tip,
&c_device->tablet_tool_tip);