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:
@@ -12,26 +12,26 @@ Popup {
|
||||
property var processData: null
|
||||
|
||||
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 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 (y + menuHeight > screenHeight - 20) {
|
||||
finalY = y - menuHeight;
|
||||
if (finalY + menuHeight > parentHeight) {
|
||||
finalY = Math.max(0, parentHeight - menuHeight);
|
||||
}
|
||||
}
|
||||
|
||||
processContextMenu.x = Math.max(20, finalX);
|
||||
processContextMenu.y = Math.max(20, finalY);
|
||||
processContextMenu.x = finalX;
|
||||
processContextMenu.y = finalY;
|
||||
open();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,12 @@ DankPopout {
|
||||
screen: triggerScreen
|
||||
shouldBeVisible: false
|
||||
|
||||
onBackgroundClicked: close()
|
||||
onBackgroundClicked: {
|
||||
if (processContextMenu.visible) {
|
||||
processContextMenu.close();
|
||||
}
|
||||
close();
|
||||
}
|
||||
|
||||
Ref {
|
||||
service: DgopService
|
||||
@@ -63,6 +68,7 @@ DankPopout {
|
||||
if (processListPopout.shouldBeVisible) {
|
||||
forceActiveFocus();
|
||||
}
|
||||
processContextMenu.parent = processListContent;
|
||||
}
|
||||
Keys.onPressed: (event) => {
|
||||
if (event.key === Qt.Key_Escape) {
|
||||
|
||||
Reference in New Issue
Block a user