on xenial help sign in
Disable the tutorial when there's no touchscreen (LP: #1661557)
73a64d5Lukáš Tinkl
qml/OrientedShell.qml+1−1
@@ -274,7 +274,7 @@ Item {
274 mode: applicationArguments.mode
274 mode: applicationArguments.mode
275 hasMouse: pointerInputDevices > 0
275 hasMouse: pointerInputDevices > 0
276 hasKeyboard: keyboardsModel.count > 0
276 hasKeyboard: keyboardsModel.count > 0
277−
277+ hasTouchscreen: touchScreensModel.count > 0
278 oskEnabled: unity8Settings.alwaysShowOsk || !hasKeyboard || forceOSKEnabled
278 oskEnabled: unity8Settings.alwaysShowOsk || !hasKeyboard || forceOSKEnabled
279
279
280 usageScenario: {
280 usageScenario: {
qml/Shell.qml+3−2
@@ -69,6 +69,7 @@ StyledItem {
69 }
69 }
70 property bool hasMouse: false
70 property bool hasMouse: false
71 property bool hasKeyboard: false
71 property bool hasKeyboard: false
72+ property bool hasTouchscreen: false
72
73
73 // to be read from outside
74 // to be read from outside
74 readonly property int mainAppWindowOrientationAngle: stage.mainAppWindowOrientationAngle
75 readonly property int mainAppWindowOrientationAngle: stage.mainAppWindowOrientationAngle
@@ -628,8 +629,8 @@ StyledItem {
628 objectName: "tutorial"
629 objectName: "tutorial"
629 anchors.fill: parent
630 anchors.fill: parent
630
631
631− paused: callManager.hasCalls || !greeter || greeter.active ||
632+ paused: callManager.hasCalls || !greeter || greeter.active || wizard.active
632− wizard.active
633+ || !hasTouchscreen // TODO #1661557 something better for no touchscreen
633 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
634 delayed: dialogs.hasActiveDialog || notifications.hasNotification ||
634 inputMethod.visible ||
635 inputMethod.visible ||
635 (launcher.shown && !launcher.lockedVisible) ||
636 (launcher.shown && !launcher.lockedVisible) ||
tests/qmltests/Tutorial/tst_Tutorial.qml+1
@@ -149,6 +149,7 @@ Rectangle {
149 native_: shellLoader.nativeOrientation
149 native_: shellLoader.nativeOrientation
150 primary: shellLoader.primaryOrientation
150 primary: shellLoader.primaryOrientation
151 }
151 }
152+ hasTouchscreen: true
152
153
153 Component.onDestruction: {
154 Component.onDestruction: {
154 shellLoader.itemDestroyed = true;
155 shellLoader.itemDestroyed = true;
tests/qmltests/tst_OrientedShell.qml+12
@@ -1641,5 +1641,17 @@ Rectangle {
1641 tryCompare(dialogLoader, "item", null);
1641 tryCompare(dialogLoader, "item", null);
1642 compare(window.activeFocusItem, surfaceItem);
1642 compare(window.activeFocusItem, surfaceItem);
1643 }
1643 }
1644+
1645+ function test_tutorialDisabledWithNoTouchscreen() {
1646+ loadShell("desktop");
1647+ usageModeSelector.selectWindowed();
1648+
1649+ MockInputDeviceBackend.addMockDevice("/touchscreen", InputInfo.TouchScreen);
1650+ var tutorial = findChild(shell, "tutorial");
1651+ tryCompare(tutorial, "paused", false);
1652+
1653+ MockInputDeviceBackend.removeDevice("/touchscreen");
1654+ tryCompare(tutorial, "paused", true);
1655+ }
1644 }
1656 }
1645}
1657}
tests/qmltests/tst_Shell.qml+1
@@ -137,6 +137,7 @@ Rectangle {
137 primary: shellLoader.primaryOrientation
137 primary: shellLoader.primaryOrientation
138 }
138 }
139 mode: shellLoader.mode
139 mode: shellLoader.mode
140+ hasTouchscreen: true
140 Component.onCompleted: {
141 Component.onCompleted: {
141 ApplicationManager.startApplication("unity8-dash");
142 ApplicationManager.startApplication("unity8-dash");
142 }
143 }
tests/qmltests/tst_ShellWithPin.qml+1
@@ -69,6 +69,7 @@ Item {
69 property bool itemDestroyed: false
69 property bool itemDestroyed: false
70 sourceComponent: Component {
70 sourceComponent: Component {
71 Shell {
71 Shell {
72+ hasTouchscreen: true
72 Component.onDestruction: {
73 Component.onDestruction: {
73 shellLoader.itemDestroyed = true
74 shellLoader.itemDestroyed = true
74 }
75 }