aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2022-01-19 19:11:08 -0500
committerLibravatar Simon Ser <contact@emersion.fr>2022-01-22 23:43:46 +0100
commit8ca2847b42533265cdccb78d939d00fc6a062e48 (patch)
tree531f9773c9deee03b399edd23d7a23904be54cf4 /sway/input/cursor.c
parentcmd/swap: error on swapping a container with itself (diff)
downloadsway-8ca2847b42533265cdccb78d939d00fc6a062e48.tar.gz
sway-8ca2847b42533265cdccb78d939d00fc6a062e48.tar.zst
sway-8ca2847b42533265cdccb78d939d00fc6a062e48.zip
input/cursor: pass through pointer hold gestures
This just follows swaywm/wlroots#3047, so `wl_pointer_gestures_v1` clients can be notified of these events.
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r--sway/input/cursor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 6fddee90..f0be2793 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -984,6 +984,26 @@ static void handle_pointer_swipe_end(struct wl_listener *listener, void *data) {
984 event->time_msec, event->cancelled); 984 event->time_msec, event->cancelled);
985} 985}
986 986
987static void handle_pointer_hold_begin(struct wl_listener *listener, void *data) {
988 struct sway_cursor *cursor = wl_container_of(
989 listener, cursor, hold_begin);
990 struct wlr_event_pointer_hold_begin *event = data;
991 cursor_handle_activity_from_device(cursor, event->device);
992 wlr_pointer_gestures_v1_send_hold_begin(
993 cursor->pointer_gestures, cursor->seat->wlr_seat,
994 event->time_msec, event->fingers);
995}
996
997static void handle_pointer_hold_end(struct wl_listener *listener, void *data) {
998 struct sway_cursor *cursor = wl_container_of(
999 listener, cursor, hold_end);
1000 struct wlr_event_pointer_hold_end *event = data;
1001 cursor_handle_activity_from_device(cursor, event->device);
1002 wlr_pointer_gestures_v1_send_hold_end(
1003 cursor->pointer_gestures, cursor->seat->wlr_seat,
1004 event->time_msec, event->cancelled);
1005}
1006
987static void handle_image_surface_destroy(struct wl_listener *listener, 1007static void handle_image_surface_destroy(struct wl_listener *listener,
988 void *data) { 1008 void *data) {
989 struct sway_cursor *cursor = 1009 struct sway_cursor *cursor =
@@ -1061,6 +1081,8 @@ void sway_cursor_destroy(struct sway_cursor *cursor) {
1061 wl_list_remove(&cursor->swipe_begin.link); 1081 wl_list_remove(&cursor->swipe_begin.link);
1062 wl_list_remove(&cursor->swipe_update.link); 1082 wl_list_remove(&cursor->swipe_update.link);
1063 wl_list_remove(&cursor->swipe_end.link); 1083 wl_list_remove(&cursor->swipe_end.link);
1084 wl_list_remove(&cursor->hold_begin.link);
1085 wl_list_remove(&cursor->hold_end.link);
1064 wl_list_remove(&cursor->motion.link); 1086 wl_list_remove(&cursor->motion.link);
1065 wl_list_remove(&cursor->motion_absolute.link); 1087 wl_list_remove(&cursor->motion_absolute.link);
1066 wl_list_remove(&cursor->button.link); 1088 wl_list_remove(&cursor->button.link);
@@ -1117,6 +1139,10 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) {
1117 wl_signal_add(&wlr_cursor->events.swipe_update, &cursor->swipe_update); 1139 wl_signal_add(&wlr_cursor->events.swipe_update, &cursor->swipe_update);
1118 cursor->swipe_end.notify = handle_pointer_swipe_end; 1140 cursor->swipe_end.notify = handle_pointer_swipe_end;
1119 wl_signal_add(&wlr_cursor->events.swipe_end, &cursor->swipe_end); 1141 wl_signal_add(&wlr_cursor->events.swipe_end, &cursor->swipe_end);
1142 cursor->hold_begin.notify = handle_pointer_hold_begin;
1143 wl_signal_add(&wlr_cursor->events.hold_begin, &cursor->hold_begin);
1144 cursor->hold_end.notify = handle_pointer_hold_end;
1145 wl_signal_add(&wlr_cursor->events.hold_end, &cursor->hold_end);
1120 1146
1121 // input events 1147 // input events
1122 wl_signal_add(&wlr_cursor->events.motion, &cursor->motion); 1148 wl_signal_add(&wlr_cursor->events.motion, &cursor->motion);