diff options
Diffstat (limited to 'sway/input/cursor.c')
-rw-r--r-- | sway/input/cursor.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 75d055cd..d8ec11ac 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -509,6 +509,24 @@ static void handle_touch_up(struct wl_listener *listener, void *data) { | |||
509 | } | 509 | } |
510 | } | 510 | } |
511 | 511 | ||
512 | static void handle_touch_cancel(struct wl_listener *listener, void *data) { | ||
513 | struct sway_cursor *cursor = wl_container_of(listener, cursor, touch_cancel); | ||
514 | struct wlr_touch_cancel_event *event = data; | ||
515 | cursor_handle_activity_from_device(cursor, &event->touch->base); | ||
516 | |||
517 | struct sway_seat *seat = cursor->seat; | ||
518 | |||
519 | if (cursor->simulating_pointer_from_touch) { | ||
520 | if (cursor->pointer_touch_id == cursor->seat->touch_id) { | ||
521 | cursor->pointer_touch_up = true; | ||
522 | dispatch_cursor_button(cursor, &event->touch->base, | ||
523 | event->time_msec, BTN_LEFT, WLR_BUTTON_RELEASED); | ||
524 | } | ||
525 | } else { | ||
526 | seatop_touch_cancel(seat, event); | ||
527 | } | ||
528 | } | ||
529 | |||
512 | static void handle_touch_motion(struct wl_listener *listener, void *data) { | 530 | static void handle_touch_motion(struct wl_listener *listener, void *data) { |
513 | struct sway_cursor *cursor = | 531 | struct sway_cursor *cursor = |
514 | wl_container_of(listener, cursor, touch_motion); | 532 | wl_container_of(listener, cursor, touch_motion); |
@@ -1100,6 +1118,7 @@ void sway_cursor_destroy(struct sway_cursor *cursor) { | |||
1100 | wl_list_remove(&cursor->frame.link); | 1118 | wl_list_remove(&cursor->frame.link); |
1101 | wl_list_remove(&cursor->touch_down.link); | 1119 | wl_list_remove(&cursor->touch_down.link); |
1102 | wl_list_remove(&cursor->touch_up.link); | 1120 | wl_list_remove(&cursor->touch_up.link); |
1121 | wl_list_remove(&cursor->touch_cancel.link); | ||
1103 | wl_list_remove(&cursor->touch_motion.link); | 1122 | wl_list_remove(&cursor->touch_motion.link); |
1104 | wl_list_remove(&cursor->touch_frame.link); | 1123 | wl_list_remove(&cursor->touch_frame.link); |
1105 | wl_list_remove(&cursor->tool_axis.link); | 1124 | wl_list_remove(&cursor->tool_axis.link); |
@@ -1181,6 +1200,9 @@ struct sway_cursor *sway_cursor_create(struct sway_seat *seat) { | |||
1181 | wl_signal_add(&wlr_cursor->events.touch_up, &cursor->touch_up); | 1200 | wl_signal_add(&wlr_cursor->events.touch_up, &cursor->touch_up); |
1182 | cursor->touch_up.notify = handle_touch_up; | 1201 | cursor->touch_up.notify = handle_touch_up; |
1183 | 1202 | ||
1203 | wl_signal_add(&wlr_cursor->events.touch_cancel, &cursor->touch_cancel); | ||
1204 | cursor->touch_cancel.notify = handle_touch_cancel; | ||
1205 | |||
1184 | wl_signal_add(&wlr_cursor->events.touch_motion, | 1206 | wl_signal_add(&wlr_cursor->events.touch_motion, |
1185 | &cursor->touch_motion); | 1207 | &cursor->touch_motion); |
1186 | cursor->touch_motion.notify = handle_touch_motion; | 1208 | cursor->touch_motion.notify = handle_touch_motion; |