on xenial help sign in
Allow the shell to blacklist input devices and force the OSK shown.

This is a work arround to prevent autopilot tests from failing. Fixes: #1542224 Approved by: Michael Terry

commitace9f58e6e9e4cee14a8e828c0f881e22530246b authorJosh Arenson <joshua.arenson@canonical.com> dateThu 10 Mar 2016, 22:41 (11 years ago) parent5fa8184f78a1b0
1 file changed+26−1
qml/OrientedShell.qml+26−1
qml/OrientedShell.qml+26−1
@@ -19,6 +19,7 @@ import QtQuick.Window 2.2
1919import Unity.InputInfo 0.1
2020import Unity.Session 0.1
2121import Unity.Screens 0.1
22+import Utils 0.1
2223import GSettings 1.0
2324import "Components"
2425import "Rotation"
@@ -77,6 +78,8 @@ Rectangle {
7778 InputDeviceModel {
7879 id: keyboardsModel
7980 deviceFilter: InputInfo.Keyboard
81+ onDeviceAdded: forceOSKEnabled = autopilotDevicePresent();
82+ onDeviceRemoved: forceOSKEnabled = autopilotDevicePresent();
8083 }
8184
8285 InputDeviceModel {
@@ -84,6 +87,27 @@ Rectangle {
8487 deviceFilter: InputInfo.TouchScreen
8588 }
8689
90+ /* FIXME: This exposes the NameRole as a work arround for lp:1542224.
91+ * When QInputInfo exposes NameRole to QML, this should be removed.
92+ */
93+ property bool forceOSKEnabled: false
94+ property var autopilotEmulatedDeviceNames: ["py-evdev-uinput"]
95+ UnitySortFilterProxyModel {
96+ id: autopilotDevices
97+ model: keyboardsModel
98+ }
99+
100+ function autopilotDevicePresent() {
101+ for(var i = 0; i < autopilotDevices.count; i++) {
102+ var device = autopilotDevices.get(i);
103+ if (autopilotEmulatedDeviceNames.indexOf(device.name) != -1) {
104+ console.warn("Forcing the OSK to be enabled as there is an autopilot eumlated device present.")
105+ return true;
106+ }
107+ }
108+ return false;
109+ }
110+
87111 Screens {
88112 id: screens
89113 }
@@ -195,7 +219,8 @@ Rectangle {
195219 // have multiple keyboards around. For now we only enable one keyboard at a time
196220 // thus hiding it here if there is a physical one around or if we have a second
197221 // screen (the virtual touchpad & osk on the phone) attached.
198− oskEnabled: keyboardsModel.count === 0 && screens.count === 1
222+ oskEnabled: (keyboardsModel.count === 0 && screens.count === 1) ||
223+ forceOSKEnabled
199224
200225 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
201226 // what's the output device (eg: big TV, desktop monitor, phone display), etc.