on xenial help sign in
only modify the window control buttons and title for the focused window
c24c26aLukáš Tinkl
qml/Components/TouchControlsState/TouchControlsState.qml+1
@@ -22,4 +22,5 @@ QtObject {
22
22
23 property bool overlayShown: false
23 property bool overlayShown: false
24 property bool buttonsShownInPanel: false
24 property bool buttonsShownInPanel: false
25+ property var surface: null
25}
26}
qml/Components/WindowControlButtons.qml+7−4
@@ -20,16 +20,19 @@ import "../Components/TouchControlsState"
20
20
21Row {
21Row {
22 id: root
22 id: root
23− spacing: TouchControlsState.overlayShown ? units.gu(2) : units.gu(1)
23+ spacing: overlayShown ? units.gu(2) : units.gu(1)
24 Behavior on spacing {
24 Behavior on spacing {
25 UbuntuNumberAnimation {}
25 UbuntuNumberAnimation {}
26 }
26 }
27
27
28 // to be set from outside
28 // to be set from outside
29+ property Item target
29 property bool active: false
30 property bool active: false
30 property bool windowIsMaximized: false
31 property bool windowIsMaximized: false
31 property bool closeButtonShown: true
32 property bool closeButtonShown: true
32
33
34+ readonly property bool overlayShown: TouchControlsState.overlayShown && target && target.surface === TouchControlsState.surface
35+
33 signal close()
36 signal close()
34 signal minimize()
37 signal minimize()
35 signal maximize()
38 signal maximize()
@@ -47,7 +50,7 @@ Row {
47 anchors.fill: parent
50 anchors.fill: parent
48 radius: height / 2
51 radius: height / 2
49 color: UbuntuColors.red
52 color: UbuntuColors.red
50− visible: parent.containsMouse && !TouchControlsState.overlayShown
53+ visible: parent.containsMouse && !overlayShown
51 }
54 }
52 Icon {
55 Icon {
53 anchors.fill: parent
56 anchors.fill: parent
@@ -69,7 +72,7 @@ Row {
69 anchors.fill: parent
72 anchors.fill: parent
70 radius: height / 2
73 radius: height / 2
71 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
74 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
72− visible: parent.containsMouse && !TouchControlsState.overlayShown
75+ visible: parent.containsMouse && !overlayShown
73 }
76 }
74 Icon {
77 Icon {
75 anchors.fill: parent
78 anchors.fill: parent
@@ -91,7 +94,7 @@ Row {
91 anchors.fill: parent
94 anchors.fill: parent
92 radius: height / 2
95 radius: height / 2
93 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
96 color: root.active ? UbuntuColors.graphite : UbuntuColors.ash
94− visible: parent.containsMouse && !TouchControlsState.overlayShown
97+ visible: parent.containsMouse && !overlayShown
95 }
98 }
96 Icon {
99 Icon {
97 anchors.fill: parent
100 anchors.fill: parent
qml/Stages/DesktopStage.qml+10−3
@@ -199,6 +199,12 @@ AbstractStage {
199 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null
199 value: priv.focusedAppDelegate && !priv.focusedAppDelegate.maximized && priv.foregroundMaximizedAppDelegate !== null
200 }
200 }
201
201
202+ Binding {
203+ target: PanelState
204+ property: "closeButtonShown"
205+ value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && priv.focusedAppDelegate.application.appId !== "unity8-dash"
206+ }
207+
202 Binding {
208 Binding {
203 target: TouchControlsState
209 target: TouchControlsState
204 property: "buttonsShownInPanel"
210 property: "buttonsShownInPanel"
@@ -206,9 +212,10 @@ AbstractStage {
206 }
212 }
207
213
208 Binding {
214 Binding {
209− target: PanelState
215+ target: TouchControlsState
210− property: "closeButtonShown"
216+ property: "surface"
217+ value: priv.focusedAppDelegate.surface
211− value: priv.focusedAppDelegate && priv.focusedAppDelegate.maximized && priv.focusedAppDelegate.application.appId !== "unity8-dash"
218+ when: priv.focusedAppDelegate && priv.focusedAppDelegate.surface
212 }
219 }
213
220
214 Component.onDestruction: {
221 Component.onDestruction: {
qml/Stages/WindowDecoration.qml+9−2
@@ -41,6 +41,8 @@ MouseArea {
41 property real distanceX
41 property real distanceX
42 property real distanceY
42 property real distanceY
43 property bool dragging
43 property bool dragging
44+
45+ readonly property bool overlayShown: TouchControlsState.overlayShown && target && target.surface === TouchControlsState.surface
44 }
46 }
45
47
46 onPressedChanged: {
48 onPressedChanged: {
@@ -74,11 +76,15 @@ MouseArea {
74 Row {
76 Row {
75 anchors {
77 anchors {
76 fill: parent
78 fill: parent
77− leftMargin: TouchControlsState.overlayShown ? units.gu(5) : units.gu(1)
79+ leftMargin: priv.overlayShown ? units.gu(5) : units.gu(1)
78 rightMargin: units.gu(1)
80 rightMargin: units.gu(1)
79 topMargin: units.gu(0.5)
81 topMargin: units.gu(0.5)
80 bottomMargin: units.gu(0.5)
82 bottomMargin: units.gu(0.5)
81 }
83 }
84+ Behavior on anchors.leftMargin {
85+ UbuntuNumberAnimation {}
86+ }
87+
82 spacing: units.gu(3)
88 spacing: units.gu(3)
83
89
84 WindowControlButtons {
90 WindowControlButtons {
@@ -86,6 +92,7 @@ MouseArea {
86 height: parent.height
92 height: parent.height
87 active: root.active
93 active: root.active
88 closeButtonShown: root.target.application.appId !== "unity8-dash"
94 closeButtonShown: root.target.application.appId !== "unity8-dash"
95+ target: root.target
89 onClose: root.close();
96 onClose: root.close();
90 onMinimize: root.minimize();
97 onMinimize: root.minimize();
91 onMaximize: root.maximize();
98 onMaximize: root.maximize();
@@ -101,7 +108,7 @@ MouseArea {
101 fontSize: "medium"
108 fontSize: "medium"
102 font.weight: root.active ? Font.Light : Font.Medium
109 font.weight: root.active ? Font.Light : Font.Medium
103 elide: Text.ElideRight
110 elide: Text.ElideRight
104− opacity: TouchControlsState.overlayShown ? 0 : 1
111+ opacity: priv.overlayShown ? 0 : 1
105 visible: opacity == 1
112 visible: opacity == 1
106 Behavior on opacity {
113 Behavior on opacity {
107 OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
114 OpacityAnimator { duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }