diff --git a/panels/dock/taskmanager/package/AppItem.qml b/panels/dock/taskmanager/package/AppItem.qml index 7132ed2f1..864bdfd28 100644 --- a/panels/dock/taskmanager/package/AppItem.qml +++ b/panels/dock/taskmanager/package/AppItem.qml @@ -78,6 +78,7 @@ Item { property bool enableTitle: false property bool titleActive: enableTitle && titleLoader.active property bool preservePanelPopupOnContextMenu: false + property var contextMenuGuard: null property bool updateIconGeometry: true property Item previewAnchor: icon // Folder content replaces the overflow popup, so anchor it to the dock. @@ -504,6 +505,10 @@ Item { property bool trashEmpty: true sourceComponent: LP.Menu { id: contextMenu + onAboutToHide: Qt.callLater(function() { + if (MenuHelper.activeMenu === null && root.contextMenuGuard) + root.contextMenuGuard(false) + }) Instantiator { id: menuItemInstantiator model: JSON.parse(menus) @@ -596,6 +601,8 @@ Item { } function requestAppItemMenu() { + if (root.contextMenuGuard) + root.contextMenuGuard(true) if (!root.preservePanelPopupOnContextMenu) { Panel.requestClosePopup() } diff --git a/panels/dock/taskmanager/package/TaskOverflowButton.qml b/panels/dock/taskmanager/package/TaskOverflowButton.qml index 3ee28275b..389eed8b1 100644 --- a/panels/dock/taskmanager/package/TaskOverflowButton.qml +++ b/panels/dock/taskmanager/package/TaskOverflowButton.qml @@ -45,6 +45,7 @@ Item { readonly property int popupColumns: Math.min(6, Math.max(1, overflowCount), Math.max(1, Math.floor((popupAvailableWidth - 20) / popupCellWidth))) property point popupAnchorPoint: Qt.point(0, 0) + property bool contextMenuActive: false visible: overflowCount > 0 && overflow.buttonExtent > 0 x: root.taskManagerItem.useColumnLayout ? 0 : root.buttonOffset @@ -136,6 +137,10 @@ Item { overflowPopup.open() } + function guardContextMenu(active) { + contextMenuActive = active + } + AppItemBackground { width: root.hoverBackgroundWidth height: root.hoverBackgroundHeight @@ -220,7 +225,8 @@ Item { contentReady: popupContentLoader.status === Loader.Ready popupX: DockPanelPositioner.x popupY: DockPanelPositioner.y - closeOnInactive: MenuHelper.activeMenu === null && !Panel.contextDragging + closeOnInactive: !root.contextMenuActive + && MenuHelper.activeMenu === null && !Panel.contextDragging Component.onCompleted: { DockPanelPositioner.bounding = Qt.binding(function () { @@ -307,6 +313,7 @@ Item { title: popupDelegate.entry.title enableTitle: false preservePanelPopupOnContextMenu: true + contextMenuGuard: root.guardContextMenu previewAnchor: overflowPopupContent folderAnchor: root updateIconGeometry: false