From 78c94d07199b11e85cb7e047f9e0a62bbf610fda Mon Sep 17 00:00:00 2001 From: Michael Olbrich Date: Mon, 30 Mar 2020 13:59:03 +0200 Subject: [PATCH] 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 --- libweston/data-device.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libweston/data-device.c b/libweston/data-device.c index 6ac6f65f..3c627346 100644 --- a/libweston/data-device.c +++ b/libweston/data-device.c @@ -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);