Merge lp:~josharenson/unity8/fix_trust_store_focus into lp:unity8

Proposed by Josh Arenson
Status: Merged
Approved by: Michael Zanetti
Approved revision: 1371
Merged at revision: 1436
Proposed branch: lp:~josharenson/unity8/fix_trust_store_focus
Merge into: lp:unity8
Diff against target: 73 lines (+40/-1)
3 files modified
qml/Stages/SessionContainer.qml (+4/-0)
tests/mocks/Unity/Application/Session.h (+1/-1)
tests/qmltests/Stages/tst_SessionContainer.qml (+35/-0)
To merge this branch: bzr merge lp:~josharenson/unity8/fix_trust_store_focus
Reviewer Review Type Date Requested Status
Michael Zanetti (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+239567@code.launchpad.net

Commit message

Return focus to the application after a tusted session overlay is closing.

Description of the change

* Are there any related MPs required for this MP to build/function as expected? Please list.
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

Fix lp:1381292

This works around an issue where a trusted session dialog would steal focus from an underlying application/session and never return it.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

With the current way we're doing focus I guess this is the way to go, not really a hack. What is the reason why you think this is a hack? What would you say is the proper fix?

I guess I'm fine with approving this, maybe we can even remove the FIXME comment.

review: Needs Information
Revision history for this message
Josh Arenson (josharenson) wrote :

> With the current way we're doing focus I guess this is the way to go, not
> really a hack. What is the reason why you think this is a hack? What would you
> say is the proper fix?
>
> I guess I'm fine with approving this, maybe we can even remove the FIXME
> comment.

If focus worked correctly, this wouldn't be a hack. I'll remove the FIXME because any focus changes we make should work with this anyway.

1371. By Josh Arenson

Remove FIXME

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michael Zanetti (mzanetti) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?

yep

 * Did CI run pass? If not, please explain why.

it did

 * Did you make sure that the branch does not contain spurious tags?

yeah

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/Stages/SessionContainer.qml'
--- qml/Stages/SessionContainer.qml 2014-10-01 13:20:32 +0000
+++ qml/Stages/SessionContainer.qml 2014-11-12 01:10:20 +0000
@@ -69,6 +69,10 @@
69 target: item; when: item69 target: item; when: item
70 property: "orientation"; value: root.orientation70 property: "orientation"; value: root.orientation
71 }71 }
72
73 Component.onDestruction: {
74 root.session.surface.forceActiveFocus();
75 }
72 }76 }
73 }77 }
7478
7579
=== modified file 'tests/mocks/Unity/Application/Session.h'
--- tests/mocks/Unity/Application/Session.h 2014-09-01 16:07:55 +0000
+++ tests/mocks/Unity/Application/Session.h 2014-11-12 01:10:20 +0000
@@ -56,7 +56,7 @@
5656
57 Q_INVOKABLE void addChildSession(Session* session);57 Q_INVOKABLE void addChildSession(Session* session);
58 void insertChildSession(uint index, Session* session);58 void insertChildSession(uint index, Session* session);
59 void removeChildSession(Session* session);59 Q_INVOKABLE void removeChildSession(Session* session);
6060
61Q_SIGNALS:61Q_SIGNALS:
62 void applicationChanged(ApplicationInfo*);62 void applicationChanged(ApplicationInfo*);
6363
=== modified file 'tests/qmltests/Stages/tst_SessionContainer.qml'
--- tests/qmltests/Stages/tst_SessionContainer.qml 2014-09-12 18:09:44 +0000
+++ tests/qmltests/Stages/tst_SessionContainer.qml 2014-11-12 01:10:20 +0000
@@ -185,6 +185,41 @@
185 tryCompare(sessionSpy, "count", data.count);185 tryCompare(sessionSpy, "count", data.count);
186 }186 }
187187
188 function test_childSessionDestructionReturnsFocusToSiblingOrParent() {
189 sessionCheckbox.checked = true;
190 var sessionContainer = sessionContainerLoader.item;
191 compare(sessionContainer.childSessions.count(), 0);
192
193 sessionContainer.interactive = true;
194
195 var i;
196 var sessions = [];
197 // 3 sessions should cover all edge cases
198 for(i = 0; i < 3; i++) {
199 var a_session = ApplicationTest.addChildSession(
200 sessionContainer.session, "gallery"
201 )
202
203 a_session.createSurface();
204 sessionContainer.session.addChildSession(a_session);
205 compare(sessionContainer.childSessions.count(), i + 1);
206
207 sessions.push(a_session);
208 }
209
210 var a_session;
211 while(a_session = sessions.pop()) {
212 a_session.surface.forceActiveFocus();
213 compare(a_session.surface.activeFocus, true);
214
215 var parentSession = a_session.parentSession;
216 sessionContainer.session.removeChildSession(a_session);
217 compare(a_session.surface.activeFocus, false);
218
219 compare(parentSession.surface.activeFocus, true);
220 }
221 }
222
188 function test_nestedChildSessions_data() {223 function test_nestedChildSessions_data() {
189 return [ { tag: "depth=2", depth: 2 },224 return [ { tag: "depth=2", depth: 2 },
190 { tag: "depth=8", depth: 8 }225 { tag: "depth=8", depth: 8 }

Subscribers

People subscribed via source and target branches