wayland: Send dnd_cancelled to source before data_device.leave to target

Otherwise it is harder for clients to detect an actual cancellation when
dragging to itself.
This commit is contained in:
David Edmundson 2024-05-16 09:45:51 +01:00
parent 856925bcc3
commit df60eef0db

View file

@ -255,14 +255,14 @@ void SeatInterfacePrivate::registerPrimarySelectionDevice(PrimarySelectionDevice
void SeatInterfacePrivate::cancelDrag() void SeatInterfacePrivate::cancelDrag()
{ {
if (drag.target) {
drag.target->updateDragTarget(nullptr, 0);
drag.target = nullptr;
}
QObject::disconnect(drag.dragSourceDestroyConnection); QObject::disconnect(drag.dragSourceDestroyConnection);
if (drag.source) { if (drag.source) {
drag.source->dndCancelled(); drag.source->dndCancelled();
} }
if (drag.target) {
drag.target->updateDragTarget(nullptr, 0);
drag.target = nullptr;
}
drag = Drag(); drag = Drag();
Q_EMIT q->dragSurfaceChanged(); Q_EMIT q->dragSurfaceChanged();
Q_EMIT q->dragEnded(); Q_EMIT q->dragEnded();