diff --git a/src/effects/private/qml/WindowHeap.qml b/src/effects/private/qml/WindowHeap.qml index d95d3db790..2c59023976 100644 --- a/src/effects/private/qml/WindowHeap.qml +++ b/src/effects/private/qml/WindowHeap.qml @@ -54,6 +54,15 @@ FocusScope { function saveDND(key: int, rect: rect) { dndManagerStore[key] = rect; } + function containsDND(key: int): bool { + return key in dndManagerStore; + } + function restoreDND(key: int): rect { + return dndManagerStore[key]; + } + function deleteDND(key: int) { + delete dndManagerStore[key]; + } KWinComponents.WindowThumbnailItem { id: otherScreenThumbnail @@ -119,11 +128,11 @@ FocusScope { onItemAdded: (index, item) => { // restore/reparent from drop var key = item.client.internalId; - if (key in heap.dndManagerStore) { + if (heap.containsDND(key)) { expoLayout.forceLayout(); - var oldGlobalRect = heap.dndManagerStore[key]; + var oldGlobalRect = heap.restoreDND(key); item.restoreDND(oldGlobalRect); - delete heap.dndManagerStore[key]; + heap.deleteDND(key); } else if (heap.effectiveOrganized) { // New window has opened in the middle of a running effect. // Make sure it is positioned before enabling its animations. diff --git a/src/effects/private/qml/WindowHeapDelegate.qml b/src/effects/private/qml/WindowHeapDelegate.qml index 622b1f906f..0cd8671405 100644 --- a/src/effects/private/qml/WindowHeapDelegate.qml +++ b/src/effects/private/qml/WindowHeapDelegate.qml @@ -120,6 +120,9 @@ Item { thumb.substate = "normal"; } + function deleteDND() { + thumb.windowHeap.deleteDND(thumb.client.internalId); + } PlasmaCore.FrameSvgItem { anchors { @@ -392,6 +395,7 @@ Item { // another virtual desktop (not another screen). if (typeof thumbSource !== "undefined") { // Except the case when it was dropped on the same desktop which it's already on, so let's return to normal state anyway. + thumbSource.deleteDND(); thumb.substate = "normal"; } return; @@ -401,6 +405,7 @@ Item { effect.checkItemDroppedOutOfScreen(globalPos, thumbSource); // else, return to normal without reparenting + thumbSource.deleteDND(); thumb.substate = "normal"; } }