effects/overview: Use Kirigami.ScenePosition

This makes the WindowHeap more robust to layout changes. Currently, the
main issue with it is that thumbnails will be misplaced if the heap's
scene position changes.

Kirigami.ScenePosition automagically keeps track of the item's scene pos.
icc-effect-5.26.4
Vlad Zahorodnii 2021-08-19 11:06:51 +03:00
parent ba0f5981bf
commit 66d74f4398
1 changed files with 5 additions and 7 deletions

View File

@ -5,6 +5,7 @@
*/
import QtQuick 2.12
import org.kde.kirigami 2.12 as Kirigami
import org.kde.kwin 3.0 as KWinComponents
import org.kde.kwin.private.overview 1.0
import org.kde.plasma.components 3.0 as PC3
@ -31,9 +32,6 @@ FocusScope {
focus: true
spacing: PlasmaCore.Units.largeSpacing
// This assumes that the position of the WindowHeap is static.
readonly property point scenePosition: mapToItem(null, 0, 0)
Repeater {
id: windowsRepeater
@ -62,8 +60,8 @@ FocusScope {
ExpoCell {
id: cell
layout: expoLayout
naturalX: thumb.client.x - targetScreen.geometry.x - expoLayout.scenePosition.x
naturalY: thumb.client.y - targetScreen.geometry.y - expoLayout.scenePosition.y
naturalX: thumb.client.x - targetScreen.geometry.x - expoLayout.Kirigami.ScenePosition.x
naturalY: thumb.client.y - targetScreen.geometry.y - expoLayout.Kirigami.ScenePosition.y
naturalWidth: thumb.client.width
naturalHeight: thumb.client.height
persistentKey: thumb.client.internalId
@ -74,8 +72,8 @@ FocusScope {
name: "initial"
PropertyChanges {
target: thumb
x: thumb.client.x - targetScreen.geometry.x - expoLayout.scenePosition.x
y: thumb.client.y - targetScreen.geometry.y - expoLayout.scenePosition.y
x: thumb.client.x - targetScreen.geometry.x - expoLayout.Kirigami.ScenePosition.x
y: thumb.client.y - targetScreen.geometry.y - expoLayout.Kirigami.ScenePosition.y
width: thumb.client.width
height: thumb.client.height
}