mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-06 13:38:28 -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>
(cherry picked from commit 34626070af)
This commit is contained in:
@@ -22,6 +22,18 @@ Singleton {
|
|||||||
activeTrayMenus = newMenus
|
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() {
|
function closeAllMenus() {
|
||||||
for (const screenName in activeTrayMenus) {
|
for (const screenName in activeTrayMenus) {
|
||||||
const menu = activeTrayMenus[screenName]
|
const menu = activeTrayMenus[screenName]
|
||||||
|
|||||||
@@ -609,7 +609,7 @@ Item {
|
|||||||
_closeHoverNotepad();
|
_closeHoverNotepad();
|
||||||
activeHoverTrigger = "";
|
activeHoverTrigger = "";
|
||||||
PopoutManager.dismissHoverPopoutForScreen(barWindow?.screen);
|
PopoutManager.dismissHoverPopoutForScreen(barWindow?.screen);
|
||||||
TrayMenuManager.closeAllMenus();
|
TrayMenuManager.closeHoverMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _beginSupersededCloseForActive() {
|
function _beginSupersededCloseForActive() {
|
||||||
|
|||||||
@@ -1484,6 +1484,7 @@ BasePill {
|
|||||||
property bool isVertical: false
|
property bool isVertical: false
|
||||||
property var axis: null
|
property var axis: null
|
||||||
property bool showMenu: false
|
property bool showMenu: false
|
||||||
|
property bool openedByHover: false
|
||||||
property var menuHandle: null
|
property var menuHandle: null
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
@@ -1493,7 +1494,8 @@ BasePill {
|
|||||||
return entryStack.count ? entryStack.get(entryStack.count - 1).handle : null;
|
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;
|
trayItem = item;
|
||||||
anchorItem = anchor;
|
anchorItem = anchor;
|
||||||
parentScreen = screen;
|
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)
|
if (!screen)
|
||||||
return;
|
return;
|
||||||
if (currentTrayMenu) {
|
if (currentTrayMenu) {
|
||||||
@@ -2099,7 +2101,7 @@ BasePill {
|
|||||||
currentTrayMenu = trayMenuComponent.createObject(null);
|
currentTrayMenu = trayMenuComponent.createObject(null);
|
||||||
if (!currentTrayMenu)
|
if (!currentTrayMenu)
|
||||||
return;
|
return;
|
||||||
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj);
|
currentTrayMenu.showForTrayItem(item, anchor, screen, atBottom, vertical ?? false, axisObj, byHover === true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _trayLayoutRoot() {
|
function _trayLayoutRoot() {
|
||||||
@@ -2147,7 +2149,7 @@ BasePill {
|
|||||||
if (!hit?.trayItem?.hasMenu)
|
if (!hit?.trayItem?.hasMenu)
|
||||||
return false;
|
return false;
|
||||||
const anchor = hit.children?.length > 0 ? hit.children[0] : hit;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user