aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-06-16 20:56:50 +0200
committerVaxry <[email protected]>2024-06-16 20:56:50 +0200
commitd5ef10abf429355246abcda65fe4c15d886fad7c (patch)
treef7b06602fb72ccacc165c615025a25d45b7b789a
parent172ee1cadaabd3ba4df330f9cdd02fb520b59e71 (diff)
downloadHyprland-d5ef10abf429355246abcda65fe4c15d886fad7c.tar.gz
Hyprland-d5ef10abf429355246abcda65fe4c15d886fad7c.zip
data-device: properly abort drag on missing device
sometimes there is no focused device (e.g. when dnd'ing on nothing or xwayland) in which case abort would fail to send cancelled to the source. ref #6543
-rw-r--r--src/protocols/core/DataDevice.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp
index 986d1176..2d50ff15 100644
--- a/src/protocols/core/DataDevice.cpp
+++ b/src/protocols/core/DataDevice.cpp
@@ -644,11 +644,13 @@ void CWLDataDeviceProtocol::abortDrag() {
g_pInputManager->unsetCursorImage();
dnd.overriddenCursor = false;
- if (!dnd.focusedDevice || !dnd.currentSource)
+ if (!dnd.focusedDevice && !dnd.currentSource)
return;
- dnd.focusedDevice->sendLeave();
- dnd.currentSource->cancelled();
+ if (dnd.focusedDevice)
+ dnd.focusedDevice->sendLeave();
+ if (dnd.currentSource)
+ dnd.currentSource->cancelled();
dnd.focusedDevice.reset();
dnd.currentSource.reset();