on xenial help sign in
When Launcher is locked, OSK can have full width (#277)

b62a87cd caused the Keyboard to appear at partial width when no apps were running. This was clear when trying to use the Drawer's search or when in the Wizard. This commit refactors the Launcher's locking into clearer bindings and uses those to determine whether the keyboard should have a margin or not Fixes https://github.com/ubports/ubuntu-touch/issues/1373

commit1b356b04aa68ab6ab1dcd697483121705665332c authorDalton Durst <dalton@ubports.com> dateTue 18 Feb 2020, 16:16 (7 years ago) parentb62a87c
2 files changed+28−8
qml/Shell.qml+9−2 tests/qmltests/tst_Shell.qml+19−6
qml/Shell.qml+9−2
@@ -375,7 +375,7 @@ StyledItem {
375375 anchors {
376376 fill: parent
377377 topMargin: panel.panelHeight
378− leftMargin: launcher.lockedVisible ? launcher.panelWidth : 0
378+ leftMargin: (launcher.lockedByUser && launcher.lockAllowed) ? launcher.panelWidth : 0
379379 }
380380 z: notifications.useModal || panel.indicators.shown || wizard.active || tutorial.running || launcher.drawerShown ? overlay.z + 1 : overlay.z - 1
381381 }
@@ -578,7 +578,7 @@ StyledItem {
578578 superPressed: physicalKeysMapper.superPressed
579579 superTabPressed: physicalKeysMapper.superTabPressed
580580 panelWidth: units.gu(settings.launcherWidth)
581− lockedVisible: ((shell.usageScenario == "desktop" && !settings.autohideLauncher) || shell.atDesktop) && !collidingWithPanel && !panel.fullscreenMode
581+ lockedVisible: (lockedByUser || shell.atDesktop) && lockAllowed
582582 topPanelHeight: panel.panelHeight
583583 drawerEnabled: !greeter.active
584584 privateMode: greeter.active
@@ -588,6 +588,13 @@ StyledItem {
588588 // the Panel is open and taking up the full width of the shell
589589 readonly property bool collidingWithPanel: panel && (!panel.fullyClosed && !panel.partialWidth)
590590
591+ // The "autohideLauncher" setting is only valid in desktop mode
592+ readonly property bool lockedByUser: (shell.usageScenario == "desktop" && !settings.autohideLauncher)
593+
594+ // The Launcher should absolutely not be locked visible under some
595+ // conditions
596+ readonly property bool lockAllowed: !collidingWithPanel && !panel.fullscreenMode && !wizard.active
597+
591598 onShowDashHome: showHome()
592599 onLauncherApplicationSelected: {
593600 greeter.notifyUserRequestedApp();
tests/qmltests/tst_Shell.qml+19−6
@@ -3247,7 +3247,8 @@ Rectangle {
32473247 formFactor: "phone",
32483248 launcherLocked: false,
32493249 stateWithOpenIndicators: "",
3250− stateWithOpenApps: ""
3250+ stateWithOpenApps: "",
3251+ inputMethodMargin: 0,
32513252 },
32523253 {
32533254 tag: "tablet",
@@ -3255,7 +3256,8 @@ Rectangle {
32553256 formFactor: "tablet",
32563257 launcherLocked: false,
32573258 stateWithOpenIndicators: "visible",
3258− stateWithOpenApps: ""
3259+ stateWithOpenApps: "",
3260+ inputMethodMargin: 0,
32593261 },
32603262 {
32613263 tag: "desktop without auto-hide",
@@ -3263,7 +3265,8 @@ Rectangle {
32633265 shell: "desktop",
32643266 launcherLocked: true,
32653267 stateWithOpenIndicators: "visible",
3266− stateWithOpenApps: "visible"
3268+ stateWithOpenApps: "visible",
3269+ inputMethodMargin: 64,
32673270 },
32683271 {
32693272 tag: "desktop with auto-hide",
@@ -3271,7 +3274,8 @@ Rectangle {
32713274 shell: "desktop",
32723275 launcherLocked: false,
32733276 stateWithOpenIndicators: "visible",
3274− stateWithOpenApps: ""
3277+ stateWithOpenApps: "",
3278+ inputMethodMargin: 0,
32753279 },
32763280 {
32773281 tag: "desktop with auto-hide at small formFactor",
@@ -3279,7 +3283,8 @@ Rectangle {
32793283 shell: "desktop",
32803284 launcherLocked: false,
32813285 stateWithOpenIndicators: "",
3282− stateWithOpenApps: ""
3286+ stateWithOpenApps: "",
3287+ inputMethodMargin: 0,
32833288 },
32843289 {
32853290 tag: "tablet with auto-hide at small formFactor",
@@ -3287,7 +3292,8 @@ Rectangle {
32873292 shell: "tablet",
32883293 launcherLocked: false,
32893294 stateWithOpenIndicators: "",
3290− stateWithOpenApps: ""
3295+ stateWithOpenApps: "",
3296+ inputMethodMargin: 0,
32913297 }]
32923298 }
32933299
@@ -3295,11 +3301,17 @@ Rectangle {
32953301 Ensure that the Launcher will not dismiss while there are no apps
32963302 running, but gets dismissed when it would be intersected by
32973303 indicators.
3304+
3305+ Additionally, ensure that the keyboard takes up the full width of
3306+ the Shell when the launcher is locked by Shell functions and has
3307+ a margin set to avoid the Launcher when the launcher is locked by
3308+ the user.
32983309 */
32993310 function test_launcherLockedWhenNoAppsRunning(data) {
33003311 loadShell(data.shell, 0);
33013312 shellLoader.state = data.formFactor;
33023313 var launcher = findChild(shell, "launcher");
3314+ var inputMethod = findChild(shell, "inputMethod");
33033315 GSettingsController.setAutohideLauncher(!data.launcherLocked);
33043316 swipeAwayGreeter();
33053317
@@ -3326,6 +3338,7 @@ Rectangle {
33263338 // The Launcher should return when all apps are closed
33273339 killApps();
33283340 tryCompare(launcher, "state", "visible");
3341+ tryCompare(inputMethod.anchors, "leftMargin", data.inputMethodMargin);
33293342 }
33303343 }
33313344}