From 5df63feea58aef45c6b97ca821f270360d9de0d5 Mon Sep 17 00:00:00 2001 From: Simon Long Date: Fri, 23 Feb 2024 10:59:23 +0000 Subject: [PATCH] Only calculate offset points if needed --- src/input/touch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/input/touch.c b/src/input/touch.c index 008adcb2..e530c57f 100644 --- a/src/input/touch.c +++ b/src/input/touch.c @@ -58,10 +58,10 @@ touch_motion(struct wl_listener *listener, void *data) struct touch_point *touch_point; wl_list_for_each(touch_point, &seat->touch_points, link) { if (touch_point->touch_id == event->touch_id) { - double sx = lx - touch_point->x_offset; - double sy = ly - touch_point->y_offset; - if (touch_point->surface) { + 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); } else { @@ -102,11 +102,11 @@ touch_down(struct wl_listener *listener, void *data) wlr_cursor_absolute_to_layout_coords(seat->cursor, &event->touch->base, event->x, event->y, &lx, &ly); - /* Apply offsets to get surface coords before reporting event */ - double sx = lx - x_offset; - double sy = ly - y_offset; - if (touch_point->surface) { + /* Apply offsets to get surface coords before reporting event */ + double sx = lx - x_offset; + double sy = ly - y_offset; + wlr_seat_touch_notify_down(seat->seat, touch_point->surface, event->time_msec, event->touch_id, sx, sy); } else {