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
1 changed files with 7 additions and 7 deletions

View File

@ -540,7 +540,7 @@ void CWLDataDeviceProtocol::initiateDrag(WP<CWLDataSourceResource> 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();