Merge lp:~lukas-kde/unity8/panelWindowControlButtonsFittsLaw into lp:unity8

Proposed by Lukáš Tinkl
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2600
Merged at revision: 2643
Proposed branch: lp:~lukas-kde/unity8/panelWindowControlButtonsFittsLaw
Merge into: lp:unity8
Diff against target: 175 lines (+33/-16)
4 files modified
qml/Components/WindowControlButtons.qml (+7/-5)
qml/Panel/Panel.qml (+5/-6)
qml/Stages/WindowDecoration.qml (+2/-5)
tests/qmltests/Panel/tst_Panel.qml (+19/-0)
To merge this branch: bzr merge lp:~lukas-kde/unity8/panelWindowControlButtonsFittsLaw
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+303665@code.launchpad.net

Commit message

Respect Fitt's law wrt the window control buttons in panel

Description of the change

Respect Fitt's law wrt the window control buttons in panel

Fixes bug lp:1611959 - Topbar - window controls for maximised windows in the top bar should conform to Fitts's law

Move the inner margins from panel to the buttons, for example to be able to click in the left panel corners and get the window closed correctly.

Test added to tst_Panel

Also fix a minor bug with window title opacity animation.

Checklist:
* 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

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

N/A, visual design unchanged

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2600
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2012/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/2637
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/1442
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/1442
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=yakkety,testname=qmluitests.sh/1442
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/2665
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/2539
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial+overlay/2539
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=yakkety/2539
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=yakkety/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=yakkety/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/2533/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2533
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=yakkety/2533/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2012/rebuild

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

 * 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, excepted unrelated unstable tests

review: Approve
2601. By Lukáš Tinkl

