diff options
-rw-r--r-- | include/sway/input/cursor.h | 2 | ||||
-rw-r--r-- | sway/input/cursor.c | 26 |
2 files changed, 28 insertions, 0 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 853f8838..cd4d9270 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -42,6 +42,8 @@ struct sway_cursor { | |||
42 | struct wl_listener swipe_begin; | 42 | struct wl_listener swipe_begin; |
43 | struct wl_listener swipe_update; | 43 | struct wl_listener swipe_update; |
44 | struct wl_listener swipe_end; | 44 | struct wl_listener swipe_end; |
45 | struct wl_listener hold_begin; | ||
46 | struct wl_listener hold_end; | ||
45 | 47 | ||
46 | struct wl_listener motion; | 48 | struct wl_listener motion; |
47 | struct wl_listener motion_absolute; | 49 | struct wl_listener motion_absolute; |
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 | ||
987 | static 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 | |||
997 | static 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 | |||
987 | static void handle_image_surface_destroy(struct wl_listener *listener, | 1007 | static 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); |