on xenial help sign in
Apply the correct keymap also on prompt surfaces (LP: #1610124)
ec6732fLukáš Tinkl
qml/Stages/ApplicationWindow.qml+1
@@ -27,6 +27,7 @@ FocusScope {
27 property alias interactive: surfaceContainer.interactive
27 property alias interactive: surfaceContainer.interactive
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
28 property bool orientationChangesEnabled: d.supportsSurfaceResize ? d.surfaceOldEnoughToBeResized : true
29 readonly property string title: surface && surface.name !== "" ? surface.name : d.name
29 readonly property string title: surface && surface.name !== "" ? surface.name : d.name
30+ readonly property QtObject focusedSurface: d.focusedSurface.surface
30
31
31 // overridable from outside
32 // overridable from outside
32 property bool fullscreen: {
33 property bool fullscreen: {
qml/Stages/DecoratedWindow.qml+1
@@ -26,6 +26,7 @@ FocusScope {
26
26
27 property alias application: applicationWindow.application
27 property alias application: applicationWindow.application
28 property alias surface: applicationWindow.surface
28 property alias surface: applicationWindow.surface
29+ readonly property alias focusedSurface: applicationWindow.focusedSurface
29 property alias active: decoration.active
30 property alias active: decoration.active
30 readonly property alias title: applicationWindow.title
31 readonly property alias title: applicationWindow.title
31 property alias fullscreen: applicationWindow.fullscreen
32 property alias fullscreen: applicationWindow.fullscreen
qml/Stages/DesktopStage.qml+2−1
@@ -230,7 +230,7 @@ AbstractStage {
230 Binding {
230 Binding {
231 target: MirFocusController
231 target: MirFocusController
232 property: "focusedSurface"
232 property: "focusedSurface"
233− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
233+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
234 when: !appRepeater.startingUp && root.parent
234 when: !appRepeater.startingUp && root.parent
235 }
235 }
236
236
@@ -334,6 +334,7 @@ AbstractStage {
334
334
335 readonly property var surface: model.surface
335 readonly property var surface: model.surface
336 readonly property alias resizeArea: resizeArea
336 readonly property alias resizeArea: resizeArea
337+ readonly property alias focusedSurface: decoratedWindow.focusedSurface
337
338
338 readonly property bool isDash: model.application.appId == "unity8-dash"
339 readonly property bool isDash: model.application.appId == "unity8-dash"
339
340
qml/Stages/PhoneStage.qml+1−1
@@ -244,7 +244,7 @@ AbstractStage {
244 Binding {
244 Binding {
245 target: MirFocusController
245 target: MirFocusController
246 property: "focusedSurface"
246 property: "focusedSurface"
247− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
247+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
248 when: root.parent && !spreadRepeater.startingUp
248 when: root.parent && !spreadRepeater.startingUp
249 }
249 }
250
250
qml/Stages/SpreadDelegate.qml+1
@@ -37,6 +37,7 @@ FocusScope {
37 | Qt.LandscapeOrientation
37 | Qt.LandscapeOrientation
38 | Qt.InvertedPortraitOrientation
38 | Qt.InvertedPortraitOrientation
39 | Qt.InvertedLandscapeOrientation
39 | Qt.InvertedLandscapeOrientation
40+ readonly property alias focusedSurface: appWindow.focusedSurface
40
41
41 // to be set from outside
42 // to be set from outside
42 property bool interactive: true
43 property bool interactive: true
qml/Stages/TabletStage.qml+1−1
@@ -307,7 +307,7 @@ AbstractStage {
307 Binding {
307 Binding {
308 target: MirFocusController
308 target: MirFocusController
309 property: "focusedSurface"
309 property: "focusedSurface"
310− value: priv.focusedAppDelegate ? priv.focusedAppDelegate.surface : null
310+ value: priv.focusedAppDelegate ? priv.focusedAppDelegate.focusedSurface : null
311 when: root.parent && !spreadRepeater.startingUp
311 when: root.parent && !spreadRepeater.startingUp
312 }
312 }
313
313
tests/qmltests/tst_Shell.qml+9
@@ -2429,6 +2429,15 @@ Rectangle {
2429 // verify the initial keymap of the newly started app is the first one from the list
2429 // verify the initial keymap of the newly started app is the first one from the list
2430 tryCompare(appSurface, "keymap", "sk");
2430 tryCompare(appSurface, "keymap", "sk");
2431
2431
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+
2432 // switch to next keymap, should go to "cz+qwerty"
2441 // switch to next keymap, should go to "cz+qwerty"
2433 keyClick(Qt.Key_Space, Qt.MetaModifier);
2442 keyClick(Qt.Key_Space, Qt.MetaModifier);
2434 tryCompare(appSurface, "keymap", "cz+qwerty");
2443 tryCompare(appSurface, "keymap", "cz+qwerty");