on xenial help sign in
Fixed issue with session focus
a02af0fNick Dedekind
qml/Stages/ApplicationWindow.qml+12−8
@@ -53,6 +53,14 @@ Item {
53 // might show the UI accommodating due to surface resizes on startup.
53 // might show the UI accommodating due to surface resizes on startup.
54 // Remove this when possible
54 // Remove this when possible
55 property bool surfaceInitialized: false
55 property bool surfaceInitialized: false
56+
57+ function forceSurfaceActiveFocusIfReady() {
58+ if (sessionContainer.surface.focus &&
59+ sessionContainer.surface.parent === sessionContainer.surfaceContainer &&
60+ sessionContainer.surface.enabled) {
61+ sessionContainer.surface.forceActiveFocus();
62+ }
63+ }
56 }
64 }
57
65
58 Timer {
66 Timer {
@@ -65,14 +73,9 @@ Item {
65 target: sessionContainer.surface
73 target: sessionContainer.surface
66 // FIXME: I would rather not need to do this, but currently it doesn't get
74 // FIXME: I would rather not need to do this, but currently it doesn't get
67 // active focus without it and I don't know why.
75 // active focus without it and I don't know why.
68− onFocusChanged: forceSurfaceActiveFocusIfReady();
76+ onFocusChanged: d.forceSurfaceActiveFocusIfReady();
69− onParentChanged: forceSurfaceActiveFocusIfReady();
77+ onParentChanged: d.forceSurfaceActiveFocusIfReady();
70− onEnabledChanged: forceSurfaceActiveFocusIfReady();
78+ onEnabledChanged: d.forceSurfaceActiveFocusIfReady();
71− function forceSurfaceActiveFocusIfReady() {
72− if (sessionContainer.surface.focus && sessionContainer.surface.parent === sessionContainer.surfaceContainer && sessionContainer.surface.enabled) {
73− sessionContainer.surface.forceActiveFocus();
74− }
75− }
76 }
79 }
77
80
78 Image {
81 Image {
@@ -114,6 +117,7 @@ Item {
114 } else {
117 } else {
115 d.surfaceInitialized = false;
118 d.surfaceInitialized = false;
116 }
119 }
120+ d.forceSurfaceActiveFocusIfReady();
117 }
121 }
118 }
122 }
119
123
qml/Stages/SessionContainer.qml+8−8
@@ -21,8 +21,8 @@ Item {
21 id: root
21 id: root
22 objectName: "sessionContainer"
22 objectName: "sessionContainer"
23 property QtObject session
23 property QtObject session
24− property var childSessions: session ? session.childSessions : null
24+ readonly property var childSessions: session ? session.childSessions : null
25− property alias surface: _surfaceContainer.surface
25+ readonly property alias surface: _surfaceContainer.surface
26 property bool interactive: true
26 property bool interactive: true
27
27
28 readonly property alias surfaceContainer: _surfaceContainer
28 readonly property alias surfaceContainer: _surfaceContainer
@@ -33,16 +33,16 @@ Item {
33 }
33 }
34
34
35 Binding {
35 Binding {
36− target: surface
36+ target: surfaceContainer.surface
37− when: surface
37+ when: surfaceContainer.surface
38 property: "enabled"
38 property: "enabled"
39− value: interactive
39+ value: root.interactive
40 }
40 }
41 Binding {
41 Binding {
42− target: surface
42+ target: surfaceContainer.surface
43− when: surface
43+ when: surfaceContainer.surface
44 property: "focus"
44 property: "focus"
45− value: interactive
45+ value: root.interactive
46 }
46 }
47
47
48 Repeater {
48 Repeater {