on xenial help sign in
obey Fitt's law for the corner window control buttons in panel

also fix opacity animation issues for the window title

commit5f26e9caa61a8872573a5061eb2f7c87d7dd4b79 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 23 Aug 2016, 11:34 (10 years ago) parent4a6748f
3 files changed+14−16
qml/Components/WindowControlButtons.qml+7−5 qml/Panel/Panel.qml+5−6 qml/Stages/WindowDecoration.qml+2−5
qml/Components/WindowControlButtons.qml+7−5
@@ -19,13 +19,12 @@ import Ubuntu.Components 1.3
1919
2020Row {
2121 id: root
22− spacing: overlayShown ? units.gu(2) : units.gu(1)
22+ spacing: overlayShown ? units.gu(2) : windowIsMaximized ? 0 : units.gu(1)
2323 Behavior on spacing {
2424 UbuntuNumberAnimation {}
2525 }
2626
2727 // to be set from outside
28− property Item target
2928 property bool active: false
3029 property bool windowIsMaximized: false
3130 property bool closeButtonShown: true
@@ -49,13 +48,14 @@ Row {
4948
5049 Rectangle {
5150 anchors.fill: parent
51+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
5252 radius: height / 2
5353 color: theme.palette.normal.negative
5454 visible: parent.containsMouse && !overlayShown
5555 }
5656 Icon {
5757 anchors.fill: parent
58− anchors.margins: units.dp(3)
58+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
5959 source: "graphics/window-close.svg"
6060 color: root.active ? "white" : UbuntuColors.slate
6161 }
@@ -71,13 +71,14 @@ Row {
7171
7272 Rectangle {
7373 anchors.fill: parent
74+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
7475 radius: height / 2
7576 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
7677 visible: parent.containsMouse && !overlayShown
7778 }
7879 Icon {
7980 anchors.fill: parent
80− anchors.margins: units.dp(3)
81+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
8182 source: "graphics/window-minimize.svg"
8283 color: root.active ? "white" : UbuntuColors.slate
8384 }
@@ -103,13 +104,14 @@ Row {
103104
104105 Rectangle {
105106 anchors.fill: parent
107+ anchors.margins: windowIsMaximized ? units.dp(3) : 0
106108 radius: height / 2
107109 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
108110 visible: parent.containsMouse && !overlayShown
109111 }
110112 Icon {
111113 anchors.fill: parent
112− anchors.margins: units.dp(3)
114+ anchors.margins: windowIsMaximized ? units.dp(6) : units.dp(3)
113115 source: root.windowIsMaximized ? "graphics/window-window.svg" : "graphics/window-maximize.svg"
114116 color: root.active ? "white" : UbuntuColors.slate
115117 }
qml/Panel/Panel.qml+5−6
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013-2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -120,11 +120,8 @@ Item {
120120 anchors {
121121 left: parent.left
122122 top: parent.top
123− leftMargin: units.gu(1)
124− topMargin: units.gu(0.5)
125− bottomMargin: units.gu(0.5)
126123 }
127− height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
124+ height: indicators.minimizedPanelHeight
128125
129126 visible: ((PanelState.buttonsVisible && parent.containsMouse) || PanelState.buttonsAlwaysVisible)
130127 && !root.locked && !callHint.visible
@@ -183,13 +180,15 @@ Item {
183180 }
184181 color: "white"
185182 height: indicators.minimizedPanelHeight - anchors.topMargin - anchors.bottomMargin
186− visible: !windowControlButtons.visible && !root.locked && !callHint.visible
183+ opacity: !windowControlButtons.visible && !root.locked && !callHint.visible ? 1 : 0
184+ visible: opacity != 0
187185 verticalAlignment: Text.AlignVCenter
188186 fontSize: "medium"
189187 font.weight: PanelState.buttonsVisible ? Font.Light : Font.Medium
190188 text: PanelState.title
191189 elide: Text.ElideRight
192190 maximumLineCount: 1
191+ Behavior on opacity { UbuntuNumberAnimation {} }
193192 }
194193
195194 // TODO here would the Locally integrated menus come
qml/Stages/WindowDecoration.qml+2−5
@@ -108,7 +108,6 @@ MouseArea {
108108 onMaximizeHorizontallyClicked: root.maximizeHorizontallyClicked();
109109 onMaximizeVerticallyClicked: root.maximizeVerticallyClicked();
110110 closeButtonShown: root.target.application.appId !== "unity8-dash"
111− target: root.target
112111 }
113112
114113 Label {
@@ -122,10 +121,8 @@ MouseArea {
122121 font.weight: root.active ? Font.Light : Font.Medium
123122 elide: Text.ElideRight
124123 opacity: overlayShown ? 0 : 1
125− visible: opacity == 1
126− Behavior on opacity {
127− OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
128− }
124+ visible: opacity != 0
125+ Behavior on opacity { UbuntuNumberAnimation {} }
129126 }
130127 }
131128}