mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-08-02 09:48:50 +00:00
homescreen: Fix binding loops caused by plasmoid changing dimensions
This commit is contained in:
parent
389ba43b16
commit
ee4ba6815a
1 changed files with 23 additions and 4 deletions
|
|
@ -49,10 +49,26 @@ Item {
|
||||||
/**
|
/**
|
||||||
* Margins for the homescreen, taking panels into account.
|
* Margins for the homescreen, taking panels into account.
|
||||||
*/
|
*/
|
||||||
readonly property real topMargin: plasmoid.availableScreenRect.y
|
property real topMargin
|
||||||
readonly property real bottomMargin: root.height - (plasmoid.availableScreenRect.y + plasmoid.availableScreenRect.height)
|
property real bottomMargin
|
||||||
readonly property real leftMargin: plasmoid.availableScreenRect.x
|
property real leftMargin
|
||||||
readonly property real rightMargin: root.width - (plasmoid.availableScreenRect.x + plasmoid.availableScreenRect.width)
|
property real rightMargin
|
||||||
|
|
||||||
|
function evaluateMargins() {
|
||||||
|
topMargin = plasmoid.availableScreenRect.y
|
||||||
|
bottomMargin = root.height - (plasmoid.availableScreenRect.y + plasmoid.availableScreenRect.height)
|
||||||
|
leftMargin = plasmoid.availableScreenRect.x
|
||||||
|
rightMargin = root.width - (plasmoid.availableScreenRect.x + plasmoid.availableScreenRect.width)
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: plasmoid
|
||||||
|
|
||||||
|
// avoid binding loops with root.height and root.width changing along with the availableScreenRect
|
||||||
|
function onAvailableScreenRectChanged() {
|
||||||
|
Qt.callLater(() => root.evaluateMargins());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//BEGIN API implementation
|
//BEGIN API implementation
|
||||||
|
|
||||||
|
|
@ -105,6 +121,9 @@ Item {
|
||||||
//END API implementation
|
//END API implementation
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
// determine the margins used
|
||||||
|
evaluateMargins();
|
||||||
|
|
||||||
// set API variables
|
// set API variables
|
||||||
if (plasmoid.screen == 0) {
|
if (plasmoid.screen == 0) {
|
||||||
MobileShellState.HomeScreenControls.taskSwitcher = taskSwitcher;
|
MobileShellState.HomeScreenControls.taskSwitcher = taskSwitcher;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue