libweston: explicitly cancel start_drag if no matching input device is found

Otherwise, the client will assume that dragging is in progress and remains in
that state forever.
This can happen when weston processes the mouse up event just before the
start_drag() arrives.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
Michael Olbrich 2020-03-30 13:59:03 +02:00 committed by Daniel Stone
parent 4fb095eca1
commit 78c94d0719

View file

@ -1057,13 +1057,17 @@ data_device_start_drag(struct wl_client *client, struct wl_resource *resource,
touch->focus &&
touch->focus->surface == origin;
if (!is_pointer_grab && !is_touch_grab)
return;
/* FIXME: Check that the data source type array isn't empty. */
if (source_resource)
source = wl_resource_get_user_data(source_resource);
if (!is_pointer_grab && !is_touch_grab) {
if (source)
wl_data_source_send_cancelled(source->resource);
return;
}
if (icon_resource)
icon = wl_resource_get_user_data(icon_resource);