on xenial help sign in
don't displace windows if the OSK is on another screen (LP: #1598917)
commit42ff049c9a5090122b891f3f395114f742c49bdb authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 5 Jul 2016, 10:00 (10 years ago) parente57b7bfc934153
4 files changed+12−4
qml/Shell.qml+5 qml/Stages/AbstractStage.qml+1 qml/Stages/DesktopStage.qml+1−1 tests/qmltests/Stages/tst_DesktopStage.qml+5−3
qml/Shell.qml+5
@@ -387,6 +387,11 @@ StyledItem {
387387 property: "topLevelSurfaceList"
388388 value: topLevelSurfaceList
389389 }
390+ Binding {
391+ target: applicationsDisplayLoader.item
392+ property: "oskEnabled"
393+ value: shell.oskEnabled
394+ }
390395 }
391396 }
392397
qml/Stages/AbstractStage.qml+1
@@ -43,6 +43,7 @@ FocusScope {
4343 // A Stage should paint a wallpaper etc over its full size but not use the margins for window placement
4444 property int leftMargin: 0
4545 property alias paintBackground: background.visible
46+ property bool oskEnabled: false
4647
4748 // To be read from outside
4849 property var mainApp: null
qml/Stages/DesktopStage.qml+1−1
@@ -274,7 +274,7 @@ AbstractStage {
274274 value: appDelegate.requestedY -
275275 Math.min(appDelegate.requestedY - PanelState.panelHeight,
276276 Math.max(0, UbuntuKeyboardInfo.height - (appContainer.height - (appDelegate.requestedY + appDelegate.height))))
277− when: appDelegate.focus && appDelegate.state == "normal"
277+ when: root.oskEnabled && appDelegate.focus && appDelegate.state == "normal"
278278 && SurfaceManager.inputMethodSurface
279279 && SurfaceManager.inputMethodSurface.state != Mir.HiddenState
280280 && SurfaceManager.inputMethodSurface.state != Mir.MinimizedState
tests/qmltests/Stages/tst_DesktopStage.qml+5−3
@@ -519,13 +519,15 @@ Item {
519519
520520 function test_oskDisplacesWindow_data() {
521521 return [
522− {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5)},
523− {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight},
524− {tag: "displace a bit", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: (root.height / 2) - units.gu(40)},
522+ {tag: "no need to displace", windowHeight: units.gu(10), windowY: units.gu(5), targetDisplacement: units.gu(5), oskEnabled: true},
523+ {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight, oskEnabled: true},
524+ {tag: "displace to top", windowHeight: units.gu(50), windowY: units.gu(10), targetDisplacement: PanelState.panelHeight, oskEnabled: true},
525+ {tag: "osk not on this screen", windowHeight: units.gu(40), windowY: units.gu(10), targetDisplacement: units.gu(10), oskEnabled: false},
525526 ]
526527 }
527528
528529 function test_oskDisplacesWindow(data) {
530+ desktopStageLoader.item.oskEnabled = data.oskEnabled
529531 var dashAppDelegate = startApplication("unity8-dash");
530532 var oldOSKState = SurfaceManager.inputMethodSurface.state;
531533 SurfaceManager.inputMethodSurface.state = Mir.RestoredState;