on xenial help sign in
make both the menu and window unsnapping work in panel \o/
d1e6e8eLukáš Tinkl
qml/ApplicationMenus/MenuBar.qml+5
@@ -52,6 +52,10 @@ Item {
52 d.dismissAll();
52 d.dismissAll();
53 }
53 }
54
54
55+ function invokeMenu(mouseEvent) {
56+ mouseArea.onClicked(mouseEvent);
57+ }
58+
55 GlobalShortcut {
59 GlobalShortcut {
56 shortcut: Qt.Key_Alt|Qt.AltModifier
60 shortcut: Qt.Key_Alt|Qt.AltModifier
57 active: enableKeyFilter
61 active: enableKeyFilter
@@ -226,6 +230,7 @@ Item {
226 } // Row
230 } // Row
227
231
228 MouseArea {
232 MouseArea {
233+ id: mouseArea
229 anchors.fill: parent
234 anchors.fill: parent
230 hoverEnabled: d.currentItem
235 hoverEnabled: d.currentItem
231
236
qml/Panel/Panel.qml+6−2
@@ -176,6 +176,10 @@ Item {
176 // let it fall through to the window decoration of the maximized window behind, if any
176 // let it fall through to the window decoration of the maximized window behind, if any
177 mouse.accepted = false;
177 mouse.accepted = false;
178 }
178 }
179+ var menubar = menuBarLoader.item;
180+ if (menubar) {
181+ menubar.invokeMenu(mouse);
182+ }
179 }
183 }
180
184
181 Row {
185 Row {
@@ -212,7 +216,7 @@ Item {
212
216
213 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
217 width: parent.width - windowControlButtons.width - units.gu(2) - __indicators.barWidth
214
218
215− property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
219+ readonly property bool menusRequested: menuBarLoader.item ? menuBarLoader.item.showRequested : false
216
220
217 sourceComponent: MenuBar {
221 sourceComponent: MenuBar {
218 id: bar
222 id: bar
@@ -234,7 +238,7 @@ Item {
234 }
238 }
235
239
236 onDoubleClicked: PanelState.restoreClicked()
240 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
238 }
242 }
239 }
243 }
240 }
244 }