Merge lp:~dandrader/unity8/childWindowFocus into lp:unity8
- childWindowFocus
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Lukáš Tinkl | ||||
Approved revision: | 2891 | ||||
Merged at revision: | 2904 | ||||
Proposed branch: | lp:~dandrader/unity8/childWindowFocus | ||||
Merge into: | lp:unity8 | ||||
Prerequisite: | lp:~ci-train-bot/unity8/unity8-ubuntu-zesty-2555 | ||||
Diff against target: |
171 lines (+57/-5) 6 files modified
qml/Stage/ChildWindow.qml (+4/-1) qml/Stage/ChildWindowRepeater.qml (+12/-1) qml/Stage/ChildWindowTree.qml (+16/-2) qml/Stage/Stage.qml (+10/-1) tests/mocks/Unity/Application/MirSurface.cpp (+5/-0) tests/qmltests/Stage/tst_DesktopStage.qml (+10/-0) |
||||
To merge this branch: | bzr merge lp:~dandrader/unity8/childWindowFocus | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukáš Tinkl (community) | Approve | ||
Unity8 CI Bot | continuous-integration | Approve | |
Review via email: mp+320712@code.launchpad.net |
This proposal supersedes a proposal from 2017-03-16.
Commit message
Give active focus to child surface qml items
Description of the change
Prereq-archive: ppa:ci-
* Are there any related MPs required for this MP to build/function as expected? Please list.
https:/
* 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?
Not applicable
* If you changed the UI, has there been a design review?
Not applicable
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
Looks like DesktopStage:
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2870
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2870
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2870
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
So the exectution of that new DesktopStage:
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
> Looks like DesktopStage:
It was a problem in the mock MirSurface. Tests should pass now.
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:2871
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:2871
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
Generally works nice with one exception: child windows opened as a result of a menu click do not take focus. I'm not going to block you on this as the menubar has focus issues on its own but do you think you could look into that too? Otherwise let's just leave it for another branch
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
On 17/03/2017 11:27, Lukáš Tinkl wrote:
> Review: Needs Information
>
> Generally works nice with one exception: child windows opened as a result of a menu click do not take focus. I'm not going to block you on this as the menubar has focus issues on its own but do you think you could look into that too? Otherwise let's just leave it for another branch
It did work here.
And yes, I would fix focus hanlding when menus come and go in a separate
branch.
Lukáš Tinkl (lukas-kde) wrote : Posted in a previous version of this proposal | # |
Ok, but I just found a bigger issue though:
1. Launch kate
2. Press Ctrl+O or click the Open... toolbar button
3. Press Esc to close the file dialog
(4. The focus is gone but that's a separate issue indeed)
5. Manually activate the main kate window (e.g. click decoration)
6. Notice you can't _anything_ type anymore in the kate window
7. Press "O" alone, notice the file dialog gets opened again
Seems like the Ctrl key gets stuck somewhere
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal | # |
On 17/03/2017 11:54, Lukáš Tinkl wrote:
> Review: Needs Fixing
>
> Ok, but I just found a bigger issue though:
>
> 1. Launch kate
> 2. Press Ctrl+O or click the Open... toolbar button
> 3. Press Esc to close the file dialog
> (4. The focus is gone but that's a separate issue indeed)
> 5. Manually activate the main kate window (e.g. click decoration)
> 6. Notice you can't _anything_ type anymore in the kate window
> 7. Press "O" alone, notice the file dialog gets opened again
>
> Seems like the Ctrl key gets stuck somewhere
Added a qtmir branch to fix that. But it seems there's also work needed
on mir itself as well, which is out of my domain.
Daniel d'Andrada (dandrader) wrote : | # |
Updated the qtmir branch. That "Ctrl+O + Esc + O" use case in kate should work now.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2891
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
Works great now with lp:~dandrader/qtmir/keyState!
* Did you perform an exploratory manual test run of the code change and any related functionality?
yes
* Did CI run pass? If not, please explain why.
yes
Preview Diff
1 | === modified file 'qml/Stage/ChildWindow.qml' |
2 | --- qml/Stage/ChildWindow.qml 2017-02-22 15:12:17 +0000 |
3 | +++ qml/Stage/ChildWindow.qml 2017-03-22 18:52:10 +0000 |
4 | @@ -18,8 +18,9 @@ |
5 | import Ubuntu.Components 1.3 |
6 | import Unity.Application 0.1 |
7 | |
8 | -Item { |
9 | +FocusScope { |
10 | id: root |
11 | + objectName: "childWindow" |
12 | |
13 | // Set from outside. |
14 | property var surface |
15 | @@ -141,6 +142,8 @@ |
16 | // TODO ChildWindow parent will probably want to control those |
17 | interactive: true |
18 | consumesInput: true |
19 | + |
20 | + focus: true |
21 | } |
22 | |
23 | Loader { |
24 | |
25 | === modified file 'qml/Stage/ChildWindowRepeater.qml' |
26 | --- qml/Stage/ChildWindowRepeater.qml 2017-01-26 11:10:01 +0000 |
27 | +++ qml/Stage/ChildWindowRepeater.qml 2017-03-22 18:52:10 +0000 |
28 | @@ -1,5 +1,5 @@ |
29 | /* |
30 | - * Copyright (C) 2016 Canonical, Ltd. |
31 | + * Copyright (C) 2016-2017 Canonical, Ltd. |
32 | * |
33 | * This program is free software; you can redistribute it and/or modify |
34 | * it under the terms of the GNU General Public License as published by |
35 | @@ -21,8 +21,19 @@ |
36 | id: root |
37 | property Item boundsItem |
38 | delegate: ChildWindowTree { |
39 | + id: childWindowTree |
40 | surface: model.surface |
41 | z: root.count - model.index |
42 | boundsItem: root.boundsItem |
43 | + Connections { |
44 | + target: childWindowTree.surface |
45 | + onFocusedChanged: { |
46 | + if (childWindowTree.surface.focused) { |
47 | + childWindowTree.focus = true; |
48 | + // focus the Loader |
49 | + childWindowTree.parent.focus = true; |
50 | + } |
51 | + } |
52 | + } |
53 | } |
54 | } |
55 | |
56 | === modified file 'qml/Stage/ChildWindowTree.qml' |
57 | --- qml/Stage/ChildWindowTree.qml 2017-03-22 18:52:09 +0000 |
58 | +++ qml/Stage/ChildWindowTree.qml 2017-03-22 18:52:10 +0000 |
59 | @@ -1,5 +1,5 @@ |
60 | /* |
61 | - * Copyright (C) 2016 Canonical, Ltd. |
62 | + * Copyright (C) 2016-2017 Canonical, Ltd. |
63 | * |
64 | * This program is free software; you can redistribute it and/or modify |
65 | * it under the terms of the GNU General Public License as published by |
66 | @@ -18,7 +18,7 @@ |
67 | import Ubuntu.Components 1.3 |
68 | import Unity.Application 0.1 |
69 | |
70 | -Item { |
71 | +FocusScope { |
72 | id: root |
73 | |
74 | property alias surface: childWindow.surface |
75 | @@ -100,6 +100,13 @@ |
76 | onFocusRequested: { |
77 | root.surface.activate(); |
78 | } |
79 | + onFocusedChanged: { |
80 | + if (root.surface.focused) { |
81 | + childWindow.focus = true; |
82 | + // Propagate |
83 | + root.focus = true; |
84 | + } |
85 | + } |
86 | } |
87 | |
88 | // Using a loader here mainly to circunvent the "ChildWindowTree is instantiated recursively" error from the QML engine |
89 | @@ -119,5 +126,12 @@ |
90 | property: "boundsItem" |
91 | value: root.boundsItem |
92 | } |
93 | + onFocusChanged: { |
94 | + if (focus) { |
95 | + // A surface in some ChildWindowTree got focused. |
96 | + // Propagate |
97 | + root.focus = true; |
98 | + } |
99 | + } |
100 | } |
101 | } |
102 | |
103 | === modified file 'qml/Stage/Stage.qml' |
104 | --- qml/Stage/Stage.qml 2017-03-22 18:52:09 +0000 |
105 | +++ qml/Stage/Stage.qml 2017-03-22 18:52:10 +0000 |
106 | @@ -899,12 +899,13 @@ |
107 | priv.updateMainAndSideStageIndexes(); |
108 | } |
109 | appDelegate.focus = true; |
110 | + priv.focusedAppDelegate = appDelegate; |
111 | } |
112 | |
113 | function updateQmlFocusFromMirSurfaceFocus() { |
114 | if (model.window.focused) { |
115 | claimFocus(); |
116 | - priv.focusedAppDelegate = appDelegate; |
117 | + decoratedWindow.focus = true; |
118 | } |
119 | } |
120 | |
121 | @@ -1807,6 +1808,14 @@ |
122 | boundsItem: boundariesForWindowPlacement |
123 | |
124 | z: childWindowRepeater.count - model.index |
125 | + |
126 | + onFocusChanged: { |
127 | + if (focus) { |
128 | + // some child surface in this tree got focus. |
129 | + // Ensure we also have it at the top-level hierarchy |
130 | + appDelegate.claimFocus(); |
131 | + } |
132 | + } |
133 | } |
134 | } |
135 | } |
136 | |
137 | === modified file 'tests/mocks/Unity/Application/MirSurface.cpp' |
138 | --- tests/mocks/Unity/Application/MirSurface.cpp 2017-03-22 18:52:09 +0000 |
139 | +++ tests/mocks/Unity/Application/MirSurface.cpp 2017-03-22 18:52:10 +0000 |
140 | @@ -452,6 +452,11 @@ |
141 | void MirSurface::close() |
142 | { |
143 | DEBUG_MSG(""); |
144 | + |
145 | + for (int i = 0; i < m_childSurfaceList->count(); ++i) { |
146 | + m_childSurfaceList->get(i)->close(); |
147 | + } |
148 | + |
149 | if (!m_zombieTimer.isActive()) { |
150 | m_zombieTimer.start(); |
151 | Q_EMIT closeRequested(); |
152 | |
153 | === modified file 'tests/qmltests/Stage/tst_DesktopStage.qml' |
154 | --- tests/qmltests/Stage/tst_DesktopStage.qml 2017-03-08 09:53:21 +0000 |
155 | +++ tests/qmltests/Stage/tst_DesktopStage.qml 2017-03-22 18:52:10 +0000 |
156 | @@ -1057,5 +1057,15 @@ |
157 | tap(maxButton); |
158 | tryCompare(appDelegate, "state", "maximized"); |
159 | } |
160 | + |
161 | + function test_childWindowGetsActiveFocus() { |
162 | + var appDelegate = startApplication("kate"); |
163 | + appDelegate.surface.openDialog(units.gu(5), units.gu(5), units.gu(30), units.gu(30)); |
164 | + var childWindow = findChild(appDelegate, "childWindow"); |
165 | + verify(childWindow); |
166 | + var surfaceItem = findChild(childWindow, "surfaceItem"); |
167 | + verify(surfaceItem); |
168 | + tryCompare(surfaceItem, "activeFocus", true); |
169 | + } |
170 | } |
171 | } |
FAILED: Continuous integration, rev:2869 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3416/ /unity8- jenkins. ubuntu. com/job/ build/4503 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/2704 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= zesty,testname= qmluitests. sh/2704 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4531 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4358/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4358/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4358/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4358/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4358/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4358 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4358/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3416/ rebuild
https:/