From 5448580111b5ff992ce2603cb6e99b9f54db7ad8 Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Tue, 9 Aug 2022 14:01:29 +0200 Subject: [PATCH] input: send touch frame event after up event Currently the frame event gets lost: The touch focus is removed in the 'up' event. So the focus is gone when the frame event arrives so it is never sent to the clients. To avoid this, keep the touch focus until the frame is handled. Signed-off-by: Michael Olbrich --- include/libweston/libweston.h | 1 + libweston/input.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/libweston/libweston.h b/include/libweston/libweston.h index 38d7a6e94..2e4f56a0c 100644 --- a/include/libweston/libweston.h +++ b/include/libweston/libweston.h @@ -809,6 +809,7 @@ struct weston_touch { struct wl_listener focus_resource_listener; uint32_t focus_serial; struct wl_signal focus_signal; + bool pending_focus_reset; uint32_t num_tp; diff --git a/libweston/input.c b/libweston/input.c index 7cbbdb684..e493e4d80 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -2435,8 +2435,7 @@ process_touch_normal(struct weston_touch_device *device, break; case WL_TOUCH_UP: grab->interface->up(grab, time, touch_id); - if (touch->num_tp == 0) - weston_touch_set_focus(touch, NULL); + touch->pending_focus_reset = true; break; } } @@ -2631,6 +2630,11 @@ notify_touch_frame(struct weston_touch_device *device) case WESTON_TOUCH_MODE_PREP_CALIB: grab = device->aggregate->grab; grab->interface->frame(grab); + if (grab->touch->pending_focus_reset) { + if (grab->touch->num_tp == 0) + weston_touch_set_focus(grab->touch, NULL); + grab->touch->pending_focus_reset = false; + } break; case WESTON_TOUCH_MODE_CALIB: case WESTON_TOUCH_MODE_PREP_NORMAL: