diff --git a/src/effects/desktopgrid/qml/DesktopView.qml b/src/effects/desktopgrid/qml/DesktopView.qml index d2c32946a4..9cfbbe33e5 100644 --- a/src/effects/desktopgrid/qml/DesktopView.qml +++ b/src/effects/desktopgrid/qml/DesktopView.qml @@ -30,15 +30,21 @@ FocusScope { onEntered: { drag.accepted = true; } - onDropped: { + onDropped: drop => { + drop.accepted = true; if (drag.source instanceof DesktopView) { // dragging a desktop as a whole - if (desktopView === drag.source) { + if (drag.source === desktopView) { + drop.action = Qt.IgnoreAction; return; } effect.swapDesktops(drag.source.desktop.x11DesktopNumber, desktop.x11DesktopNumber); } else { // dragging a KWin::Window + if (drag.source.desktop === desktopView.desktop.x11DesktopNumber) { + drop.action = Qt.IgnoreAction; + return; + } drag.source.desktop = desktopView.desktop.x11DesktopNumber; } } @@ -96,6 +102,8 @@ FocusScope { y = 0; } Drag.active: dragHandler.active + Drag.proposedAction: Qt.MoveAction + Drag.supportedActions: Qt.MoveAction Drag.source: desktopView Drag.hotSpot: Qt.point(width * 0.5, height * 0.5) width: parent.width diff --git a/src/effects/overview/qml/DesktopBar.qml b/src/effects/overview/qml/DesktopBar.qml index e4b6b6ca2f..6058bb5767 100644 --- a/src/effects/overview/qml/DesktopBar.qml +++ b/src/effects/overview/qml/DesktopBar.qml @@ -199,10 +199,13 @@ Item { id: dropArea anchors.fill: parent - onEntered: { - drag.accepted = true; - } - onDropped: { + onDropped: drop => { + drop.accepted = true; + // dragging a KWin::Window + if (drag.source.desktop === delegate.desktop.x11DesktopNumber) { + drop.action = Qt.IgnoreAction; + return; + } drag.source.desktop = delegate.desktop.x11DesktopNumber; } } diff --git a/src/effects/private/qml/WindowHeapDelegate.qml b/src/effects/private/qml/WindowHeapDelegate.qml index 0d9548f960..82d2008c68 100644 --- a/src/effects/private/qml/WindowHeapDelegate.qml +++ b/src/effects/private/qml/WindowHeapDelegate.qml @@ -92,6 +92,8 @@ Item { state: thumb.activeDragHandler.active ? "drag" : "normal" Drag.active: thumb.activeDragHandler.active + Drag.proposedAction: Qt.MoveAction + Drag.supportedActions: Qt.MoveAction Drag.source: thumb.client Drag.hotSpot: Qt.point( thumb.activeDragHandler.centroid.pressPosition.x * thumb.targetScale, @@ -324,7 +326,12 @@ Item { if (active) { thumb.activeDragHandler = this; } else { - thumbSource.Drag.drop(); + var action = thumbSource.Drag.drop(); + if (action === Qt.MoveAction) { + // this whole component is in the process of being destroyed due to drop onto + // another virtual desktop (not another screen). + return; + } var globalPos = targetScreen.mapToGlobal(centroid.scenePosition); effect.checkItemDroppedOutOfScreen(globalPos, thumbSource); }