on xenial help sign in
implement the OSK switch internals for u8
commit951fa2c29f73f0f511664836ce05a2a4e489a66c authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 15 Feb 2017, 16:03 (10 years ago) parent66888de
4 files changed+23−15
data/com.canonical.Unity8.gschema.xml+10 qml/OrientedShell.qml+10−8 qml/Panel/Panel.qml+2−7 qml/Shell.qml+1
data/com.canonical.Unity8.gschema.xml+10
@@ -58,6 +58,16 @@
5858 <summary>The uri to the app store</summary>
5959 <description>This will be used whenever the user triggers an action to open the app store.</description>
6060 </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>
6171 </schema>
6272
6373 <schema path="/com/canonical/unity8/greeter/" id="com.canonical.Unity8.Greeter" gettext-domain="unity8">
qml/OrientedShell.qml+10−8
@@ -183,7 +183,7 @@ Item {
183183
184184 // We need to manually update this on startup as the binding
185185 // below doesn't seem to have any effect at that stage
186− oskSettings.disableHeight = !shell.oskEnabled || shell.usageScenario == "desktop"
186+ oskSettings.disableHeight = !shell.oskEnabled
187187 }
188188
189189 // we must rotate to a supported orientation regardless of shell's preference
@@ -194,7 +194,13 @@ Item {
194194 Binding {
195195 target: oskSettings
196196 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
198204 }
199205
200206 readonly property int supportedOrientations: shell.supportedOrientations
@@ -268,12 +274,8 @@ Item {
268274 mode: applicationArguments.mode
269275 hasMouse: pointerInputDevices > 0
270276 hasKeyboard: keyboardsModel.count > 0
271− // TODO: Factor in if the current screen is a touch screen and if the user wants to
272− // have multiple keyboards around. For now we only enable one keyboard at a time
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+
278+ oskEnabled: unity8Settings.alwaysShowOsk || !hasKeyboard || forceOSKEnabled
277279
278280 usageScenario: {
279281 if (unity8Settings.usageMode === "Windowed") {
qml/Panel/Panel.qml+2−7
@@ -25,7 +25,6 @@ import Unity.ApplicationMenu 0.1
2525import QtQuick.Window 2.2
2626// for indicator-keyboard
2727import AccountsService 0.1
28−import Unity.InputInfo 0.1
2928
3029import "../ApplicationMenus"
3130import "../Components"
@@ -47,6 +46,7 @@ Item {
4746 property bool fullscreenMode: false
4847 property real panelAreaShowProgress: 1.0
4948 property bool greeterShown: false
49+ property bool hasKeyboard: false
5050
5151 property string mode: "staged"
5252
@@ -340,7 +340,7 @@ Item {
340340 // HACK for indicator-session
341341 readonly property bool hideSessionIndicator: identifier == "indicator-session" && Math.min(Screen.width, Screen.height) <= units.gu(60)
342342 // 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)
344344
345345 height: parent.height
346346 expanded: indicators.expanded
@@ -394,11 +394,6 @@ Item {
394394 }
395395 }
396396
397− InputDeviceModel {
398− id: keyboardsModel
399− deviceFilter: InputInfo.Keyboard
400− }
401−
402397 IndicatorsLight {
403398 id: indicatorLights
404399 }
qml/Shell.qml+1
@@ -531,6 +531,7 @@ StyledItem {
531531 fullscreenMode: (focusedSurfaceIsFullscreen && !LightDMService.greeter.active && launcher.progress == 0)
532532 || greeter.hasLockedApp
533533 greeterShown: greeter && greeter.shown
534+ hasKeyboard: shell.hasKeyboard
534535 }
535536
536537 Launcher {