on xenial help sign in
don't show the menu popup at all when dragging window
commite3f079bd66b345271a8f874fc228b533e0985d8c authorLukáš Tinkl <lukas.tinkl@canonical.com> dateSun 26 Feb 2017, 02:33 (10 years ago) parent1ac2236
3 files changed+27−6
qml/ApplicationMenus/MenuBar.qml+24−5 qml/Stage/DecoratedWindow.qml+1−1 qml/Stage/WindowDecoration.qml+2
qml/ApplicationMenus/MenuBar.qml+24−5
@@ -28,6 +28,7 @@ Item {
2828 property alias unityMenuModel: rowRepeater.model
2929 property bool enableKeyFilter: false
3030 property real overflowWidth: width
31+ property bool windowMoving: false
3132
3233 // read from outside
3334 readonly property bool valid: rowRepeater.count > 0
@@ -44,6 +45,12 @@ Item {
4445 d.dismissAll();
4546 }
4647
48+ onWindowMovingChanged: {
49+ if (windowMoving) {
50+ dismiss();
51+ }
52+ }
53+
4754 GlobalShortcut {
4855 shortcut: Qt.Key_Alt|Qt.AltModifier
4956 active: enableKeyFilter
@@ -217,9 +224,23 @@ Item {
217224 } // Row
218225
219226 MouseArea {
227+ id: mouseArea
220228 anchors.fill: row
221229 hoverEnabled: d.currentItem
222230
231+ Timer {
232+ id: delayedPopupTimer
233+ interval: 100
234+ onTriggered: {
235+ if (root.windowMoving) return;
236+ var prevItem = d.currentItem;
237+ mouseArea.updateCurrentItemFromPosition(Qt.point(mouseArea.mouseX, mouseArea.mouseY));
238+ if (prevItem && d.currentItem == prevItem) {
239+ prevItem.hide();
240+ }
241+ }
242+ }
243+
223244 onEntered: {
224245 if (d.currentItem) {
225246 updateCurrentItemFromPosition(Qt.point(mouseX, mouseY))
@@ -229,13 +250,11 @@ Item {
229250 if (d.currentItem) {
230251 updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))
231252 }
232− mouse.accepted = false;
233253 }
254+
234255 onPressed: {
235− var prevItem = d.currentItem;
236− updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))
237− if (prevItem && d.currentItem == prevItem) {
238− prevItem.hide();
256+ if (containsPress && !root.windowMoving) {
257+ delayedPopupTimer.start();
239258 }
240259 mouse.accepted = false;
241260 }
qml/Stage/DecoratedWindow.qml+1−1
@@ -204,6 +204,7 @@ FocusScope {
204204 height: units.gu(3)
205205
206206 title: applicationWindow.title
207+ windowMoving: moveHandler.moving
207208
208209 opacity: root.hasDecoration ? Math.min(1, root.showDecoration) : 0
209210 Behavior on opacity { UbuntuNumberAnimation { } }
@@ -225,7 +226,6 @@ FocusScope {
225226 enableMenus: {
226227 return active &&
227228 surface &&
228− !moveHandler.moving &&
229229 (PanelState.focusedPersistentSurfaceId === surface.persistentId && !PanelState.decorationsVisible)
230230 }
231231 menu: sharedAppModel.model
qml/Stage/WindowDecoration.qml+2
@@ -33,6 +33,7 @@ MouseArea {
3333 property alias overlayShown: buttons.overlayShown
3434 property var menu: undefined
3535 property bool enableMenus: true
36+ property bool windowMoving: false
3637
3738 readonly property real buttonsWidth: buttons.width + row.spacing
3839
@@ -142,6 +143,7 @@ MouseArea {
142143 height: menuBarLoader.height
143144 enableKeyFilter: valid && root.active && root.enableMenus
144145 unityMenuModel: root.menu
146+ windowMoving: root.windowMoving
145147 }
146148
147149 opacity: !overlayShown && priv.shouldShowMenus ? 1 : 0