npopupcontextmenu: smart positioning?

This commit is contained in:
Lemmy
2026-01-29 21:43:20 -05:00
parent 6839528022
commit c36617a740
4 changed files with 77 additions and 31 deletions
+3 -2
View File
@@ -64,7 +64,8 @@ Singleton {
}
// Show a context menu with proper handling for all compositors
function showContextMenu(contextMenu, anchorItem, screen) {
// Optional targetItem: if provided, menu will be horizontally centered on this item instead of anchorItem
function showContextMenu(contextMenu, anchorItem, screen, targetItem) {
if (!contextMenu || !anchorItem)
return;
@@ -74,7 +75,7 @@ Singleton {
var popupMenuWindow = getPopupMenuWindow(screen);
if (popupMenuWindow) {
popupMenuWindow.showContextMenu(contextMenu);
contextMenu.openAtItem(anchorItem, screen);
contextMenu.openAtItem(anchorItem, screen, targetItem);
}
}