on xenial help sign in
Fix Greeter Wallpaper being positioned differently

When unlocking Lomiri, you would see a small jiggle effect as the Greeter faded away. This was due to the Greeter's wallpaper being a different size than the area below it. The Image.PreserveAspectCrop aspect would show a slightly different view of the image and the effect came into being. Fix this by extending the Greeter all the way to the top of the Shell. Then, fix up the topMargin property so the narrowView's clock still avoids the top of the screen. The unit test tried to ensure that the Background would move up if the Greeter was moved down with its y value. However, the topMargin value was used to position the Greeter. anchors.topMargin does not modify the item's y value. The test was therefore useless, so I removed it.

commitc3211f766772c7f2bcdc5b1027eaf53b980b85c8 authorDalton Durst <dalton@ubports.com> dateWed 2 Jun 2021, 08:21 (5 years ago) parent15dc6d6
9 files changed+31−26
qml/Greeter/CoverPage.qml+5−4 qml/Greeter/Greeter.qml+6−2 qml/Greeter/NarrowView.qml+4−3 qml/Greeter/WideView.qml+4−2 qml/Shell.qml+2−2 tests/qmltests/Greeter/TestView.qml+2−1 tests/qmltests/Greeter/tst_Greeter.qml−6 tests/qmltests/Greeter/tst_NarrowView.qml+4−3 tests/qmltests/Greeter/tst_WideView.qml+4−3
qml/Greeter/CoverPage.qml+5−4
@@ -1,5 +1,6 @@
11/*
22 * Copyright (C) 2013-2016 Canonical, Ltd.
3+ * Copyright (C) 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@ Showable {
2627 property real launcherOffset
2728 property alias background: greeterBackground.source
2829 property alias hasCustomBackground: backgroundShade.visible
29− property real backgroundTopMargin
30+ property real panelHeight
3031 property var infographicModel
3132 property bool draggable: true
3233
@@ -88,7 +89,6 @@ Showable {
8889 objectName: "greeterBackground"
8990 anchors {
9091 fill: parent
91− topMargin: root.backgroundTopMargin
9292 }
9393 }
9494
@@ -105,12 +105,13 @@ Showable {
105105 Infographics {
106106 id: infographics
107107 objectName: "infographics"
108− height: parent.height
109108 model: root.infographicModel
110109 clip: true // clip large data bubbles
111110
112111 anchors {
113− verticalCenter: parent.verticalCenter
112+ topMargin: root.panelHeight
113+ top: parent.top
114+ bottom: parent.bottom
114115 left: parent.left
115116 right: parent.right
116117 }
qml/Greeter/Greeter.qml+6−2
@@ -1,5 +1,6 @@
11/*
22 * Copyright (C) 2013-2016 Canonical, Ltd.
3+ * Copyright (C) 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -38,6 +39,9 @@ Showable {
3839 // How far to offset the top greeter layer during a launcher left-drag
3940 property real launcherOffset
4041
42+ // How far down to position the greeter's interface to avoid the Panel
43+ property real panelHeight
44+
4145 readonly property bool active: required || hasLockedApp
4246 readonly property bool fullyShown: loader.item ? loader.item.fullyShown : false
4347
@@ -380,8 +384,8 @@ Showable {
380384
381385 Binding {
382386 target: loader.item
383− property: "backgroundTopMargin"
384− value: -root.y
387+ property: "panelHeight"
388+ value: root.panelHeight
385389 }
386390
387391 Binding {
qml/Greeter/NarrowView.qml+4−3
@@ -1,5 +1,6 @@
11/*
22 * Copyright (C) 2015-2016 Canonical, Ltd.
3+ * Copyright (C) 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -27,7 +28,7 @@ FocusScope {
2728 property alias launcherOffset: coverPage.launcherOffset
2829 property alias currentIndex: loginList.currentIndex
2930 property alias delayMinutes: delayedLockscreen.delayMinutes
30− property alias backgroundTopMargin: coverPage.backgroundTopMargin
31+ property real panelHeight
3132 property url background
3233 property bool hasCustomBackground
3334 property bool locked
@@ -110,7 +111,6 @@ FocusScope {
110111 objectName: "lockscreenBackground"
111112 anchors {
112113 fill: parent
113− topMargin: root.backgroundTopMargin
114114 }
115115 source: root.background
116116 }
@@ -171,6 +171,7 @@ FocusScope {
171171 width: parent.width
172172 background: root.background
173173 hasCustomBackground: root.hasCustomBackground
174+ panelHeight: root.panelHeight
174175 draggable: !root.waiting
175176 onTease: root.tease()
176177 onClicked: hide()
@@ -188,7 +189,7 @@ FocusScope {
188189 Clock {
189190 anchors {
190191 top: parent.top
191− topMargin: units.gu(2)
192+ topMargin: units.gu(2) + panelHeight
192193 horizontalCenter: parent.horizontalCenter
193194 }
194195 }
qml/Greeter/WideView.qml+4−2
@@ -1,5 +1,6 @@
11/*
22 * Copyright (C) 2015-2016 Canonical, Ltd.
3+ * Copyright (C) 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -25,7 +26,7 @@ FocusScope {
2526 focus: true
2627
2728 property alias background: coverPage.background
28− property alias backgroundTopMargin: coverPage.backgroundTopMargin
29+ property alias panelHeight: coverPage.panelHeight
2930 property alias hasCustomBackground: coverPage.hasCustomBackground
3031 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
3132 property alias infographicModel: coverPage.infographicModel
@@ -97,7 +98,8 @@ FocusScope {
9798 state: "LoginList"
9899
99100 infographics {
100− height: 0.75 * parent.height
101+ anchors.topMargin: parent.height * 0.125
102+ anchors.bottomMargin: parent.height * 0.125
101103 anchors.leftMargin: loginList.x + loginList.width
102104 }
103105
qml/Shell.qml+2−2
@@ -1,6 +1,6 @@
11/*
22 * Copyright (C) 2013-2016 Canonical, Ltd.
3− * Copyright (C) 2019-2020 UBports Foundation
3+ * Copyright (C) 2019-2021 UBports Foundation
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -391,7 +391,6 @@ StyledItem {
391391 id: greeterLoader
392392 objectName: "greeterLoader"
393393 anchors.fill: parent
394− anchors.topMargin: panel.panelHeight
395394 sourceComponent: shell.mode != "shell" ? integratedGreeter :
396395 Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
397396 onLoaded: {
@@ -428,6 +427,7 @@ StyledItem {
428427 allowFingerprint: !dialogs.hasActiveDialog &&
429428 !notifications.topmostIsFullscreen &&
430429 !panel.indicators.shown
430+ panelHeight: panel.panelHeight
431431
432432 // avoid overlapping with Launcher's edge drag area
433433 // FIXME: Fix TouchRegistry & friends and remove this workaround
tests/qmltests/Greeter/TestView.qml+2−1
@@ -1,5 +1,6 @@
11/*
22 * Copyright (C) 2015 Canonical, Ltd.
3+ * Copyright (C) 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -25,7 +26,7 @@ Item {
2526 property real launcherOffset
2627 property int currentIndex
2728 property int delayMinutes
28− property real backgroundTopMargin
29+ property real panelHeight
2930 property url background
3031 property bool hasCustomBackground
3132 property bool locked
tests/qmltests/Greeter/tst_Greeter.qml−6
@@ -359,12 +359,6 @@ Item {
359359 }
360360 }
361361
362− function test_backgroundTopMargin() {
363− compare(view.backgroundTopMargin, 0);
364− greeter.y = 5;
365− compare(view.backgroundTopMargin, -5);
366− }
367−
368362 function test_authError() {
369363 selectUser("auth-error");
370364 tryCompare(viewAuthenticationFailedSpy, "count", 1);
tests/qmltests/Greeter/tst_NarrowView.qml+4−3
@@ -1,5 +1,6 @@
11/*
22 * Copyright 2014 Canonical Ltd.
3+ * Copyright 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -54,7 +55,7 @@ Item {
5455 launcherOffset: parseFloat(launcherOffsetField.text)
5556 currentIndex: parseInt(currentIndexField.text, 10)
5657 delayMinutes: parseInt(delayMinutesField.text, 10)
57− backgroundTopMargin: parseFloat(backgroundTopMarginField.text)
58+ panelHeight: parseFloat(panelHeightField.text)
5859 locked: lockedCheckBox.checked
5960 alphanumeric: alphanumericCheckBox.checked
6061
@@ -165,12 +166,12 @@ Item {
165166 }
166167 Row {
167168 TextField {
168− id: backgroundTopMarginField
169+ id: panelHeightField
169170 width: units.gu(10)
170171 text: "0"
171172 }
172173 Label {
173− text: "backgroundTopMargin"
174+ text: "panelHeight"
174175 }
175176 }
176177 Row {
tests/qmltests/Greeter/tst_WideView.qml+4−3
@@ -1,5 +1,6 @@
11/*
22 * Copyright 2014-2016 Canonical Ltd.
3+ * Copyright 2021 UBports Foundation
34 *
45 * This program is free software; you can redistribute it and/or modify
56 * it under the terms of the GNU General Public License as published by
@@ -52,7 +53,7 @@ StyledItem {
5253 launcherOffset: parseFloat(launcherOffsetField.text)
5354 currentIndex: parseInt(currentIndexField.text, 10)
5455 delayMinutes: parseInt(delayMinutesField.text, 10)
55− backgroundTopMargin: parseFloat(backgroundTopMarginField.text)
56+ panelHeight: parseFloat(panelHeightField.text)
5657 locked: lockedCheckBox.checked
5758 inputMethod: fakeInputMethod
5859
@@ -196,12 +197,12 @@ StyledItem {
196197 }
197198 Row {
198199 TextField {
199− id: backgroundTopMarginField
200+ id: panelHeightField
200201 width: units.gu(10)
201202 text: "0"
202203 }
203204 Label {
204− text: "backgroundTopMargin"
205+ text: "panelHeight"
205206 }
206207 }
207208 Row {