From eb19d10d6def7b51db0d331d3491fee5d5efff88 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Thu, 22 Feb 2024 18:05:22 +0000 Subject: [PATCH] Only generate touch events on valid surfaces --- src/input/touch.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/input/touch.c b/src/input/touch.c index 8e139061..008adcb2 100644 --- a/src/input/touch.c +++ b/src/input/touch.c @@ -61,9 +61,10 @@ touch_motion(struct wl_listener *listener, void *data) double sx = lx - touch_point->x_offset; double sy = ly - touch_point->y_offset; - wlr_seat_touch_notify_motion(seat->seat, event->time_msec, - event->touch_id, sx, sy); - if (!touch_point->surface) { + if (touch_point->surface) { + wlr_seat_touch_notify_motion(seat->seat, event->time_msec, + event->touch_id, sx, sy); + } else { cursor_emulate_move_absolute(seat, &event->touch->base, event->x, event->y, event->time_msec); } @@ -126,7 +127,10 @@ touch_up(struct wl_listener *listener, void *data) struct touch_point *touch_point, *tmp; wl_list_for_each_safe(touch_point, tmp, &seat->touch_points, link) { if (touch_point->touch_id == event->touch_id) { - if (!touch_point->surface) { + if (touch_point->surface) { + wlr_seat_touch_notify_up(seat->seat, event->time_msec, + event->touch_id); + } else { cursor_emulate_button(seat, BTN_LEFT, WLR_BUTTON_RELEASED, event->time_msec); } @@ -135,8 +139,6 @@ touch_up(struct wl_listener *listener, void *data) break; } } - - wlr_seat_touch_notify_up(seat->seat, event->time_msec, event->touch_id); } void