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


(cherry picked from commit 31c4b8ac55)

31c4b8ac effects/overview: Properly map the windowHeap geometry

Co-authored-by: Marco Martin <notmart@gmail.com>
wilder/Plasma/6.2
Marco Martin 1 year ago
parent 48b965b5c6
commit 9996ff08bd
  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