From 6d4d4502e9188a07751b71b0bde7448e3e9eeef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Mon, 20 Jun 2022 20:57:26 +0200 Subject: [PATCH] selection: reject dnd offers with unsupported mime-types We were already doing this, implicitly, *if* the offer was for the main grid. This patch makes it more clear that we do not accept the offer. --- selection.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/selection.c b/selection.c index 63170b98..c62bdb2b 100644 --- a/selection.c +++ b/selection.c @@ -2322,6 +2322,9 @@ enter(void *data, struct wl_data_device *wl_data_device, uint32_t serial, xassert(offer == seat->clipboard.data_offer); + if (seat->clipboard.mime_type == DATA_OFFER_MIME_UNSET) + goto reject_offer; + /* Remember _which_ terminal the current DnD offer is targeting */ xassert(seat->clipboard.window == NULL); tll_foreach(wayl->terms, it) { @@ -2340,6 +2343,7 @@ enter(void *data, struct wl_data_device *wl_data_device, uint32_t serial, } } +reject_offer: /* Either terminal is already busy sending paste data, or mouse * pointer isn’t over the grid */ seat->clipboard.window = NULL;