on xenial help sign in
only modify the window control buttons and title for the focused window
commitc24c26a3f7b5d93048df6c707cea9080305ddb1f authorLukáš Tinkl <lukas.tinkl@canonical.com> dateSat 7 May 2016, 09:36 (10 years ago) parente668975
4 files changed+27−9
qml/Components/TouchControlsState/TouchControlsState.qml+1 qml/Components/WindowControlButtons.qml+7−4 qml/Stages/DesktopStage.qml+10−3 qml/Stages/WindowDecoration.qml+9−2
qml/Components/TouchControlsState/TouchControlsState.qml+1
@@ -22,4 +22,5 @@ QtObject {
2222
2323 property bool overlayShown: false
2424 property bool buttonsShownInPanel: false
25+ property var surface: null
2526}
qml/Components/WindowControlButtons.qml+7−4
@@ -20,16 +20,19 @@ import "../Components/TouchControlsState"
2020
2121Row {
2222 id: root
23− spacing: TouchControlsState.overlayShown ? units.gu(2) : units.gu(1)
23+ spacing: overlayShown ? units.gu(2) : units.gu(1)
2424 Behavior on spacing {
2525 UbuntuNumberAnimation {}
2626 }
2727
2828 // to be set from outside
29+ property Item target
2930 property bool active: false
3031 property bool windowIsMaximized: false
3132 property bool closeButtonShown: true
3233
34+ readonly property bool overlayShown: TouchControlsState.overlayShown && target && target.surface === TouchControlsState.surface
35+
3336 signal close()
3437 signal minimize()
3538 signal maximize()
@@ -47,7 +50,7 @@ Row {
4750 anchors.fill: parent
4851 radius: height / 2
4952 color: UbuntuColors.red
50− visible: parent.containsMouse && !TouchControlsState.overlayShown
53+ visible: parent.containsMouse && !overlayShown
5154 }
5255 Icon {
5356 anchors.fill: parent
@@ -69,7 +72,7 @@ Row {
6972 anchors.fill: parent
7073 radius: height / 2
7174 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
72− visible: parent.containsMouse && !TouchControlsState.overlayShown
75+ visible: parent.containsMouse && !overlayShown
7376 }
7477 Icon {
7578 anchors.fill: parent
@@ -91,7 +94,7 @@ Row {
9194 anchors.fill: parent
9295 radius: height / 2
9396 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
94− visible: parent.containsMouse && !TouchControlsState.overlayShown
97+ visible: parent.containsMouse && !overlayShown
9598 }
9699 Icon {
97100 anchors.fill: parent
qml/Stages/DesktopStage.qml+10−3
@@ -199,6 +199,12 @@ AbstractStage {
199199 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null
200200 }
201201
202+ Binding {
203+ target: PanelState
204+ property: "closeButtonShown"
205+ value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && priv.focusedAppDelegate.application.appId !== "unity8-dash"
206+ }
207+
202208 Binding {
203209 target: TouchControlsState
204210 property: "buttonsShownInPanel"
@@ -206,9 +212,10 @@ AbstractStage {
206212 }
207213
208214 Binding {
209− target: PanelState
210− property: "closeButtonShown"
211− value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && priv.focusedAppDelegate.application.appId !== "unity8-dash"
215+ target: TouchControlsState
216+ property: "surface"
217+ value: priv.focusedAppDelegate.surface
218+ when: priv.focusedAppDelegate && priv.focusedAppDelegate.surface
212219 }
213220
214221 Component.onDestruction: {
qml/Stages/WindowDecoration.qml+9−2
@@ -41,6 +41,8 @@ MouseArea {
4141 property real distanceX
4242 property real distanceY
4343 property bool dragging
44+
45+ readonly property bool overlayShown: TouchControlsState.overlayShown && target && target.surface === TouchControlsState.surface
4446 }
4547
4648 onPressedChanged: {
@@ -74,11 +76,15 @@ MouseArea {
7476 Row {
7577 anchors {
7678 fill: parent
77− leftMargin: TouchControlsState.overlayShown ? units.gu(5) : units.gu(1)
79+ leftMargin: priv.overlayShown ? units.gu(5) : units.gu(1)
7880 rightMargin: units.gu(1)
7981 topMargin: units.gu(0.5)
8082 bottomMargin: units.gu(0.5)
8183 }
84+ Behavior on anchors.leftMargin {
85+ UbuntuNumberAnimation {}
86+ }
87+
8288 spacing: units.gu(3)
8389
8490 WindowControlButtons {
@@ -86,6 +92,7 @@ MouseArea {
8692 height: parent.height
8793 active: root.active
8894 closeButtonShown: root.target.application.appId !== "unity8-dash"
95+ target: root.target
8996 onClose: root.close();
9097 onMinimize: root.minimize();
9198 onMaximize: root.maximize();
@@ -101,7 +108,7 @@ MouseArea {
101108 fontSize: "medium"
102109 font.weight: root.active ? Font.Light : Font.Medium
103110 elide: Text.ElideRight
104− opacity: TouchControlsState.overlayShown ? 0 : 1
111+ opacity: priv.overlayShown ? 0 : 1
105112 visible: opacity == 1
106113 Behavior on opacity {
107114 OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }