effects/overview: Properly map the windowHeap geometry

In https://invent.kde.org/plasma/kwin/-/merge_requests/6747
the comparison with window heap geometry was done with the
heap x/y/width/height properties to detect if the drop was done
off the heap, but this is wrong, because in Overview
window heaps are positioned with Translation transforms, so
we need to properly mapping its geometry with mapToItem
which is transforms aware
wilder/Plasma/6.3
Marco Martin 1 year ago
parent a334133376
commit 31c4b8ac55
  1. 11
      src/plugins/private/qml/WindowHeapDelegate.qml

@ -149,6 +149,9 @@ ExpoCell {
}
function restoreDND(oldGlobalRect: rect) {
const newGlobalRect = mapFromItem(null, oldGlobalRect);
// We need proper mapping for the heap geometry becuase they are positioned with
// translation transformations
const heapRect = thumb.windowHeap.mapToItem(null, Qt.size(thumb.windowHeap.width, thumb.windowHeap.height));
// Disable bindings
returnAnimation.active = true;
x = newGlobalRect.x;
@ -159,10 +162,10 @@ ExpoCell {
returnAnimation.restart();
// If we dropped on another desktop, don't make the window fly off the screen
if (newGlobalRect.x < thumb.windowHeap.x ||
newGlobalRect.y < thumb.windowHeap.y ||
thumb.windowHeap.x + thumb.windowHeap.width < newGlobalRect.x + newGlobalRect.width ||
thumb.windowHeap.y + thumb.windowHeap.height < newGlobalRect.y + newGlobalRect.height) {
if (oldGlobalRect.x < heapRect.x ||
oldGlobalRect.y < heapRect.y ||
heapRect.x + heapRect.width < oldGlobalRect.x + oldGlobalRect.width ||
heapRect.y + heapRect.height < oldGlobalRect.y + oldGlobalRect.height) {
returnAnimation.complete();
}
}

Loading…
Cancel
Save