on xenial help sign in
Apply the correct keymap also on prompt surfaces (LP: #1610124)

Approved by: Albert Astals Cid

commitec6732f03df14b449d1b0c162c5ad7cc94501353 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateThu 11 Aug 2016, 06:24 (10 years ago) parent6d3ed346b1efb3
7 files changed+16−3
qml/Stages/ApplicationWindow.qml+1 qml/Stages/DecoratedWindow.qml+1 qml/Stages/DesktopStage.qml+2−1 qml/Stages/PhoneStage.qml+1−1 qml/Stages/SpreadDelegate.qml+1 qml/Stages/TabletStage.qml+1−1 tests/qmltests/tst_Shell.qml+9
qml/Stages/ApplicationWindow.qml+1
@@ -27,6 +27,7 @@ FocusScope {
2727 property alias interactive: surfaceContainer.interactive
2828 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
2929 readonly property string title: surface && surface.name !== "" ? surface.name : d.name
30+ readonly property QtObject focusedSurface: d.focusedSurface.surface
3031
3132 // overridable from outside
3233 property bool fullscreen: {
qml/Stages/DecoratedWindow.qml+1
@@ -26,6 +26,7 @@ FocusScope {
2626
2727 property alias application: applicationWindow.application
2828 property alias surface: applicationWindow.surface
29+ readonly property alias focusedSurface: applicationWindow.focusedSurface
2930 property alias active: decoration.active
3031 readonly property alias title: applicationWindow.title
3132 property alias fullscreen: applicationWindow.fullscreen
qml/Stages/DesktopStage.qml+2−1
@@ -230,7 +230,7 @@ AbstractStage {
230230 Binding {
231231 target: MirFocusController
232232 property: "focusedSurface"
233− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
233+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
234234 when: !appRepeater.startingUp && root.parent
235235 }
236236
@@ -334,6 +334,7 @@ AbstractStage {
334334
335335 readonly property var surface: model.surface
336336 readonly property alias resizeArea: resizeArea
337+ readonly property alias focusedSurface: decoratedWindow.focusedSurface
337338
338339 readonly property bool isDash: model.application.appId == "unity8-dash"
339340
qml/Stages/PhoneStage.qml+1−1
@@ -244,7 +244,7 @@ AbstractStage {
244244 Binding {
245245 target: MirFocusController
246246 property: "focusedSurface"
247− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
247+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
248248 when: root.parent && !spreadRepeater.startingUp
249249 }
250250
qml/Stages/SpreadDelegate.qml+1
@@ -37,6 +37,7 @@ FocusScope {
3737 | Qt.LandscapeOrientation
3838 | Qt.InvertedPortraitOrientation
3939 | Qt.InvertedLandscapeOrientation
40+ readonly property alias focusedSurface: appWindow.focusedSurface
4041
4142 // to be set from outside
4243 property bool interactive: true
qml/Stages/TabletStage.qml+1−1
@@ -307,7 +307,7 @@ AbstractStage {
307307 Binding {
308308 target: MirFocusController
309309 property: "focusedSurface"
310− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
310+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
311311 when: root.parent && !spreadRepeater.startingUp
312312 }
313313
tests/qmltests/tst_Shell.qml+9
@@ -2429,6 +2429,15 @@ Rectangle {
24292429 // verify the initial keymap of the newly started app is the first one from the list
24302430 tryCompare(appSurface, "keymap", "sk");
24312431
2432+ // try to create a prompt surface, verify it also has the same keymap
2433+ app.promptSurfaceList.createSurface();
2434+ var promptSurface = app.promptSurfaceList.get(0);
2435+ verify(promptSurface);
2436+ tryCompare(appSurface, "keymap", promptSurface.keymap);
2437+ // ... and that the controller's surface keymap is also the same
2438+ tryCompare(MirFocusController.focusedSurface, "keymap", "sk");
2439+ app.promptSurfaceList.get(0).close();
2440+
24322441 // switch to next keymap, should go to "cz+qwerty"
24332442 keyClick(Qt.Key_Space, Qt.MetaModifier);
24342443 tryCompare(appSurface, "keymap", "cz+qwerty");