@@ -42,7 +42,7 @@ Item {
42 property real indicatorMenuWidth: width
42 property real indicatorMenuWidth: width
43 property real applicationMenuWidth: width
43 property real applicationMenuWidth: width
45− property alias applicationMenus: fakeApplicationMenus
45+ property alias applicationMenus: __applicationMenus
46 property alias indicators: __indicators
46 property alias indicators: __indicators
47 property bool fullscreenMode: false
47 property bool fullscreenMode: false
48 property real indicatorAreaShowProgress: 1.0
48 property real indicatorAreaShowProgress: 1.0
@@ -55,9 +55,14 @@ Item {
55 id: backMouseEater
55 id: backMouseEater
56 anchors.fill: parent
56 anchors.fill: parent
57 anchors.topMargin: panelHeight
57 anchors.topMargin: panelHeight
58− visible: __indicators.fullyOpened
58+ visible: __indicators.fullyOpened || __applicationMenus.fullyOpened
59 enabled: visible
59 enabled: visible
60 hoverEnabled: true // should also eat hover events, otherwise they will pass through
60 hoverEnabled: true // should also eat hover events, otherwise they will pass through
63+ __applicationMenus.hide();
@@ -66,11 +71,6 @@ Item {
66 value: minimizedPanelHeight
71 value: minimizedPanelHeight
70− id: fakeApplicationMenus
71− model: registeredMenuModel.model
74 RegisteredApplicationMenuModel {
74 RegisteredApplicationMenuModel {
75 id: registeredMenuModel
75 id: registeredMenuModel
76 persistentSurfaceId: PanelState.focusedPersistentSurfaceId
76 persistentSurfaceId: PanelState.focusedPersistentSurfaceId
@@ -98,6 +98,16 @@ Item {
98 source: "graphics/rectangular_dropshadow.sci"
98 source: "graphics/rectangular_dropshadow.sci"
102+ id: appmenuDropShadow
104+ fill: __applicationMenus
105+ margins: -units.gu(1)
107+ visible: !__applicationMenus.fullyClosed
108+ source: "graphics/rectangular_dropshadow.sci"
101 BorderImage {
111 BorderImage {
102 id: panelDropShadow
112 id: panelDropShadow
103 anchors {
113 anchors {
@@ -110,7 +120,7 @@ Item {
111 Rectangle {
121 Rectangle {
112 id: panelAreaBackground
122 id: panelAreaBackground
113− color: theme.palette.normal.background
123+ color: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
114 anchors {
124 anchors {
115 top: parent.top
125 top: parent.top
116 left: parent.left
126 left: parent.left
@@ -121,300 +131,148 @@ Item {
121 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
131 Behavior on color { ColorAnimation { duration: UbuntuAnimation.FastDuration } }
124− Loader {
134+ MouseArea {
125− id: apppMenuLoader
135+ id: decorationMouseArea
126− sourceComponent: mode == "staged" ? stagedLeftPanelComponent : windowedLeftPanelComponent
136+ objectName: "windowControlArea"
127− width: parent.width
137+ anchors {
128 height: minimizedPanelHeight
141 height: minimizedPanelHeight
142+ hoverEnabled: !__indicators.shown
144+ if (callHint.visible) {
145+ callHint.showLiveCall();
130− opacity: root.locked ? 0 : 1
149+ onPressed: {
131− visible: opacity != 0
150+ if (!callHint.visible) {
132− Behavior on opacity { UbuntuNumberAnimation {} }
151+ // let it fall through to the window decoration of the maximized window behind, if any
152+ mouse.accepted = false;
135− Component {
156+ property bool showWindowControls: (PanelState.decorationsVisible && (containsMouse || menuBarLoader.menusRequested)) || PanelState.decorationsAlwaysVisible
136− id: stagedLeftPanelComponent
138− MouseArea {
158+ // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
139− id: decorationMouseArea
159+ // cf. https://bugreports.qt.io/browse/QTBUG-32909
140− objectName: "windowControlArea"
160+ WindowControlButtons {
161+ id: windowControlButtons
162+ objectName: "panelWindowControlButtons"
141 anchors {
163 anchors {
142 left: parent.left
164 left: parent.left
143− right: parent.right
165+ top: parent.top
145− height: minimizedPanelHeight
146− hoverEnabled: !__indicators.shown
148− if (callHint.visible) {
149− callHint.showLiveCall();
167+ height: indicators.minimizedPanelHeight
168+ opacity: decorationMouseArea.showWindowControls ? 1 : 0
169+ visible: opacity != 0
170+ Behavior on opacity { UbuntuNumberAnimation {} }
172+ active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
173+ windowIsMaximized: true
174+ onCloseClicked: PanelState.closeClicked()
175+ onMinimizeClicked: PanelState.minimizeClicked()
176+ onMaximizeClicked: PanelState.restoreClicked()
177+ closeButtonShown: PanelState.closeButtonShown
153− BorderImage {
180+ Loader {
154− id: applicationMenusDropShadow
181+ id: menuBarLoader
155− anchors {
182+ anchors {
156− fill: __applicationMenus
183+ left: windowControlButtons.right
157− margins: -units.gu(1)
184+ leftMargin: units.gu(3)
159− visible: !__applicationMenus.fullyClosed
160− source: "graphics/rectangular_dropshadow.sci"
186+ height: parent.height
187+ opacity: windowControlButtons.opacity
188+ visible: opacity != 0
189+ active: __applicationMenus.model
163− PanelMenu {
191+ property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
164− id: __applicationMenus
166− hides: fakeApplicationMenus.hides
167− model: fakeApplicationMenus.model
169− width: root.applicationMenuWidth
170− minimizedPanelHeight: root.minimizedPanelHeight
171− expandedPanelHeight: root.expandedPanelHeight
172− openedHeight: root.height
173− enableHint: !callHint.active && !fullscreenMode
174− showOnClick: !callHint.visible
175− panelColor: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
176− alignment: Qt.AlignLeft
178− showRowTitle: !expanded
179− rowTitle: PanelState.title
180− rowItemDelegate: ActionItem {
182− property int ownIndex: index
184− width: _title.width + units.gu(2)
185− height: parent.height
188− text: model.label.replace("_", "&")
193− anchors.centerIn: parent
194− text: actionItem.text
195− horizontalAlignment: Text.AlignLeft
196− color: enabled ? "white" : "#5d5d5d"
200− pageDelegate: PanelMenuPage {
202− menuModel: __applicationMenus.model
203− submenuIndex: modelIndex
205− factory: ApplicationMenuItemFactory {
206− rootModel: __applicationMenus.model
210− enabled: !root.locked && model
211− opacity: !indicators.expanded ? 1 : 0
212− visible: opacity != 0
213− Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
215− onEnabledChanged: {
193+ sourceComponent: MenuBar {
216− if (!enabled) hide();
194+ id: bar
217− }
195+ height: menuBarLoader.height
218−
196+ enableKeyFilter: valid && PanelState.decorationsVisible
219− Binding {
197+ unityMenuModel: registeredMenuModel.model
220− target: fakeApplicationMenus
221− property: "expanded"
222− value: __applicationMenus.expanded
225 Connections {
199 Connections {
226− target: fakeApplicationMenus
200+ target: __applicationMenus
227− onHide: __applicationMenus.hide();
201+ onHide: bar.dismiss();
228− onShow: __applicationMenus.show();
232− ActiveCallHint {
206+ ActiveCallHint {
233− id: callHint
207+ id: callHint
234− objectName: "callHint"
208+ objectName: "callHint"
236− x: __applicationMenus.x + __applicationMenus.barWidth
237− height: parent.height
239− visible: active && (indicators.state == "initial" && __applicationMenus.state == "initial")
210+ anchors.centerIn: parent
240− greeterShown: root.greeterShown
211+ height: minimizedPanelHeight
243− Binding {
213+ visible: active && indicators.state == "initial"
244− target: __indicators
214+ greeterShown: root.greeterShown
245− property: "overFlowWidth"
247− var width = root.width;
248− if (callHint.visible) {
249− width -= callHint.width;
251− if (__applicationMenus.visible) {
252− width -= __applicationMenus.barWidth;
254− return Math.max(width, 0);
258− target: panelAreaBackground
260− value: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
263− target: __indicators
264− property: "enableHint"
265− value: !callHint.active && !__indicators.fullscreenMode
268− target: __indicators
269− property: "showOnClick"
270− value: !callHint.visible
273− target: __indicators
275− if (callHint.active) {
276− callHint.showLiveCall();
281− target: backMouseEater
284− when: __applicationMenus.fullyOpened
287− target: backMouseEater
288− onClicked: __applicationMenus.hide();
293− Component {
218+ PanelMenu {
294− id: windowedLeftPanelComponent
219+ id: __applicationMenus
296− MouseArea {
221+ model: registeredMenuModel.model
297− id: decorationMouseArea
222+ width: root.applicationMenuWidth
298− objectName: "windowControlArea"
223+ minimizedPanelHeight: root.minimizedPanelHeight
299− anchors {
224+ expandedPanelHeight: root.expandedPanelHeight
300− left: parent.left
225+ openedHeight: root.height
301− right: parent.right
226+ alignment: Qt.AlignLeft
302− }
227+ enableHint: !callHint.active && !fullscreenMode
303− height: minimizedPanelHeight
304− hoverEnabled: !__indicators.shown
305− onClicked: if (callHint.visible) { callHint.showLiveCall(); }
228+ showOnClick: !callHint.visible
229+ panelColor: panelAreaBackground.color
307− onPressed: {
231+ onShowTapped: {
308− if (!callHint.visible) {
232+ if (callHint.active) {
309− // let it fall through to the window decoration of the maximized window behind, if any
233+ callHint.showLiveCall();
310− mouse.accepted = false;
314− property bool showWindowControls: (PanelState.decorationsVisible && (containsMouse || menuBarLoader.menusRequested)) || PanelState.decorationsAlwaysVisible
237+ showRowTitle: !expanded
238+ rowTitle: PanelState.title
239+ rowItemDelegate: ActionItem {
241+ property int ownIndex: index
316− // WindowControlButtons inside the mouse area, otherwise QML doesn't grok nested hover events :/
243+ width: _title.width + units.gu(2)
317− // cf. https://bugreports.qt.io/browse/QTBUG-32909
244+ height: parent.height
318− WindowControlButtons {
319− id: windowControlButtons
320− objectName: "panelWindowControlButtons"
325− height: indicators.minimizedPanelHeight
326− opacity: decorationMouseArea.showWindowControls ? 1 : 0
327− visible: opacity != 0
328− Behavior on opacity { UbuntuNumberAnimation {} }
330− active: PanelState.decorationsVisible || PanelState.decorationsAlwaysVisible
331− windowIsMaximized: true
332− onCloseClicked: PanelState.closeClicked()
333− onMinimizeClicked: PanelState.minimizeClicked()
334− onMaximizeClicked: PanelState.restoreClicked()
335− closeButtonShown: PanelState.closeButtonShown
338− Loader {
246+ action: Action {
339− id: menuBarLoader
247+ text: model.label.replace("_", "&")
341− left: windowControlButtons.right
342− leftMargin: units.gu(3)
344− height: parent.height
345− opacity: windowControlButtons.opacity
346− visible: opacity != 0
347− active: fakeApplicationMenus.model
349− property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
351− sourceComponent: MenuBar {
353− height: menuBarLoader.height
354− enableKeyFilter: valid && PanelState.decorationsVisible
355− unityMenuModel: fakeApplicationMenus.model
358− target: fakeApplicationMenus
359− onHide: bar.dismiss();
365− id: titleLabel
251+ id: _title
366− objectName: "windowDecorationTitle"
367− anchors {
252+ anchors.centerIn: parent
368− left: parent.left
253+ text: actionItem.text
369− leftMargin: units.gu(1)
254+ horizontalAlignment: Text.AlignLeft
370− verticalCenter: parent.verticalCenter
372− color: "white"
255+ color: enabled ? "white" : "#5d5d5d"
373− opacity: !decorationMouseArea.showWindowControls ? 1 : 0
374− visible: opacity != 0
375− verticalAlignment: Text.AlignVCenter
377− font.weight: PanelState.decorationsVisible ? Font.Light : Font.Medium
378− text: PanelState.title
379− elide: Text.ElideRight
381− Behavior on opacity { UbuntuNumberAnimation {} }
384− ActiveCallHint {
259+ pageDelegate: PanelMenuPage {
385− id: callHint
260+ id: page
386− objectName: "callHint"
261+ menuModel: __applicationMenus.model
387−
262+ submenuIndex: modelIndex
388− anchors.centerIn: parent
389− height: minimizedPanelHeight
391− visible: active && indicators.state == "initial"
264+ factory: ApplicationMenuItemFactory {
392− greeterShown: root.greeterShown
265+ rootModel: __applicationMenus.model
395− Binding {
269+ enabled: !root.locked && model
396− target: panelAreaBackground
270+ opacity: !decorationMouseArea.showWindowControls && !indicators.expanded ? 1 : 0
397− property: "color"
271+ visible: opacity != 0
398− value: callHint.visible ? theme.palette.normal.positive : theme.palette.normal.background
272+ Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.SnapDuration } }
400− Binding {
274+ onEnabledChanged: {
401− target: __indicators
275+ if (!enabled) hide();
402− property: "enableHint"
403− value: !callHint.active && !__indicators.fullscreenMode
406− target: __indicators
407− property: "showOnClick"
408− value: !callHint.visible
411− target: __indicators
413− if (callHint.active) {
414− callHint.showLiveCall();
@@ -432,10 +290,16 @@ Item {
432 openedHeight: root.height
290 openedHeight: root.height
434 overFlowWidth: root.width
292 overFlowWidth: root.width
435− enableHint: !fullscreenMode
293+ enableHint: !callHint.active && !fullscreenMode
436− showOnClick: true
294+ showOnClick: !callHint.visible
437 panelColor: panelAreaBackground.color
295 panelColor: panelAreaBackground.color
298+ if (callHint.active) {
299+ callHint.showLiveCall();
439 rowItemDelegate: IndicatorItem {
303 rowItemDelegate: IndicatorItem {
440 id: indicatorItem
304 id: indicatorItem
441 objectName: identifier+"-panelItem"
305 objectName: identifier+"-panelItem"
@@ -492,10 +356,6 @@ Item {
492 onEnabledChanged: {
356 onEnabledChanged: {
493 if (!enabled) hide();
357 if (!enabled) hide();
496− target: backMouseEater
497− onClicked: __indicators.hide();
@@ -523,13 +383,21 @@ Item {
523 when: fullscreenMode
383 when: fullscreenMode
524 PropertyChanges {
384 PropertyChanges {
525 target: indicatorArea;
385 target: indicatorArea;
386+ anchors.topMargin: {
526− anchors.topMargin: indicators.state === "initial" ? - minimizedPanelHeight : 0
387+ if (indicators.state !== "initial") return 0;
388+ if (applicationMenus.state !== "initial") return 0;
389+ return -minimizedPanelHeight;
527− opacity: indicators.fullyClosed ? 0.0 : 1.0
391+ opacity: indicators.fullyClosed && applicationMenus.fullyClosed ? 0.0 : 1.0
529 PropertyChanges {
393 PropertyChanges {
530 target: indicators.showDragHandle;
394 target: indicators.showDragHandle;
531 anchors.bottomMargin: -units.gu(1)
395 anchors.bottomMargin: -units.gu(1)
398+ target: applicationMenus.showDragHandle;
399+ anchors.bottomMargin: -units.gu(1)