merge trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/WindowControlButtons.qml'
2--- qml/Components/WindowControlButtons.qml 2016-06-20 10:31:44 +0000
3+++ qml/Components/WindowControlButtons.qml 2016-09-01 18:06:02 +0000
4@@ -19,13 +19,12 @@
5
6 Row {
7 id: root
8- spacing: overlayShown ? units.gu(2) : units.gu(1)
9+ spacing: overlayShown ? units.gu(2) : windowIsMaximized ? 0 : units.gu(1)
10 Behavior on spacing {
11 UbuntuNumberAnimation {}
12 }
13
14 // to be set from outside
15- property Item target
16 property bool active: false
17 property bool windowIsMaximized: false
18 property bool closeButtonShown: true
19@@ -49,13 +48,14 @@
20
21 Rectangle {
22 anchors.fill: parent
23+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
24 radius: height / 2
25 color: theme.palette.normal.negative
26 visible: parent.containsMouse && !overlayShown
27 }
28 Icon {
29 anchors.fill: parent
30- anchors.margins: units.dp(3)
31+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
32 source: "graphics/window-close.svg"
33 color: root.active ? "white" : UbuntuColors.slate
34 }
35@@ -71,13 +71,14 @@
36
37 Rectangle {
38 anchors.fill: parent
39+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
40 radius: height / 2
41 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
42 visible: parent.containsMouse && !overlayShown
43 }
44 Icon {
45 anchors.fill: parent
46- anchors.margins: units.dp(3)
47+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
48 source: "graphics/window-minimize.svg"
49 color: root.active ? "white" : UbuntuColors.slate
50 }
51@@ -103,13 +104,14 @@
52
53 Rectangle {
54 anchors.fill: parent
55+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
56 radius: height / 2
57 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
58 visible: parent.containsMouse && !overlayShown
59 }
60 Icon {
61 anchors.fill: parent
62- anchors.margins: units.dp(3)
63+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
64 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"
65 color: root.active ? "white" : UbuntuColors.slate
66 }
67
68=== modified file 'qml/Panel/Panel.qml'
69--- qml/Panel/Panel.qml 2016-06-20 10:31:44 +0000
70+++ qml/Panel/Panel.qml 2016-09-01 18:06:02 +0000
71@@ -1,5 +1,5 @@
72 /*
73- * Copyright (C) 2013-2015 Canonical, Ltd.
74+ * Copyright (C) 2013-2016 Canonical, Ltd.
75 *
76 * This program is free software; you can redistribute it and/or modify
77 * it under the terms of the GNU General Public License as published by
78@@ -120,11 +120,8 @@
79 anchors {
80 left: parent.left
81 top: parent.top
82- leftMargin: units.gu(1)
83- topMargin: units.gu(0.5)
84- bottomMargin: units.gu(0.5)
85 }
86- height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
87+ height: indicators.minimizedPanelHeight
88
89 visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
90 && !root.locked && !callHint.visible
91@@ -183,13 +180,15 @@
92 }
93 color: "white"
94 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
95- visible: !windowControlButtons.visible && !root.locked && !callHint.visible
96+ opacity: !windowControlButtons.visible && !root.locked && !callHint.visible ? 1 : 0
97+ visible: opacity != 0
98 verticalAlignment: Text.AlignVCenter
99 fontSize: "medium"
100 font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
101 text: PanelState.title
102 elide: Text.ElideRight
103 maximumLineCount: 1
104+ Behavior on opacity { UbuntuNumberAnimation {} }
105 }
106
107 // TODO here would the Locally integrated menus come
108
109=== modified file 'qml/Stages/WindowDecoration.qml'
110--- qml/Stages/WindowDecoration.qml 2016-06-27 18:44:07 +0000
111+++ qml/Stages/WindowDecoration.qml 2016-09-01 18:06:02 +0000
112@@ -108,7 +108,6 @@
113 onMaximizeHorizontallyClicked: root.maximizeHorizontallyClicked();
114 onMaximizeVerticallyClicked: root.maximizeVerticallyClicked();
115 closeButtonShown: root.target.application.appId !== "unity8-dash"
116- target: root.target
117 }
118
119 Label {
120@@ -122,10 +121,8 @@
121 font.weight: root.active ? Font.Light : Font.Medium
122 elide: Text.ElideRight
123 opacity: overlayShown ? 0 : 1
124- visible: opacity == 1
125- Behavior on opacity {
126- OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
127- }
128+ visible: opacity != 0
129+ Behavior on opacity { UbuntuNumberAnimation {} }
130 }
131 }
132 }
133
134=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
135--- tests/qmltests/Panel/tst_Panel.qml 2016-04-05 20:21:43 +0000
136+++ tests/qmltests/Panel/tst_Panel.qml 2016-09-01 18:06:02 +0000
137@@ -182,6 +182,12 @@
138 signalName: "pressedChanged"
139 }
140
141+ SignalSpy {
142+ id: windowControlButtonsSpy
143+ target: PanelState
144+ signalName: "closeClicked"
145+ }
146+
147 function init() {
148 panel.fullscreenMode = false;
149 callManager.foregroundCall = null;
150@@ -197,6 +203,8 @@
151
152 backgroundPressedSpy.clear();
153 compare(backgroundPressedSpy.valid, true);
154+ windowControlButtonsSpy.clear();
155+ compare(windowControlButtonsSpy.valid, true);
156 }
157
158 function get_indicator_item(index) {
159@@ -494,5 +502,16 @@
160 compare(panel.indicators.shown, false);
161 tryCompare(panel.indicators, "fullyClosed", true);
162 }
163+
164+ // https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1611959
165+ function test_windowControlButtonsFittsLaw() {
166+ var buttonsVisible = PanelState.buttonsVisible;
167+ PanelState.buttonsVisible = true;
168+ // click in very topleft corner and verify the close button got clicked too
169+ mouseMove(panel, 0, 0);
170+ mouseClick(panel, 0, 0, undefined /*button*/, undefined /*modifiers*/, 100 /*short delay*/);
171+ compare(windowControlButtonsSpy.count, 1);
172+ PanelState.buttonsVisible = buttonsVisible;
173+ }
174 }
175 }

Subscribers

People subscribed via source and target branches