1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

Fix ProcessList context menu visibility in DankPopout (#857)

This commit is contained in:
xdenotte
2025-11-30 17:21:15 +01:00
committed by GitHub
parent b2cf20f3d8
commit cbd1fd908c
2 changed files with 23 additions and 17 deletions

View File

@@ -12,26 +12,26 @@ Popup {
property var processData: null property var processData: null
function show(x, y) { function show(x, y) {
if (!processContextMenu.parent && typeof Overlay !== "undefined" && Overlay.overlay) {
processContextMenu.parent = Overlay.overlay;
}
const menuWidth = 180;
const menuHeight = menuColumn.implicitHeight + Theme.spacingS * 2;
const screenWidth = Screen.width;
const screenHeight = Screen.height;
let finalX = x; let finalX = x;
let finalY = y; let finalY = y;
if (x + menuWidth > screenWidth - 20) {
finalX = x - menuWidth; if (processContextMenu.parent) {
const parentWidth = processContextMenu.parent.width;
const parentHeight = processContextMenu.parent.height;
const menuWidth = processContextMenu.width;
const menuHeight = processContextMenu.height;
if (finalX + menuWidth > parentWidth) {
finalX = Math.max(0, parentWidth - menuWidth);
}
if (finalY + menuHeight > parentHeight) {
finalY = Math.max(0, parentHeight - menuHeight);
}
} }
if (y + menuHeight > screenHeight - 20) { processContextMenu.x = finalX;
finalY = y - menuHeight; processContextMenu.y = finalY;
}
processContextMenu.x = Math.max(20, finalX);
processContextMenu.y = Math.max(20, finalY);
open(); open();
} }

View File

@@ -37,7 +37,12 @@ DankPopout {
screen: triggerScreen screen: triggerScreen
shouldBeVisible: false shouldBeVisible: false
onBackgroundClicked: close() onBackgroundClicked: {
if (processContextMenu.visible) {
processContextMenu.close();
}
close();
}
Ref { Ref {
service: DgopService service: DgopService
@@ -63,6 +68,7 @@ DankPopout {
if (processListPopout.shouldBeVisible) { if (processListPopout.shouldBeVisible) {
forceActiveFocus(); forceActiveFocus();
} }
processContextMenu.parent = processListContent;
} }
Keys.onPressed: (event) => { Keys.onPressed: (event) => {
if (event.key === Qt.Key_Escape) { if (event.key === Qt.Key_Escape) {