@@ -79,26 +79,25 @@ Rectangle {
7979 InputDeviceModel {
8080 id: keyboardsModel
8181 deviceFilter: InputInfo.Keyboard
82− property int oldCount: 0
8382 }
84− readonly property int physicalInputDevices: miceModel.count + keyboardsModel.count + touchPadModel.count
85− onPhysicalInputDevicesChanged: {
86− console.log("Input devices changed:", physicalInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount + keyboardsModel.oldCount)
83+
84+ InputDeviceModel {
85+ id: touchScreensModel
86+ deviceFilter: InputInfo.TouchScreen
87+ }
88+
89+ readonly property int pointerInputDevices: miceModel.count + touchPadModel.count
90+ onPointerInputDevicesChanged: {
91+ console.log("Pointer input devices changed:", pointerInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount)
8792 if (root.unity8Settings.usageMode === "Windowed") {
88− if (physicalInputDevices === 0) {
89− // All devices have been unplugged. Move to staged.
93+ if (pointerInputDevices === 0) {
94+ // All pointer devices have been unplugged. Move to staged.
9095 root.unity8Settings.usageMode = "Staged";
9196 }
9297 } else {
9398 var longEdgeWidth = Math.max(root.width, root.height)
94− if (longEdgeWidth > units.gu(120)) {
95− if (keyboardsModel.count + miceModel.count + touchPadModel.count > 0 &&
96− physicalInputDevices > miceModel.oldCount + touchPadModel.oldCount + keyboardsModel.oldCount) {
97− root.unity8Settings.usageMode = "Windowed"
98− }
99− } else if (longEdgeWidth > units.gu(90)){
100− if (miceModel.count + touchPadModel.count > 0 &&
101− miceModel.count + touchPadModel.count > miceModel.oldCount + touchPadModel.oldCount) {
99+ if (longEdgeWidth > units.gu(90)){
100+ if (pointerInputDevices > 0 && pointerInputDevices > miceModel.oldCount + touchPadModel.oldCount) {
102101 root.unity8Settings.usageMode = "Windowed";
103102 }
104103 } else {
@@ -108,12 +107,6 @@ Rectangle {
108107 }
109108 miceModel.oldCount = miceModel.count;
110109 touchPadModel.oldCount = touchPadModel.count;
111− keyboardsModel.oldCount = keyboardsModel.count;
112− }
113−
114− InputDeviceModel {
115− id: touchScreensModel
116− deviceFilter: InputInfo.TouchScreen
117110 }
118111
119112 Screens {