Merge lp:~mzanetti/unity8/fix-apps-under-panel into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2028
Merged at revision: 2047
Proposed branch: lp:~mzanetti/unity8/fix-apps-under-panel
Merge into: lp:unity8
Prerequisite: lp:~lukas-kde/unity8/activateWindows
Diff against target: 241 lines (+97/-9)
7 files modified
qml/Components/PanelState/PanelState.qml (+2/-0)
qml/Panel/Panel.qml (+6/-0)
qml/Stages/DesktopStage.qml (+2/-0)
qml/Stages/WindowDecoration.qml (+2/-1)
qml/Stages/WindowResizeArea.qml (+7/-4)
tests/qmltests/Stages/tst_WindowResizeArea.qml (+43/-0)
tests/qmltests/tst_Shell.qml (+35/-4)
To merge this branch: bzr merge lp:~mzanetti/unity8/fix-apps-under-panel
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Abstain
PS Jenkins bot (community) continuous-integration Needs Fixing
Lukáš Tinkl (community) Approve
Review via email: mp+276283@code.launchpad.net

Commit message

prevent windows to be moved under the panel

If they happen to have a saved state which is under the panel
(might happen on alt+drag later), they will be moved below the panel
on close and reopen. This is how unity7 behaves in this regard.

Description of the change

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

see prereq

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

yes

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

yes

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

n/a

 * If you changed the UI, has there been a design review?

n/a

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2022
http://jenkins.qa.ubuntu.com/job/unity8-ci/6609/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/4949
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/24/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1321
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/24
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1216
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1217
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/23
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/23
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/3973
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4946
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4946/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24754
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-mako/13/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/24
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/24/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24753

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6609/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

The top panel interaction seems to work however, when I drag the window down (offscreen), it isn't restored correctly. Slightly unrelated but still worth fixing imo

review: Needs Fixing
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> The top panel interaction seems to work however, when I drag the window down
> (offscreen), it isn't restored correctly. Slightly unrelated but still worth
> fixing imo

fixed and added tests

Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Yup, looking good, works, tests passing

* 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 (except for broke xenial)

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

Yes

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2023
http://jenkins.qa.ubuntu.com/job/unity8-ci/6631/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/4981
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/46/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1343
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/46
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1238
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1239
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/45
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/45
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/4000
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4978
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4978/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24822
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-mako/31/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/46
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/46/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24828

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6631/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Note: was already top approved

Text conflict in qml/Panel/Panel.qml
Text conflict in qml/Stages/DesktopStage.qml
Text conflict in qml/Stages/WindowResizeArea.qml
Text conflict in tests/qmltests/Stages/tst_DesktopStage.qml
Text conflict in tests/qmltests/Stages/tst_WindowResizeArea.qml
Text conflict in tests/qmltests/tst_Shell.qml
6 conflicts encountered.

I think some of these are from the parent branch and some own, so better to wait for the parent branch to be re-merged and then merge this one.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

I still have the merge conflicts when merging this branch to unity8 trunk (and so does CI which fails to build).

Any idea why?

2026. By Michael Zanetti

merge prereq

2027. By Michael Zanetti

fix bad merge

Revision history for this message
Michael Zanetti (mzanetti) wrote :

> I still have the merge conflicts when merging this branch to unity8 trunk (and
> so does CI which fails to build).
>
> Any idea why?

Weird... there was some criss-cross merge which caused the prereq conflict with itself. Perhaps Lukas rewrote the history of his branch after I based mine on top of that. Anyhow, fixed now.

2028. By Michael Zanetti

fix bad merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2026
http://jenkins.qa.ubuntu.com/job/unity8-ci/6682/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5084
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/97/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1394
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/97
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1289
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1290
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/96
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/96
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/4072
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5089
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5089/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25016
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-mako/52/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/97
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/97/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25015

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6682/rebuild

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

FAILED: Continuous integration, rev:2028
http://jenkins.qa.ubuntu.com/job/unity8-ci/6688/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/5096
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-xenial-touch/103/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1400
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-qmluitest-xenial-amd64/103
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1295
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1296
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-xenial-amd64-ci/102/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity8-xenial-i386-ci/102/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-touch/4078
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5101
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/5101/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25027
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-xenial-touch/7/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/103
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-xenial-armhf/103/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/25028

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/6688/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Merged and "CI" is happy again, re-top approving as per Lukáś old approve.

