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
=== modified file 'qml/Components/WindowControlButtons.qml'
--- qml/Components/WindowControlButtons.qml 2016-06-20 10:31:44 +0000
+++ qml/Components/WindowControlButtons.qml 2016-09-01 18:06:02 +0000
@@ -19,13 +19,12 @@
1919
20Row {20Row {
21 id: root21 id: root
22 spacing: overlayShown ? units.gu(2) : units.gu(1)22 spacing: overlayShown ? units.gu(2) : windowIsMaximized ? 0 : units.gu(1)
23 Behavior on spacing {23 Behavior on spacing {
24 UbuntuNumberAnimation {}24 UbuntuNumberAnimation {}
25 }25 }
2626
27 // to be set from outside27 // to be set from outside
28 property Item target
29 property bool active: false28 property bool active: false
30 property bool windowIsMaximized: false29 property bool windowIsMaximized: false
31 property bool closeButtonShown: true30 property bool closeButtonShown: true
@@ -49,13 +48,14 @@
4948
50 Rectangle {49 Rectangle {
51 anchors.fill: parent50 anchors.fill: parent
51 anchors.margins: windowIsMaximized ? units.dp(3) : 0
52 radius: height / 252 radius: height / 2
53 color: theme.palette.normal.negative53 color: theme.palette.normal.negative
54 visible: parent.containsMouse && !overlayShown54 visible: parent.containsMouse && !overlayShown
55 }55 }
56 Icon {56 Icon {
57 anchors.fill: parent57 anchors.fill: parent
58 anchors.margins: units.dp(3)58 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
59 source: "graphics/window-close.svg"59 source: "graphics/window-close.svg"
60 color: root.active ? "white" : UbuntuColors.slate60 color: root.active ? "white" : UbuntuColors.slate
61 }61 }
@@ -71,13 +71,14 @@
7171
72 Rectangle {72 Rectangle {
73 anchors.fill: parent73 anchors.fill: parent
74 anchors.margins: windowIsMaximized ? units.dp(3) : 0
74 radius: height / 275 radius: height / 2
75 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash76 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
76 visible: parent.containsMouse && !overlayShown77 visible: parent.containsMouse && !overlayShown
77 }78 }
78 Icon {79 Icon {
79 anchors.fill: parent80 anchors.fill: parent
80 anchors.margins: units.dp(3)81 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
81 source: "graphics/window-minimize.svg"82 source: "graphics/window-minimize.svg"
82 color: root.active ? "white" : UbuntuColors.slate83 color: root.active ? "white" : UbuntuColors.slate
83 }84 }
@@ -103,13 +104,14 @@
103104
104 Rectangle {105 Rectangle {
105 anchors.fill: parent106 anchors.fill: parent
107 anchors.margins: windowIsMaximized ? units.dp(3) : 0
106 radius: height / 2108 radius: height / 2
107 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash109 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
108 visible: parent.containsMouse && !overlayShown110 visible: parent.containsMouse && !overlayShown
109 }111 }
110 Icon {112 Icon {
111 anchors.fill: parent113 anchors.fill: parent
112 anchors.margins: units.dp(3)114 anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
113 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"115 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"
114 color: root.active ? "white" : UbuntuColors.slate116 color: root.active ? "white" : UbuntuColors.slate
115 }117 }
116118
=== modified file 'qml/Panel/Panel.qml'
--- qml/Panel/Panel.qml 2016-06-20 10:31:44 +0000
+++ qml/Panel/Panel.qml 2016-09-01 18:06:02 +0000
@@ -1,5 +1,5 @@
1/*1/*
2 * Copyright (C) 2013-2015 Canonical, Ltd.2 * Copyright (C) 2013-2016 Canonical, Ltd.
3 *3 *
4 * This program is free software; you can redistribute it and/or modify4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by5 * it under the terms of the GNU General Public License as published by
@@ -120,11 +120,8 @@
120 anchors {120 anchors {
121 left: parent.left121 left: parent.left
122 top: parent.top122 top: parent.top
123 leftMargin: units.gu(1)
124 topMargin: units.gu(0.5)
125 bottomMargin: units.gu(0.5)
126 }123 }
127 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin124 height: indicators.minimizedPanelHeight
128125
129 visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)126 visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
130 && !root.locked && !callHint.visible127 && !root.locked && !callHint.visible
@@ -183,13 +180,15 @@
183 }180 }
184 color: "white"181 color: "white"
185 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin182 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
186 visible: !windowControlButtons.visible && !root.locked && !callHint.visible183 opacity: !windowControlButtons.visible && !root.locked && !callHint.visible ? 1 : 0
184 visible: opacity != 0
187 verticalAlignment: Text.AlignVCenter185 verticalAlignment: Text.AlignVCenter
188 fontSize: "medium"186 fontSize: "medium"
189 font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium187 font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
190 text: PanelState.title188 text: PanelState.title
191 elide: Text.ElideRight189 elide: Text.ElideRight
192 maximumLineCount: 1190 maximumLineCount: 1
191 Behavior on opacity { UbuntuNumberAnimation {} }
193 }192 }
194193
195 // TODO here would the Locally integrated menus come194 // TODO here would the Locally integrated menus come
196195
=== modified file 'qml/Stages/WindowDecoration.qml'
--- qml/Stages/WindowDecoration.qml 2016-06-27 18:44:07 +0000
+++ qml/Stages/WindowDecoration.qml 2016-09-01 18:06:02 +0000
@@ -108,7 +108,6 @@
108 onMaximizeHorizontallyClicked: root.maximizeHorizontallyClicked();108 onMaximizeHorizontallyClicked: root.maximizeHorizontallyClicked();
109 onMaximizeVerticallyClicked: root.maximizeVerticallyClicked();109 onMaximizeVerticallyClicked: root.maximizeVerticallyClicked();
110 closeButtonShown: root.target.application.appId !== "unity8-dash"110 closeButtonShown: root.target.application.appId !== "unity8-dash"
111 target: root.target
112 }111 }
113112
114 Label {113 Label {
@@ -122,10 +121,8 @@
122 font.weight: root.active ? Font.Light : Font.Medium121 font.weight: root.active ? Font.Light : Font.Medium
123 elide: Text.ElideRight122 elide: Text.ElideRight
124 opacity: overlayShown ? 0 : 1123 opacity: overlayShown ? 0 : 1
125 visible: opacity == 1124 visible: opacity != 0
126 Behavior on opacity {125 Behavior on opacity { UbuntuNumberAnimation {} }
127 OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
128 }
129 }126 }
130 }127 }
131}128}
132129
=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
--- tests/qmltests/Panel/tst_Panel.qml 2016-04-05 20:21:43 +0000
+++ tests/qmltests/Panel/tst_Panel.qml 2016-09-01 18:06:02 +0000
@@ -182,6 +182,12 @@
182 signalName: "pressedChanged"182 signalName: "pressedChanged"
183 }183 }
184184
185 SignalSpy {
186 id: windowControlButtonsSpy
187 target: PanelState
188 signalName: "closeClicked"
189 }
190
185 function init() {191 function init() {
186 panel.fullscreenMode = false;192 panel.fullscreenMode = false;
187 callManager.foregroundCall = null;193 callManager.foregroundCall = null;
@@ -197,6 +203,8 @@
197203
198 backgroundPressedSpy.clear();204 backgroundPressedSpy.clear();
199 compare(backgroundPressedSpy.valid, true);205 compare(backgroundPressedSpy.valid, true);
206 windowControlButtonsSpy.clear();
207 compare(windowControlButtonsSpy.valid, true);
200 }208 }
201209
202 function get_indicator_item(index) {210 function get_indicator_item(index) {
@@ -494,5 +502,16 @@
494 compare(panel.indicators.shown, false);502 compare(panel.indicators.shown, false);
495 tryCompare(panel.indicators, "fullyClosed", true);503 tryCompare(panel.indicators, "fullyClosed", true);
496 }504 }
505
506 // https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1611959
507 function test_windowControlButtonsFittsLaw() {
508 var buttonsVisible = PanelState.buttonsVisible;
509 PanelState.buttonsVisible = true;
510 // click in very topleft corner and verify the close button got clicked too
511 mouseMove(panel, 0, 0);
512 mouseClick(panel, 0, 0, undefined /*button*/, undefined /*modifiers*/, 100 /*short delay*/);
513 compare(windowControlButtonsSpy.count, 1);
514 PanelState.buttonsVisible = buttonsVisible;
515 }
497 }516 }
498}517}

Subscribers

People subscribed via source and target branches