summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-28 14:22:00 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-02 08:04:49 -0700
commit1c24ac1a945fe663e3e6267131025f0141259f97 (patch)
tree85d00ac61f7e29de059d90ee4f641858af49c0f8
parentcd98cb8921861b586724abed307bfead62e4b74a (diff)
downloadsubsurface-1c24ac1a945fe663e3e6267131025f0141259f97.tar.gz
Mobile: don't allow width change without rotation
We get incorrect changes to a new screen width that causes us to try draw to a much larger screen than we actually have. Ignore those changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--mobile-widgets/qml/main.qml21
1 files changed, 17 insertions, 4 deletions
diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml
index 3390579fb..0b5288dfd 100644
--- a/mobile-widgets/qml/main.qml
+++ b/mobile-widgets/qml/main.qml
@@ -35,6 +35,7 @@ Kirigami.ApplicationWindow {
property bool filterToggle: false
property string filterPattern: ""
property bool firstChange: true
+ property int lastOrientation: undefined
onNotificationTextChanged: {
if (notificationText != "") {
@@ -555,6 +556,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
property color lightDrawerColor: "#FFFFFF"
property color darkDrawerColor: "#424242"
property int initialWidth: rootItem.width
+ property int initialHeight: rootItem.height
Component.onCompleted: {
// break the binding
initialWidth = initialWidth * 1
@@ -576,14 +578,25 @@ if you have network connectivity and want to sync your data to cloud storage."),
}
onWidthChanged: {
- console.log("Window width changed to " + width)
+ console.log("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
if (subsurfaceTheme.initialWidth !== undefined) {
if (width !== subsurfaceTheme.initialWidth && rootItem.firstChange) {
- rootItem.firstChange = false;
- console.log("first real change, so recalculating units")
+ rootItem.firstChange = false
+ rootItem.lastOrientation = Screen.primaryOrientation
+ subsurfaceTheme.initialWidth = width
+ subsurfaceTheme.initialHeight = height
+ console.log("first real change, so recalculating units and recording size as " + width + " x " + height)
setupUnits()
+ } else if (rootItem.lastOrientation !== undefined && rootItem.lastOrientation != Screen.primaryOrientation) {
+ console.log("Screen rotated, no action necessary")
+ rootItem.lastOrientation = Screen.primaryOrientation
} else {
- console.log("not recalculating base unit")
+ console.log("size change without rotation to " + width + " x " + height)
+ if (width > subsurfaceTheme.initialWidth) {
+ console.log("resetting to initial width " + subsurfaceTheme.initialWidth + " and height " + subsurfaceTheme.initialHeight)
+ rootItem.width = subsurfaceTheme.initialWidth
+ rootItem.height = subsurfaceTheme.initialHeight
+ }
}
} else {
console.log("width changed before initial width initialized, ignoring")