1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

popout: fix lifecycle of blur with various popouts

fixes #2901
port 1.5

(cherry picked from commit 93c3030a1e)
This commit is contained in:
bbedward
2026-07-21 17:45:54 -04:00
committed by dms-ci[bot]
parent 00c28f69fd
commit accdd0972c
5 changed files with 43 additions and 12 deletions
+21 -2
View File
@@ -65,16 +65,35 @@ Singleton {
function _openPopout(popout) { function _openPopout(popout) {
if (popout.dashVisible !== undefined) { if (popout.dashVisible !== undefined) {
if (popout.dashVisible && !popout.shouldBeVisible && !popout.isClosing) let flagStayedTrue = popout.dashVisible === true;
if (popout.dashVisible && !popout.shouldBeVisible && !popout.isClosing) {
popout.dashVisible = false; popout.dashVisible = false;
flagStayedTrue = false;
}
popout.dashVisible = true; popout.dashVisible = true;
// Flag already true (e.g. retargeting to another monitor) won't re-fire
// the change handler, so drive the surface open explicitly.
if (flagStayedTrue)
_ensureSurfaceOpen(popout);
return; return;
} }
if (popout.notificationHistoryVisible !== undefined) { if (popout.notificationHistoryVisible !== undefined) {
const flagStayedTrue = popout.notificationHistoryVisible === true;
popout.notificationHistoryVisible = true; popout.notificationHistoryVisible = true;
if (flagStayedTrue)
_ensureSurfaceOpen(popout);
return; return;
} }
popout.open(); _ensureSurfaceOpen(popout);
}
function _ensureSurfaceOpen(popout) {
if (typeof popout.present === "function") {
popout.present();
return;
}
if (typeof popout.open === "function")
popout.open();
} }
function _closePopout(popout) { function _closePopout(popout) {
@@ -77,6 +77,12 @@ DankPopout {
readonly property color _containerBg: Theme.nestedSurface readonly property color _containerBg: Theme.nestedSurface
// Defer open one tick so screen-change geometry settles before the surface
// maps; a synchronous open churns the surface and loses the blur on a switch.
function present() {
Qt.callLater(open);
}
function openWithSection(section) { function openWithSection(section) {
StateUtils.openWithSection(root, section); StateUtils.openWithSection(root, section);
} }
@@ -63,8 +63,8 @@ BasePill {
anchors.fill: parent anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton acceptedButtons: Qt.LeftButton | Qt.RightButton
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onPressed: mouse => root.triggerRipple(this, mouse.x, mouse.y) onPressed: function (mouse) {
onClicked: function (mouse) { root.triggerRipple(this, mouse.x, mouse.y);
switch (mouse.button) { switch (mouse.button) {
case Qt.RightButton: case Qt.RightButton:
openContextMenu(); openContextMenu();
@@ -61,6 +61,11 @@ DankPopout {
notificationHistoryVisible = !notificationHistoryVisible; notificationHistoryVisible = !notificationHistoryVisible;
} }
// Re-open without toggling the flag (used when retargeting to another monitor).
function present() {
openSized();
}
function openSized() { function openSized() {
if (!notificationHistoryVisible) if (!notificationHistoryVisible)
return; return;
+9 -8
View File
@@ -79,6 +79,9 @@ Item {
"rightBar": 0 "rightBar": 0
}) })
property var screen: null property var screen: null
// Output the surface binds to; retargeted only in open() while hidden. A live
// screen change on a mapped surface loses the popup blur on niri.
property var surfaceScreen: null
readonly property bool frameGapStandaloneActive: CompositorService.frameConfiguredForScreen(screen) && !CompositorService.usesConnectedFrameChromeForScreen(screen) readonly property bool frameGapStandaloneActive: CompositorService.frameConfiguredForScreen(screen) && !CompositorService.usesConnectedFrameChromeForScreen(screen)
readonly property bool fluidStandaloneActive: Theme.isDirectionalEffect readonly property bool fluidStandaloneActive: Theme.isDirectionalEffect
readonly property bool backgroundDismissWindowRequired: backgroundInteractive readonly property bool backgroundDismissWindowRequired: backgroundInteractive
@@ -133,8 +136,6 @@ Item {
signal popoutClosed signal popoutClosed
signal backgroundClicked signal backgroundClicked
property var _lastOpenedScreen: null
property int effectiveBarPosition: 0 property int effectiveBarPosition: 0
property real effectiveBarBottomGap: 0 property real effectiveBarBottomGap: 0
readonly property string autoBarShadowDirection: { readonly property string autoBarShadowDirection: {
@@ -338,14 +339,14 @@ Item {
_frozenMaskWidth = maskWidth; _frozenMaskWidth = maskWidth;
_frozenMaskHeight = maskHeight; _frozenMaskHeight = maskHeight;
const screenChanged = _lastOpenedScreen !== null && _lastOpenedScreen !== screen; const screenChanged = surfaceScreen !== null && surfaceScreen !== screen;
if (screenChanged) { if (screenChanged) {
// Hide on this tick so Qt actually tears down the wl_surface; the show // Unmap before retargeting so the surface is destroyed and recreated
// gets deferred below so the unmap is processed before the remap. // on the new output rather than live-migrated.
contentWindow.visible = false; contentWindow.visible = false;
backgroundWindow.visible = false; backgroundWindow.visible = false;
} }
_lastOpenedScreen = screen; surfaceScreen = screen;
if (contentContainer && !shouldBeVisible) { if (contentContainer && !shouldBeVisible) {
// Snap morph closed only on a fresh open; on screen-change re-open we stay at 1 // Snap morph closed only on a fresh open; on screen-change re-open we stay at 1
@@ -559,7 +560,7 @@ Item {
PanelWindow { PanelWindow {
id: backgroundWindow id: backgroundWindow
screen: root.screen screen: root.surfaceScreen
visible: false visible: false
color: "transparent" color: "transparent"
// Skip buffer updates when there's nothing to render. Briefly flipped // Skip buffer updates when there's nothing to render. Briefly flipped
@@ -625,7 +626,7 @@ Item {
PanelWindow { PanelWindow {
id: contentWindow id: contentWindow
screen: root.screen screen: root.surfaceScreen
visible: false visible: false
color: "transparent" color: "transparent"
readonly property bool closeVisualActive: root.shouldBeVisible || root.isClosing readonly property bool closeVisualActive: root.shouldBeVisible || root.isClosing