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.
This commit is contained in:
Aleix Pol 2021-09-29 01:57:15 +02:00 committed by Devin Lin
parent 8335934aef
commit 1554008648

View file

@ -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 {