From 15540086484b1b290b75daabd27249f490b6c300 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 29 Sep 2021 01:57:15 +0200 Subject: [PATCH] taskpanel: Use the form factor to define the position we are on Instead of the panel state itself. That would arrive at different points in the event and sometimes plasma would set the offset to the horizontal panel. This should remove this case by only setting the offset when the panel is in the state that needs it. --- containments/taskpanel/package/contents/ui/main.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/containments/taskpanel/package/contents/ui/main.qml b/containments/taskpanel/package/contents/ui/main.qml index 281de739..053b91f1 100644 --- a/containments/taskpanel/package/contents/ui/main.qml +++ b/containments/taskpanel/package/contents/ui/main.qml @@ -249,19 +249,15 @@ PlasmaCore.ColorScope { } } - function resetOffsets() { + Window.onWindowChanged: { if (!Window.window) return; - if (state === "landscape") { + Window.window.offset = Qt.binding(() => { // FIXME: find a more precise way to determine the top panel height - Window.window.offset = PlasmaCore.Units.gridUnit + PlasmaCore.Units.smallSpacing - } else { - Window.window.offset = 0 - } + return plasmoid.formFactor === PlasmaCore.Types.Vertical ? PlasmaCore.Units.gridUnit + PlasmaCore.Units.smallSpacing : 0 + }); } - Window.onWindowChanged: resetOffsets() - onStateChanged: resetOffsets() states: [ State {