on xenial help sign in
implement the OSK switch internals for u8
951fa2cLukáš Tinkl
data/com.canonical.Unity8.gschema.xml+10
@@ -58,6 +58,16 @@
58 <summary>The uri to the app store</summary>
58 <summary>The uri to the app store</summary>
59 <description>This will be used whenever the user triggers an action to open the app store.</description>
59 <description>This will be used whenever the user triggers an action to open the app store.</description>
60 </key>
60 </key>
61+ <key type="b" name="always-show-osk">
62+ <default>true</default>
63+ <summary>Force showing/hiding the OSK</summary>
64+ <description>Toggle the visibility of the On Screen Keyboard unconditionally</description>
65+ </key>
66+ <key type="b" name="osk-switch-visible">
67+ <default>false</default>
68+ <summary>Whether the OSK switch should be visible</summary>
69+ <description>Toggle the visibility of the OSK switch</description>
70+ </key>
61 </schema>
71 </schema>
62
72
63 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
73 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
qml/OrientedShell.qml+10−8
@@ -183,7 +183,7 @@ Item {
183
183
184 // We need to manually update this on startup as the binding
184 // We need to manually update this on startup as the binding
185 // below doesn't seem to have any effect at that stage
185 // below doesn't seem to have any effect at that stage
186− oskSettings.disableHeight = !shell.oskEnabled || shell.usageScenario == "desktop"
186+ oskSettings.disableHeight = !shell.oskEnabled
187 }
187 }
188
188
189 // we must rotate to a supported orientation regardless of shell's preference
189 // we must rotate to a supported orientation regardless of shell's preference
@@ -194,7 +194,13 @@ Item {
194 Binding {
194 Binding {
195 target: oskSettings
195 target: oskSettings
196 property: "disableHeight"
196 property: "disableHeight"
197− value: !shell.oskEnabled || shell.usageScenario == "desktop"
197+ value: !shell.oskEnabled
198+ }
199+
200+ Binding {
201+ target: unity8Settings
202+ property: "oskSwitchVisible"
203+ value: shell.hasKeyboard
198 }
204 }
199
205
200 readonly property int supportedOrientations: shell.supportedOrientations
206 readonly property int supportedOrientations: shell.supportedOrientations
@@ -268,12 +274,8 @@ Item {
268 mode: applicationArguments.mode
274 mode: applicationArguments.mode
269 hasMouse: pointerInputDevices > 0
275 hasMouse: pointerInputDevices > 0
270 hasKeyboard: keyboardsModel.count > 0
276 hasKeyboard: keyboardsModel.count > 0
271− // TODO: Factor in if the current screen is a touch screen and if the user wants to
277+
272− // have multiple keyboards around. For now we only enable one keyboard at a time
278+ oskEnabled: unity8Settings.alwaysShowOsk || !hasKeyboard || forceOSKEnabled
273− // thus hiding it here if there is a physical one around or if we have a second
274− // screen (the virtual touchpad & osk on the phone) attached.
275− oskEnabled: (keyboardsModel.count === 0 && screens.count === 1) ||
276− forceOSKEnabled
277
279
278 usageScenario: {
280 usageScenario: {
279 if (unity8Settings.usageMode === "Windowed") {
281 if (unity8Settings.usageMode === "Windowed") {
qml/Panel/Panel.qml+2−7
@@ -25,7 +25,6 @@ import Unity.ApplicationMenu 0.1
25import QtQuick.Window 2.2
25import QtQuick.Window 2.2
26// for indicator-keyboard
26// for indicator-keyboard
27import AccountsService 0.1
27import AccountsService 0.1
28−import Unity.InputInfo 0.1
29
28
30import "../ApplicationMenus"
29import "../ApplicationMenus"
31import "../Components"
30import "../Components"
@@ -47,6 +46,7 @@ Item {
47 property bool fullscreenMode: false
46 property bool fullscreenMode: false
48 property real panelAreaShowProgress: 1.0
47 property real panelAreaShowProgress: 1.0
49 property bool greeterShown: false
48 property bool greeterShown: false
49+ property bool hasKeyboard: false
50
50
51 property string mode: "staged"
51 property string mode: "staged"
52
52
@@ -340,7 +340,7 @@ Item {
340 // HACK for indicator-session
340 // HACK for indicator-session
341 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
341 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
342 // HACK for indicator-keyboard
342 // HACK for indicator-keyboard
343− readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || keyboardsModel.count == 0)
343+ readonly property bool hideKeyboardIndicator: identifier == "indicator-keyboard" && (AccountsService.keymaps.length < 2 || !hasKeyboard)
344
344
345 height: parent.height
345 height: parent.height
346 expanded: indicators.expanded
346 expanded: indicators.expanded
@@ -394,11 +394,6 @@ Item {
394 }
394 }
395 }
395 }
396
396
397− InputDeviceModel {
398− id: keyboardsModel
399− deviceFilter: InputInfo.Keyboard
400− }
401−
402 IndicatorsLight {
397 IndicatorsLight {
403 id: indicatorLights
398 id: indicatorLights
404 }
399 }
qml/Shell.qml+1
@@ -531,6 +531,7 @@ StyledItem {
531 fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
531 fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
532 || greeter.hasLockedApp
532 || greeter.hasLockedApp
533 greeterShown: greeter && greeter.shown
533 greeterShown: greeter && greeter.shown
534+ hasKeyboard: shell.hasKeyboard
534 }
535 }
535
536
536 Launcher {
537 Launcher {