review: Abstain

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/PanelState/PanelState.qml'
2--- qml/Components/PanelState/PanelState.qml 2015-07-15 15:07:19 +0000
3+++ qml/Components/PanelState/PanelState.qml 2015-11-09 10:53:06 +0000
4@@ -23,6 +23,8 @@
5 property string title: ""
6 property bool buttonsVisible: false
7
8+ property int panelHeight: 0
9+
10 signal close()
11 signal minimize()
12 signal maximize()
13
14=== modified file 'qml/Panel/Panel.qml'
15--- qml/Panel/Panel.qml 2015-11-09 10:53:05 +0000
16+++ qml/Panel/Panel.qml 2015-11-09 10:53:06 +0000
17@@ -32,6 +32,12 @@
18
19 opacity: fullscreenMode && indicators.fullyClosed ? 0.0 : 1.0
20
21+ Binding {
22+ target: PanelState
23+ property: "panelHeight"
24+ value: root.panelHeight
25+ }
26+
27 Rectangle {
28 id: darkenedArea
29 property real darkenedOpacity: 0.6
30
31=== modified file 'qml/Stages/DesktopStage.qml'
32--- qml/Stages/DesktopStage.qml 2015-11-09 10:53:05 +0000
33+++ qml/Stages/DesktopStage.qml 2015-11-09 10:53:06 +0000
34@@ -391,6 +391,8 @@
35 minHeight: units.gu(10)
36 borderThickness: units.gu(2)
37 windowId: model.appId // FIXME: Change this to point to windowId once we have such a thing
38+ screenWidth: root.width
39+ screenHeight: root.height
40
41 onPressed: { ApplicationManager.focusApplication(model.appId) }
42 }
43
44=== modified file 'qml/Stages/WindowDecoration.qml'
45--- qml/Stages/WindowDecoration.qml 2015-11-09 10:53:05 +0000
46+++ qml/Stages/WindowDecoration.qml 2015-11-09 10:53:06 +0000
47@@ -18,6 +18,7 @@
48 import Unity.Application 0.1 // For Mir singleton
49 import Ubuntu.Components 1.3
50 import "../Components"
51+import "../Components/PanelState"
52
53 MouseArea {
54 id: root
55@@ -56,7 +57,7 @@
56 Mir.cursorName = "grabbing";
57 var pos = mapToItem(root.target.parent, mouseX, mouseY);
58 root.target.x = pos.x - priv.distanceX;
59- root.target.y = pos.y - priv.distanceY;
60+ root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
61 }
62 }
63
64
65=== modified file 'qml/Stages/WindowResizeArea.qml'
66--- qml/Stages/WindowResizeArea.qml 2015-11-04 14:57:33 +0000
67+++ qml/Stages/WindowResizeArea.qml 2015-11-09 10:53:06 +0000
68@@ -18,6 +18,7 @@
69 import Ubuntu.Components 1.3
70 import Utils 0.1
71 import Unity.Application 0.1 // for Mir.cursorName
72+import "../Components/PanelState"
73
74 MouseArea {
75 id: root
76@@ -35,6 +36,8 @@
77 property int borderThickness: 0
78 property int minWidth: 0
79 property int minHeight: 0
80+ property int screenWidth: 0
81+ property int screenHeight: 0
82
83 QtObject {
84 id: priv
85@@ -66,10 +69,10 @@
86 Component.onCompleted: {
87 var windowGeometry = windowStateStorage.getGeometry(root.windowId, Qt.rect(target.x, target.y, target.width, target.height))
88 if (windowGeometry !== undefined) {
89- target.x = windowGeometry.x
90- target.y = windowGeometry.y
91- target.width = windowGeometry.width
92- target.height = windowGeometry.height
93+ target.width = Math.min(windowGeometry.width, root.screenWidth)
94+ target.height = Math.min(windowGeometry.height, root.screenHeight - PanelState.panelHeight)
95+ target.x = Math.max(Math.min(windowGeometry.x, root.screenWidth - target.width), 0)
96+ target.y = Math.max(Math.min(windowGeometry.y, root.screenHeight - target.height), PanelState.panelHeight)
97 }
98 var windowState = windowStateStorage.getState(root.windowId, WindowStateStorage.WindowStateNormal)
99 if (windowState === WindowStateStorage.WindowStateMaximized) {
100
101=== modified file 'tests/qmltests/Stages/tst_WindowResizeArea.qml'
102--- tests/qmltests/Stages/tst_WindowResizeArea.qml 2015-11-04 14:57:33 +0000
103+++ tests/qmltests/Stages/tst_WindowResizeArea.qml 2015-11-09 10:53:06 +0000
104@@ -19,6 +19,7 @@
105 import QtTest 1.0
106 import Unity.Test 0.1
107 import ".."
108+import "../../../qml/Components/PanelState"
109 import "../../../qml/Stages"
110 import Ubuntu.Components 1.3
111 import Ubuntu.Components.ListItems 1.3 as ListItem
112@@ -31,6 +32,12 @@
113
114 property var fakeWindow: windowLoader.item
115
116+ Binding {
117+ target: PanelState
118+ property: "panelHeight"
119+ value: units.gu(2)
120+ }
121+
122 Component {
123 id: fakeWindowComponent
124
125@@ -57,6 +64,8 @@
126 minWidth: units.gu(15)
127 minHeight: units.gu(10)
128 windowId: "test-window-id"
129+ screenWidth: root.width
130+ screenHeight: root.height
131 }
132
133 Rectangle {
134@@ -228,5 +237,39 @@
135 // clean up
136 fakeWindow.state = "normal"
137 }
138+
139+
140+ function test_restoreMovesIntoBounds_data() {
141+ return [
142+ {tag: "left off", x: -units.gu(5), y: units.gu(5), w: units.gu(10), h: units.gu(10)},
143+ {tag: "top off", x: units.gu(5), y: -units.gu(5), w: units.gu(10), h: units.gu(10)},
144+ {tag: "right off", x: root.width - units.gu(5), y: units.gu(5), w: units.gu(10), h: units.gu(10)},
145+ {tag: "bottom off", x: units.gu(5), y: root.height - units.gu(5), w: units.gu(10), h: units.gu(10)},
146+ {tag: "width too large", x: units.gu(5), y: units.gu(5), w: root.width * 2, h: units.gu(10)},
147+ {tag: "height too large", x: units.gu(5), y: units.gu(5), w: units.gu(10), h: root.height * 2}
148+ ]
149+ }
150+
151+ function test_restoreMovesIntoBounds(data) {
152+ fakeWindow.x = data.x;
153+ fakeWindow.y = data.y;
154+ fakeWindow.width = data.w;
155+ fakeWindow.height = data.h;
156+ waitForRendering(root);
157+
158+ // This will destroy the window and recreate it
159+ windowLoader.active = false;
160+ waitForRendering(root);
161+ windowLoader.active = true;
162+ waitForRendering(root)
163+
164+ // Make sure it's again where we left it in normal state before destroying
165+ compare(fakeWindow.x >= 0, true)
166+ compare(fakeWindow.y >= PanelState.panelHeight, true)
167+ compare(fakeWindow.x + fakeWindow.width <= root.width, true)
168+ compare(fakeWindow.y + fakeWindow.height <= root.height, true)
169+
170+ waitForRendering(root)
171+ }
172 }
173 }
174
175=== modified file 'tests/qmltests/tst_Shell.qml'
176--- tests/qmltests/tst_Shell.qml 2015-11-04 14:58:05 +0000
177+++ tests/qmltests/tst_Shell.qml 2015-11-09 10:53:06 +0000
178@@ -344,9 +344,9 @@
179 var app2 = ApplicationManager.startApplication("webbrowser-app")
180 var app3 = ApplicationManager.startApplication("camera-app")
181 var app4 = ApplicationManager.startApplication("facebook-webapp")
182- var app5 = ApplicationManager.startApplication("calendar-app")
183+ var app5 = ApplicationManager.startApplication("camera-app")
184 var app6 = ApplicationManager.startApplication("gallery-app")
185- var app7 = ApplicationManager.startApplication("camera-app")
186+ var app7 = ApplicationManager.startApplication("calendar-app")
187 waitUntilAppWindowIsFullyLoaded(app7);
188 }
189
190@@ -1710,11 +1710,11 @@
191 keyPress(Qt.Key_Control)
192 keyClick(Qt.Key_Tab);
193
194-
195 tryCompare(desktopSpread, "state", "altTab")
196
197- mouseMove(shell, 0, 0);
198+ mouseMove(shell, 0, shell.height / 2);
199 tryCompare(launcher, "state", "visibleTemporary")
200+ waitForRendering(shell)
201
202 mouseClick(bfb, bfb.width / 2, bfb.height / 2)
203 tryCompare(launcher, "state", "")
204@@ -1809,6 +1809,37 @@
205 tryCompare(panelButtons, "visible", true);
206 }
207
208+ function test_cantMoveWindowUnderPanel() {
209+ loadDesktopShellWithApps();
210+ var appRepeater = findChild(shell, "appRepeater")
211+ var appDelegate = appRepeater.itemAt(0);
212+
213+ mousePress(appDelegate, appDelegate.width / 2, units.gu(1))
214+ mouseMove(appDelegate, appDelegate.width / 2, -units.gu(100))
215+
216+ compare(appDelegate.y >= PanelState.panelHeight, true);
217+ }
218+
219+ function test_restoreWindowStateFixesIfUnderPanel() {
220+ loadDesktopShellWithApps();
221+ var appRepeater = findChild(shell, "appRepeater")
222+ var appId = ApplicationManager.get(0).appId;
223+ var appDelegate = appRepeater.itemAt(0);
224+
225+ // Move it under the panel programmatically (might happen later with an alt+drag)
226+ appDelegate.y = -units.gu(10)
227+
228+ ApplicationManager.stopApplication(appId)
229+ ApplicationManager.startApplication(appId)
230+ waitForRendering(shell)
231+
232+ // Make sure the newly started one is at index 0 again
233+ tryCompare(ApplicationManager.get(0), "appId", appId);
234+
235+ appDelegate = appRepeater.itemAt(0);
236+ compare(appDelegate.y >= PanelState.panelHeight, true);
237+ }
238+
239 function test_lifecyclePolicyForNonTouchApp_data() {
240 return [
241 {tag: "phone", formFactor: "phone", usageScenario: "phone"},

Subscribers

People subscribed via source and target branches