1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-05 04:58:30 -04:00

fix(tray): don't dismiss click-opened tray menus from hover controller (#2979)

closeHoverSurfaces() called TrayMenuManager.closeAllMenus(), tearing down
every registered tray menu including ones opened by right-click. With
hoverPopouts enabled, moving the pointer after a right-click re-ran the
hit test and closed the menu before it could be reached.

Tag each menu with how it was opened and add closeHoverMenus(), which
only closes hover-opened menus. The hover controller now uses that.

Click-driven callers pass no argument, so byHover stays undefined and
`byHover === true` evaluates to false.

Fixes #2978


Claude-Session: https://claude.ai/code/session_01DYF9vdsaToU4Usu7kxPCNB

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Thomas Kroll
2026-08-05 01:25:22 +00:00
committed by GitHub
parent 80b27b9a6a
commit 34626070af
3 changed files with 19 additions and 5 deletions
+12
View File
@@ -22,6 +22,18 @@ Singleton {
activeTrayMenus = newMenus
}
function closeHoverMenus() {
for (const screenName in activeTrayMenus) {
const menu = activeTrayMenus[screenName]
if (!menu || menu.openedByHover !== true) continue
if (typeof menu.close === "function") {
menu.close()
} else if (menu.showMenu !== undefined) {
menu.showMenu = false
}
}
}
function closeAllMenus() {
for (const screenName in activeTrayMenus) {
const menu = activeTrayMenus[screenName]
@@ -609,7 +609,7 @@ Item {
_closeHoverNotepad();
activeHoverTrigger = "";
PopoutManager.dismissHoverPopoutForScreen(barWindow?.screen);
TrayMenuManager.closeAllMenus();
TrayMenuManager.closeHoverMenus();
}
function _beginSupersededCloseForActive() {
@@ -1484,6 +1484,7 @@ BasePill {
property bool isVertical: false
property var axis: null
property bool showMenu: false
property bool openedByHover: false
property var menuHandle: null
ListModel {
@@ -1493,7 +1494,8 @@ BasePill {
return entryStack.count ? entryStack.get(entryStack.count - 1).handle : null;
}
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj, byHover) {
openedByHover = byHover === true;
trayItem = item;
anchorItem = anchor;
parentScreen = screen;
@@ -2084,7 +2086,7 @@ BasePill {
}
}
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj) {
function showForTrayItem(item, anchor, screen, atBottom, vertical, axisObj, byHover) {
if (!screen)
return;
if (currentTrayMenu) {
@@ -2099,7 +2101,7 @@ BasePill {
currentTrayMenu = trayMenuComponent.createObject(null);
if (!currentTrayMenu)
return;
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj);
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj, byHover === true);
}
function _trayLayoutRoot() {
@@ -2147,7 +2149,7 @@ BasePill {
if (!hit?.trayItem?.hasMenu)
return false;
const anchor = hit.children?.length > 0 ? hit.children[0] : hit;
showForTrayItem(hit.trayItem, anchor, parentScreen, isAtBottom, isVerticalOrientation, axis);
showForTrayItem(hit.trayItem, anchor, parentScreen, isAtBottom, isVerticalOrientation, axis, true);
return true;
}
}