mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-03 02:52:07 -04:00
general fixes and audit
This commit is contained in:
@@ -23,7 +23,6 @@ Item {
|
||||
|
||||
property color fillColor: "transparent"
|
||||
|
||||
// ── Derived layout ──
|
||||
readonly property bool _horiz: barSide === "top" || barSide === "bottom"
|
||||
readonly property real _sc: Math.max(0, startConnectorRadius)
|
||||
readonly property real _ec: Math.max(0, endConnectorRadius)
|
||||
|
||||
@@ -75,6 +75,21 @@ Item {
|
||||
readonly property real barWidth: impl.item ? impl.item.barWidth : 0
|
||||
readonly property real barHeight: impl.item ? impl.item.barHeight : 0
|
||||
readonly property bool useConnectedBackend: SettingsData.connectedFrameModeActive && !!screen && SettingsData.isScreenInPreferences(screen, SettingsData.frameScreenPreferences)
|
||||
readonly property var _desiredBackend: useConnectedBackend ? connectedComp : standaloneComp
|
||||
property var _resolvedBackend: null
|
||||
|
||||
onUseConnectedBackendChanged: _maybeResolveBackend()
|
||||
Component.onCompleted: _resolvedBackend = _desiredBackend
|
||||
|
||||
// Defer Loader source-component swap until impl is fully closed; avoids
|
||||
// tearing down a popout mid-animation when frame mode is toggled.
|
||||
function _maybeResolveBackend() {
|
||||
if (_resolvedBackend === _desiredBackend)
|
||||
return;
|
||||
if (impl.item && (impl.item.shouldBeVisible || impl.item.isClosing))
|
||||
return;
|
||||
_resolvedBackend = _desiredBackend;
|
||||
}
|
||||
|
||||
function open() {
|
||||
if (impl.item)
|
||||
@@ -121,7 +136,7 @@ Item {
|
||||
Loader {
|
||||
id: impl
|
||||
active: root.screen !== null
|
||||
sourceComponent: root.useConnectedBackend ? connectedComp : standaloneComp
|
||||
sourceComponent: root._resolvedBackend
|
||||
onItemChanged: if (item)
|
||||
root._wireBackend(item)
|
||||
}
|
||||
@@ -207,6 +222,7 @@ Item {
|
||||
|
||||
function onPopoutClosed() {
|
||||
root.popoutClosed();
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
|
||||
function onBackgroundClicked() {
|
||||
|
||||
@@ -178,15 +178,40 @@ Item {
|
||||
setBarContext(pos, bottomGap);
|
||||
}
|
||||
|
||||
// Briefly forces backgroundWindow.updatesEnabled true while the surface
|
||||
// body changes, so the contentHoleRect mask carve-out commits to the
|
||||
// compositor — otherwise the input region stays stuck at the popup's
|
||||
// initial size and clicks in any newly-grown area dismiss the popup.
|
||||
// Cleared by the frameSwapped Connections below as soon as the dirty
|
||||
// frame ships, so the bg window goes back to skipping buffer updates.
|
||||
property bool _bgCommitWindow: false
|
||||
|
||||
function _setSurfaceGeometry(bodyX, bodyY, bodyW, bodyH) {
|
||||
_surfaceBodyX = Theme.snap(bodyX, dpr);
|
||||
_surfaceBodyY = Theme.snap(bodyY, dpr);
|
||||
_surfaceBodyW = Theme.snap(bodyW, dpr);
|
||||
_surfaceBodyH = Theme.snap(bodyH, dpr);
|
||||
const newX = Theme.snap(bodyX, dpr);
|
||||
const newY = Theme.snap(bodyY, dpr);
|
||||
const newW = Theme.snap(bodyW, dpr);
|
||||
const newH = Theme.snap(bodyH, dpr);
|
||||
const changed = newX !== _surfaceBodyX || newY !== _surfaceBodyY || newW !== _surfaceBodyW || newH !== _surfaceBodyH;
|
||||
_surfaceBodyX = newX;
|
||||
_surfaceBodyY = newY;
|
||||
_surfaceBodyW = newW;
|
||||
_surfaceBodyH = newH;
|
||||
_surfaceMarginLeft = _surfaceBodyX - shadowBuffer;
|
||||
_surfaceMarginTop = _surfaceBodyY - shadowBuffer;
|
||||
_surfaceW = _surfaceBodyW + shadowBuffer * 2;
|
||||
_surfaceH = _surfaceBodyH + shadowBuffer * 2;
|
||||
if (changed && backgroundWindow.visible) {
|
||||
_bgCommitWindow = true;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: backgroundWindow
|
||||
ignoreUnknownSignals: true
|
||||
function onFrameSwapped() {
|
||||
if (root._bgCommitWindow)
|
||||
root._bgCommitWindow = false;
|
||||
}
|
||||
}
|
||||
|
||||
function _setSettledSurfaceGeometry() {
|
||||
@@ -455,9 +480,10 @@ Item {
|
||||
screen: root.screen
|
||||
visible: false
|
||||
color: "transparent"
|
||||
// When there's no overlay to render, skip buffer updates. Re-evaluates if
|
||||
// overlayContent is assigned later (e.g., via a dispatcher forwarding it).
|
||||
updatesEnabled: root.overlayContent !== null
|
||||
// Skip buffer updates when there's nothing to render. Briefly flipped
|
||||
// true via _bgCommitWindow when _surfaceBodyW/H changes so the
|
||||
// contentHoleRect mask carve-out actually commits to the compositor.
|
||||
updatesEnabled: root.overlayContent !== null || root._bgCommitWindow
|
||||
|
||||
WlrLayershell.namespace: root.layerNamespace + ":background"
|
||||
WlrLayershell.layer: WlrLayershell.Top
|
||||
|
||||
Reference in New Issue
Block a user