data-device: minor fixes

send leave after drop, improve checks in completeDrag
This commit is contained in:
Vaxry 2024-06-17 16:14:45 +02:00
parent 785d062887
commit a9c7a0830f

View file

@ -540,7 +540,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> currentSource
} }
void CWLDataDeviceProtocol::updateDrag() { void CWLDataDeviceProtocol::updateDrag() {
if (!dnd.currentSource) if (!dndActive())
return; return;
if (dnd.focusedDevice) if (dnd.focusedDevice)
@ -595,15 +595,13 @@ void CWLDataDeviceProtocol::dropDrag() {
} }
dnd.focusedDevice->sendDrop(); dnd.focusedDevice->sendDrop();
dnd.focusedDevice->sendLeave();
resetDndState(); resetDndState();
if (dnd.overriddenCursor) if (dnd.overriddenCursor)
g_pInputManager->unsetCursorImage(); g_pInputManager->unsetCursorImage();
dnd.overriddenCursor = false; dnd.overriddenCursor = false;
g_pInputManager->simulateMouseMovement();
g_pSeatManager->resendEnterEvents();
} }
bool CWLDataDeviceProtocol::wasDragSuccessful() { bool CWLDataDeviceProtocol::wasDragSuccessful() {
@ -624,11 +622,13 @@ bool CWLDataDeviceProtocol::wasDragSuccessful() {
void CWLDataDeviceProtocol::completeDrag() { void CWLDataDeviceProtocol::completeDrag() {
resetDndState(); resetDndState();
if (!dnd.focusedDevice || !dnd.currentSource) if (!dnd.focusedDevice && !dnd.currentSource)
return; return;
dnd.currentSource->sendDndDropPerformed(); if (dnd.currentSource) {
dnd.currentSource->sendDndFinished(); dnd.currentSource->sendDndDropPerformed();
dnd.currentSource->sendDndFinished();
}
dnd.focusedDevice.reset(); dnd.focusedDevice.reset();
dnd.currentSource.reset(); dnd.currentSource.reset();