on xenial help sign in
Allow the shell to blacklist input devices and force the OSK shown.
2764498Josh Arenson
qml/OrientedShell.qml+27−1
@@ -19,6 +19,7 @@ import QtQuick.Window 2.2
19import Unity.InputInfo 0.1
19import Unity.InputInfo 0.1
20import Unity.Session 0.1
20import Unity.Session 0.1
21import Unity.Screens 0.1
21import Unity.Screens 0.1
22+import Utils 0.1
22import GSettings 1.0
23import GSettings 1.0
23import "Components"
24import "Components"
24import "Rotation"
25import "Rotation"
@@ -84,6 +85,30 @@ Rectangle {
84 deviceFilter: InputInfo.TouchScreen
85 deviceFilter: InputInfo.TouchScreen
85 }
86 }
86
87
88+ /* FIXME: This is a work arround for lp:1542224.
89+ * When QInputInfo exposes NameRole to QML, the filtering should
90+ * happen in the backend.
91+ */
92+ property bool blacklistedDevicePresent: false
93+ property var blacklistedDeviceList: ["py-evdev-uinput"]
94+ UnitySortFilterProxyModel {
95+ id: blacklistedDevices
96+ model: keyboardsModel
97+ onCountChanged: {
98+ root.blacklistedDevicePresent = blacklistedDevicePresent();
99+ }
100+
101+ function blacklistedDevicePresent() {
102+ for(var i = 0; i < count; i++) {
103+ var device = get(i);
104+ if (blacklistedDeviceList.indexOf(device.name) != -1) {
105+ return true;
106+ }
107+ }
108+ return false;
109+ }
110+ }
111+
87 Screens {
112 Screens {
88 id: screens
113 id: screens
89 }
114 }
@@ -195,7 +220,8 @@ Rectangle {
195 // have multiple keyboards around. For now we only enable one keyboard at a time
220 // have multiple keyboards around. For now we only enable one keyboard at a time
196 // thus hiding it here if there is a physical one around or if we have a second
221 // thus hiding it here if there is a physical one around or if we have a second
197 // screen (the virtual touchpad & osk on the phone) attached.
222 // screen (the virtual touchpad & osk on the phone) attached.
198− oskEnabled: keyboardsModel.count === 0 && screens.count === 1
223+ oskEnabled: (keyboardsModel.count === 0 && screens.count === 1) ||
224+ blacklistedDevicePresent
199
225
200 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
226 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
201 // what's the output device (eg: big TV, desktop monitor, phone display), etc.
227 // what's the output device (eg: big TV, desktop monitor, phone display), etc.