on xenial help sign in
drop the switching by kbd only again
895dd86Michael Zanetti
qml/OrientedShell.qml+13−20
@@ -79,26 +79,25 @@ Rectangle {
79 InputDeviceModel {
79 InputDeviceModel {
80 id: keyboardsModel
80 id: keyboardsModel
81 deviceFilter: InputInfo.Keyboard
81 deviceFilter: InputInfo.Keyboard
82− property int oldCount: 0
83 }
82 }
83+
84+ InputDeviceModel {
85+ id: touchScreensModel
86+ deviceFilter: InputInfo.TouchScreen
87+ }
88+
84− readonly property int physicalInputDevices: miceModel.count + keyboardsModel.count + touchPadModel.count
89+ readonly property int pointerInputDevices: miceModel.count + touchPadModel.count
85− onPhysicalInputDevicesChanged: {
90+ onPointerInputDevicesChanged: {
86− console.log("Input devices changed:", physicalInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount + keyboardsModel.oldCount)
91+ console.log("Pointer input devices changed:", pointerInputDevices, "current mode:", root.unity8Settings.usageMode, "old device count", miceModel.oldCount + touchPadModel.oldCount)
87 if (root.unity8Settings.usageMode === "Windowed") {
92 if (root.unity8Settings.usageMode === "Windowed") {
88− if (physicalInputDevices === 0) {
93+ if (pointerInputDevices === 0) {
89− // All devices have been unplugged. Move to staged.
94+ // All pointer devices have been unplugged. Move to staged.
90 root.unity8Settings.usageMode = "Staged";
95 root.unity8Settings.usageMode = "Staged";
91 }
96 }
92 } else {
97 } else {
93 var longEdgeWidth = Math.max(root.width, root.height)
98 var longEdgeWidth = Math.max(root.width, root.height)
94− if (longEdgeWidth > units.gu(120)) {
99+ if (longEdgeWidth > units.gu(90)){
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) {
100+ if (pointerInputDevices > 0 && pointerInputDevices > miceModel.oldCount + touchPadModel.oldCount) {
102 root.unity8Settings.usageMode = "Windowed";
101 root.unity8Settings.usageMode = "Windowed";
103 }
102 }
104 } else {
103 } else {
@@ -108,12 +107,6 @@ Rectangle {
108 }
107 }
109 miceModel.oldCount = miceModel.count;
108 miceModel.oldCount = miceModel.count;
110 touchPadModel.oldCount = touchPadModel.count;
109 touchPadModel.oldCount = touchPadModel.count;
111− keyboardsModel.oldCount = keyboardsModel.count;
112− }
113−
114− InputDeviceModel {
115− id: touchScreensModel
116− deviceFilter: InputInfo.TouchScreen
117 }
110 }
118
111
119 Screens {
112 Screens {