aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-06-30 13:35:25 +0200
committerSimon Ser <contact@emersion.fr>2021-07-08 09:18:20 +0200
commit711403015921a931d5a5f2b93f53bf52ff52f0e3 (patch)
treed81ec72a0f9156b0b462f37d9d4eacab79ba42c7 /sway
parent4832fc937fae5a5e2af8828a7092c9026bd300e0 (diff)
Add support for touch frame events
Update for the breaking change in [1]. [1]: https://github.com/swaywm/wlroots/pull/3001
Diffstat (limited to 'sway')
-rw-r--r--sway/input/cursor.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 95edf7be..96b5b935 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -495,7 +495,6 @@ static void handle_touch_down(struct wl_listener *listener, void *data) {
pointer_motion(cursor, event->time_msec, event->device, dx, dy, dx, dy);
dispatch_cursor_button(cursor, event->device, event->time_msec,
BTN_LEFT, WLR_BUTTON_PRESSED);
- wlr_seat_pointer_notify_frame(wlr_seat);
}
}
@@ -511,7 +510,6 @@ static void handle_touch_up(struct wl_listener *listener, void *data) {
cursor->simulating_pointer_from_touch = false;
dispatch_cursor_button(cursor, event->device, event->time_msec,
BTN_LEFT, WLR_BUTTON_RELEASED);
- wlr_seat_pointer_notify_frame(wlr_seat);
}
} else {
wlr_seat_touch_notify_up(wlr_seat, event->time_msec, event->touch_id);
@@ -559,6 +557,19 @@ static void handle_touch_motion(struct wl_listener *listener, void *data) {
}
}
+static void handle_touch_frame(struct wl_listener *listener, void *data) {
+ struct sway_cursor *cursor =
+ wl_container_of(listener, cursor, touch_frame);
+
+ struct wlr_seat *wlr_seat = cursor->seat->wlr_seat;
+
+ if (cursor->simulating_pointer_from_touch) {
+ wlr_seat_pointer_notify_frame(wlr_seat);
+ } else {
+ wlr_seat_touch_notify_frame(wlr_seat);
+ }
+}
+
static double apply_mapping_from_coord(double low, double high, double value) {
if (isnan(value)) {
return value;
@@ -1044,6 +1055,7 @@ void sway_cursor_destroy(struct sway_cursor *cursor) {
wl_list_remove(&cursor->touch_down.link);
wl_list_remove(&cursor->touch_up.link);
wl_list_remove(&cursor->touch_motion.link);
+ wl_list_remove(&cursor->touch_frame.link);
wl_list_remove(&cursor->tool_axis.link);
wl_list_remove(&cursor->tool_tip.link);
wl_list_remove(&cursor->tool_button.link);
@@ -1119,6 +1131,9 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) {
&cursor->touch_motion);
cursor->touch_motion.notify = handle_touch_motion;
+ wl_signal_add(&wlr_cursor->events.touch_frame, &cursor->touch_frame);
+ cursor->touch_frame.notify = handle_touch_frame;
+
wl_signal_add(&wlr_cursor->events.tablet_tool_axis,
&cursor->tool_axis);
cursor->tool_axis.notify = handle_tool_axis;