@@ -46,7 +46,6 @@ Item {
4646 property alias indicators: __indicators
4747 property bool fullscreenMode: false
4848 property real panelAreaShowProgress: 1.0
49− property bool locked: false
5049 property bool greeterShown: false
5150
5251 property string mode: "staged"
@@ -76,6 +75,26 @@ Item {
7675 persistentSurfaceId: PanelState.focusedPersistentSurfaceId
7776 }
7877
78+ QtObject {
79+ id: d
80+
81+ property bool __revealControls: (decorationMouseArea.containsMouse || menuBarLoader.menusRequested) &&
82+ !applicationMenus.shown &&
83+ !indicators.shown
84+
85+ property bool showWindowDecorationControls: (__revealControls && PanelState.decorationsVisible) ||
86+ PanelState.decorationsAlwaysVisible
87+
88+ property bool enablePointerMenu: __revealControls &&
89+ (PanelState.decorationsVisible || mode == "staged") &&
90+ applicationMenus.available &&
91+ applicationMenus.model
92+
93+ property bool enableTouchMenus: !enablePointerMenu &&
94+ applicationMenus.available &&
95+ applicationMenus.model
96+ }
97+
7998 Item {
8099 id: panelArea
81100 objectName: "panelArea"
@@ -153,8 +172,6 @@ Item {
153172 }
154173 }
155174
156− property bool showWindowControls: containsMouse || menuBarLoader.menusRequested
157−
158175 Row {
159176 anchors.fill: parent
160177 spacing: units.gu(2)
@@ -165,7 +182,7 @@ Item {
165182 id: windowControlButtons
166183 objectName: "panelWindowControlButtons"
167184 height: indicators.minimizedPanelHeight
168− opacity: (PanelState.decorationsVisible && decorationMouseArea.showWindowControls) || PanelState.decorationsAlwaysVisible ? 1 : 0
185+ opacity: d.showWindowDecorationControls ? 1 : 0
169186 visible: opacity != 0
170187 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
171188
@@ -180,7 +197,8 @@ Item {
180197 Loader {
181198 id: menuBarLoader
182199 height: parent.height
183− opacity: decorationMouseArea.showWindowControls || PanelState.decorationsAlwaysVisible ? 1 : 0
200+ enabled: d.enablePointerMenu
201+ opacity: d.enablePointerMenu ? 1 : 0
184202 visible: opacity != 0
185203 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
186204 active: __applicationMenus.model
@@ -197,7 +215,12 @@ Item {
197215
198216 Connections {
199217 target: __applicationMenus
200− onHide: bar.dismiss();
218+ onShownChanged: bar.dismiss();
219+ }
220+
221+ Connections {
222+ target: __indicators
223+ onShownChanged: bar.dismiss();
201224 }
202225 }
203226 }
@@ -210,7 +233,7 @@ Item {
210233 anchors.centerIn: parent
211234 height: minimizedPanelHeight
212235
213− visible: active && indicators.state == "initial"
236+ visible: active && indicators.state == "initial" && __applicationMenus.state == "initial"
214237 greeterShown: root.greeterShown
215238 }
216239 }
@@ -225,7 +248,7 @@ Item {
225248 openedHeight: root.height
226249 alignment: Qt.AlignLeft
227250 enableHint: !callHint.active && !fullscreenMode
228− showOnClick: !callHint.visible
251+ showOnClick: false
229252 panelColor: panelAreaBackground.color
230253
231254 onShowTapped: {
@@ -266,8 +289,8 @@ Item {
266289 }
267290 }
268291
269− enabled: !root.locked && model
270− opacity: decorationMouseArea.showWindowControls || PanelState.decorationsAlwaysVisible ? 0 : 1
292+ enabled: d.enableTouchMenus
293+ opacity: d.enableTouchMenus ? 1 : 0
271294 visible: opacity != 0
272295 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
273296