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
|
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 (y + menuHeight > screenHeight - 20) {
|
if (finalY + menuHeight > parentHeight) {
|
||||||
finalY = y - menuHeight;
|
finalY = Math.max(0, parentHeight - menuHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processContextMenu.x = Math.max(20, finalX);
|
processContextMenu.x = finalX;
|
||||||
processContextMenu.y = Math.max(20, finalY);
|
processContextMenu.y = finalY;
|
||||||
open();
|
open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user