on xenial help sign in
make both the menu and window unsnapping work in panel \o/
commitd1e6e8e1c83d7d38b74106ac68c0ee38f275d255 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateMon 13 Mar 2017, 19:28 (10 years ago) parent3d09aed
2 files changed+11−2
qml/ApplicationMenus/MenuBar.qml+5 qml/Panel/Panel.qml+6−2
qml/ApplicationMenus/MenuBar.qml+5
@@ -52,6 +52,10 @@ Item {
5252 d.dismissAll();
5353 }
5454
55+ function invokeMenu(mouseEvent) {
56+ mouseArea.onClicked(mouseEvent);
57+ }
58+
5559 GlobalShortcut {
5660 shortcut: Qt.Key_Alt|Qt.AltModifier
5761 active: enableKeyFilter
@@ -226,6 +230,7 @@ Item {
226230 } // Row
227231
228232 MouseArea {
233+ id: mouseArea
229234 anchors.fill: parent
230235 hoverEnabled: d.currentItem
231236
qml/Panel/Panel.qml+6−2
@@ -176,6 +176,10 @@ Item {
176176 // let it fall through to the window decoration of the maximized window behind, if any
177177 mouse.accepted = false;
178178 }
179+ var menubar = menuBarLoader.item;
180+ if (menubar) {
181+ menubar.invokeMenu(mouse);
182+ }
179183 }
180184
181185 Row {
@@ -212,7 +216,7 @@ Item {
212216
213217 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
214218
215− property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
219+ readonly property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
216220
217221 sourceComponent: MenuBar {
218222 id: bar
@@ -234,7 +238,7 @@ Item {
234238 }
235239
236240 onDoubleClicked: PanelState.restoreClicked()
237− onPressed: decorationMouseArea.onPressed(mouse)
241+ onPressed: mouse.accepted = false // let the parent mouse area handle this, so it can both unsnap window and show menu
238242 }
239243 }
240244 }