@@ -90,7 +90,12 @@ Rectangle {
92 readonly property int pointerInputDevices: miceModel.count + touchPadModel.count
92 readonly property int pointerInputDevices: miceModel.count + touchPadModel.count
93− onPointerInputDevicesChanged: {
93+ onPointerInputDevicesChanged: calculateUsageMode()
95+ function calculateUsageMode() {
96+ if (root.unity8Settings.usageMode === undefined)
97+ return; // gsettings isn't loaded yet, we'll try again in Component.onCompleted
94 console.log("Pointer input devices changed:", pointerInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount)
99 console.log("Pointer input devices changed:", pointerInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount)
95 if (root.unity8Settings.usageMode === "Windowed") {
100 if (root.unity8Settings.usageMode === "Windowed") {
96 if (pointerInputDevices === 0) {
101 if (pointerInputDevices === 0) {
@@ -98,8 +103,8 @@ Rectangle {
98 root.unity8Settings.usageMode = "Staged";
103 root.unity8Settings.usageMode = "Staged";
101− var longEdgeWidth = Math.max(root.width, root.height)
106+ var longEdgeWidth = Math.max(Screen.width, Screen.height);
102− if (longEdgeWidth > units.gu(90)){
107+ if (longEdgeWidth > units.gu(90)) {
103 if (pointerInputDevices > 0 && pointerInputDevices > miceModel.oldCount + touchPadModel.oldCount) {
108 if (pointerInputDevices > 0 && pointerInputDevices > miceModel.oldCount + touchPadModel.oldCount) {
104 root.unity8Settings.usageMode = "Windowed";
109 root.unity8Settings.usageMode = "Windowed";
@@ -154,6 +159,9 @@ Rectangle {
154 if (orientationLocked) {
159 if (orientationLocked) {
155 orientation = orientationLock.savedOrientation;
160 orientation = orientationLock.savedOrientation;
163+ calculateUsageMode();
157 // We need to manually update this on startup as the binding
165 // We need to manually update this on startup as the binding
158 // below doesn't seem to have any effect at that stage
166 // below doesn't seem to have any effect at that stage
159 oskSettings.disableHeight = !shell.oskEnabled || shell.usageScenario == "desktop"
167 oskSettings.disableHeight = !shell.oskEnabled || shell.usageScenario == "desktop"