From a9c7a0830fd9a8b9fc4065f1cd654efd1326691a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Mon, 17 Jun 2024 16:14:45 +0200 Subject: [PATCH] data-device: minor fixes send leave after drop, improve checks in completeDrag --- src/protocols/core/DataDevice.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/protocols/core/DataDevice.cpp b/src/protocols/core/DataDevice.cpp index 2d50ff15..9634d569 100644 --- a/src/protocols/core/DataDevice.cpp +++ b/src/protocols/core/DataDevice.cpp @@ -540,7 +540,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP currentSource } void CWLDataDeviceProtocol::updateDrag() { - if (!dnd.currentSource) + if (!dndActive()) return; if (dnd.focusedDevice) @@ -595,15 +595,13 @@ void CWLDataDeviceProtocol::dropDrag() { } dnd.focusedDevice->sendDrop(); + dnd.focusedDevice->sendLeave(); resetDndState(); if (dnd.overriddenCursor) g_pInputManager->unsetCursorImage(); dnd.overriddenCursor = false; - - g_pInputManager->simulateMouseMovement(); - g_pSeatManager->resendEnterEvents(); } bool CWLDataDeviceProtocol::wasDragSuccessful() { @@ -624,11 +622,13 @@ bool CWLDataDeviceProtocol::wasDragSuccessful() { void CWLDataDeviceProtocol::completeDrag() { resetDndState(); - if (!dnd.focusedDevice || !dnd.currentSource) + if (!dnd.focusedDevice && !dnd.currentSource) return; - dnd.currentSource->sendDndDropPerformed(); - dnd.currentSource->sendDndFinished(); + if (dnd.currentSource) { + dnd.currentSource->sendDndDropPerformed(); + dnd.currentSource->sendDndFinished(); + } dnd.focusedDevice.reset(); dnd.currentSource.reset();