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 <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2022-08-09 14:01:29 +02:00
parent db47898ff8
commit 5448580111
2 changed files with 7 additions and 2 deletions

View File

@ -809,6 +809,7 @@ struct weston_touch {
struct wl_listener focus_resource_listener; struct wl_listener focus_resource_listener;
uint32_t focus_serial; uint32_t focus_serial;
struct wl_signal focus_signal; struct wl_signal focus_signal;
bool pending_focus_reset;
uint32_t num_tp; uint32_t num_tp;

View File

@ -2435,8 +2435,7 @@ process_touch_normal(struct weston_touch_device *device,
break; break;
case WL_TOUCH_UP: case WL_TOUCH_UP:
grab->interface->up(grab, time, touch_id); grab->interface->up(grab, time, touch_id);
if (touch->num_tp == 0) touch->pending_focus_reset = true;
weston_touch_set_focus(touch, NULL);
break; break;
} }
} }
@ -2631,6 +2630,11 @@ notify_touch_frame(struct weston_touch_device *device)
case WESTON_TOUCH_MODE_PREP_CALIB: case WESTON_TOUCH_MODE_PREP_CALIB:
grab = device->aggregate->grab; grab = device->aggregate->grab;
grab->interface->frame(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; break;
case WESTON_TOUCH_MODE_CALIB: case WESTON_TOUCH_MODE_CALIB:
case WESTON_TOUCH_MODE_PREP_NORMAL: case WESTON_TOUCH_MODE_PREP_NORMAL: