1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-04 21:02:06 -04:00

window: freeze mask geometry in popout

This commit is contained in:
bbedward
2026-02-02 16:29:59 -05:00
parent eaa6a664c8
commit a97409dfd7
3 changed files with 32 additions and 14 deletions

View File

@@ -50,7 +50,7 @@ Item {
Connections { Connections {
target: AppSearchService target: AppSearchService
function onCacheInvalidated() { function onCacheVersionChanged() {
_clearModeCache(); _clearModeCache();
} }
} }

View File

@@ -32,7 +32,7 @@ DankPopout {
} }
popupWidth: 400 popupWidth: 400
popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 400 popupHeight: contentLoader.item ? contentLoader.item.implicitHeight : 0
triggerWidth: 70 triggerWidth: 70
positioning: "" positioning: ""
screen: triggerScreen screen: triggerScreen

View File

@@ -74,6 +74,12 @@ Item {
property int effectiveBarPosition: 0 property int effectiveBarPosition: 0
property real effectiveBarBottomGap: 0 property real effectiveBarBottomGap: 0
// Snapshot mask geometry to prevent background damage on bar updates
property real _frozenMaskX: 0
property real _frozenMaskY: 0
property real _frozenMaskWidth: 0
property real _frozenMaskHeight: 0
function setBarContext(position, bottomGap) { function setBarContext(position, bottomGap) {
effectiveBarPosition = position !== undefined ? position : 0; effectiveBarPosition = position !== undefined ? position : 0;
effectiveBarBottomGap = bottomGap !== undefined ? bottomGap : 0; effectiveBarBottomGap = bottomGap !== undefined ? bottomGap : 0;
@@ -104,6 +110,12 @@ Item {
return; return;
closeTimer.stop(); closeTimer.stop();
// Snapshot mask geometry
_frozenMaskX = maskX;
_frozenMaskY = maskY;
_frozenMaskWidth = maskWidth;
_frozenMaskHeight = maskHeight;
if (_lastOpenedScreen !== null && _lastOpenedScreen !== screen) { if (_lastOpenedScreen !== null && _lastOpenedScreen !== screen) {
contentWindow.visible = false; contentWindow.visible = false;
if (useBackgroundWindow) if (useBackgroundWindow)
@@ -236,24 +248,30 @@ Item {
} }
mask: Region { mask: Region {
item: Rectangle { item: maskRect
x: root.maskX }
y: root.maskY
width: (shouldBeVisible && backgroundInteractive) ? root.maskWidth : 0 Rectangle {
height: (shouldBeVisible && backgroundInteractive) ? root.maskHeight : 0 id: maskRect
} visible: false
color: "transparent"
x: root._frozenMaskX
y: root._frozenMaskY
width: (shouldBeVisible && backgroundInteractive) ? root._frozenMaskWidth : 0
height: (shouldBeVisible && backgroundInteractive) ? root._frozenMaskHeight : 0
} }
MouseArea { MouseArea {
x: root.maskX x: root._frozenMaskX
y: root.maskY y: root._frozenMaskY
width: root.maskWidth width: root._frozenMaskWidth
height: root.maskHeight height: root._frozenMaskHeight
hoverEnabled: false
enabled: shouldBeVisible && backgroundInteractive enabled: shouldBeVisible && backgroundInteractive
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: mouse => { onClicked: mouse => {
const clickX = mouse.x + root.maskX; const clickX = mouse.x + root._frozenMaskX;
const clickY = mouse.y + root.maskY; const clickY = mouse.y + root._frozenMaskY;
const outsideContent = clickX < root.alignedX || clickX > root.alignedX + root.alignedWidth || clickY < root.alignedY || clickY > root.alignedY + root.alignedHeight; const outsideContent = clickX < root.alignedX || clickX > root.alignedX + root.alignedWidth || clickY < root.alignedY || clickY > root.alignedY + root.alignedHeight;
if (!outsideContent) if (!outsideContent)