From 03b465f324f8063bb221cdf323febfa810b93811 Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Sat, 20 Aug 2022 15:49:43 +0200 Subject: [PATCH] drag: destroy data source on touch_up This is in case we drop the drag with no focus, we want to destroy the drag to tell the client the drag was cancelled. --- types/data_device/wlr_drag.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/data_device/wlr_drag.c b/types/data_device/wlr_drag.c index 8c17eeb68..df0ce3b83 100644 --- a/types/data_device/wlr_drag.c +++ b/types/data_device/wlr_drag.c @@ -292,6 +292,10 @@ static uint32_t drag_handle_touch_up(struct wlr_seat_touch_grab *grab, if (drag->focus_client) { drag_drop(drag, time); + } else if (drag->source->impl->dnd_finish) { + // This will end the grab and free `drag` + wlr_data_source_destroy(drag->source); + return 0; } drag_destroy(drag);