@@ -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
22import GSettings 1.0
23import GSettings 1.0
23import "Components"
24import "Components"
24import "Rotation"
25import "Rotation"
@@ -77,6 +78,8 @@ Rectangle {
77 InputDeviceModel {
78 InputDeviceModel {
78 id: keyboardsModel
79 id: keyboardsModel
79 deviceFilter: InputInfo.Keyboard
80 deviceFilter: InputInfo.Keyboard
81+ onDeviceAdded: forceOSKEnabled = autopilotDevicePresent();
82+ onDeviceRemoved: forceOSKEnabled = autopilotDevicePresent();
82 InputDeviceModel {
85 InputDeviceModel {
@@ -84,6 +87,27 @@ Rectangle {
84 deviceFilter: InputInfo.TouchScreen
87 deviceFilter: InputInfo.TouchScreen
90+ /* FIXME: This exposes the NameRole as a work arround for lp:1542224.
91+ * When QInputInfo exposes NameRole to QML, this should be removed.
93+ property bool forceOSKEnabled: false
94+ property var autopilotEmulatedDeviceNames: ["py-evdev-uinput"]
95+ UnitySortFilterProxyModel {
97+ model: keyboardsModel
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.")
87 Screens {
111 Screens {
88 id: screens
112 id: screens
@@ -195,7 +219,8 @@ Rectangle {
195 // have multiple keyboards around. For now we only enable one keyboard at a time
219 // 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
220 // 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.
221 // 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) ||
200 // TODO: Factor in the connected input devices (eg: physical keyboard, mouse, touchscreen),
225 // 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.
226 // what's the output device (eg: big TV, desktop monitor, phone display), etc.