Prevent disappearing wallpaper
This commit is contained in:
@@ -183,41 +183,14 @@ Item {
|
|||||||
visible: true
|
visible: true
|
||||||
anchors { top: true; bottom: true; left: true; right: true }
|
anchors { top: true; bottom: true; left: true; right: true }
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
// The wallpaper is static outside of image loads/transitions. Disabling
|
// Keep render updates enabled. The background layer has been observed to
|
||||||
// render updates keeps animations in other shell windows from repainting
|
// lose its committed buffer while parked with updatesEnabled=false,
|
||||||
// this background layer and wasting GPU cycles.
|
// leaving a black desktop until omarchy-shell is restarted. The wallpaper
|
||||||
updatesEnabled: frozenBackgroundVersion !== root.backgroundVersion
|
// itself is static, so this favors correctness over a small render-loop
|
||||||
|| root.incomingBackground !== ""
|
// optimization.
|
||||||
|| root.finishingTransition
|
updatesEnabled: true
|
||||||
|| root.revealProgress < 1
|
|
||||||
|| base.status === Image.Loading
|
|
||||||
|| oldFrame.status === Image.Loading
|
|
||||||
|| incomingFrame.status === Image.Loading
|
|
||||||
|
|
||||||
property bool maskReady: false
|
property bool maskReady: false
|
||||||
property int frozenBackgroundVersion: -1
|
|
||||||
|
|
||||||
function backgroundIsStable() {
|
|
||||||
// Don't freeze before the wallpaper has actually painted at least
|
|
||||||
// once. base.status === Image.Null on startup (empty source) reports
|
|
||||||
// "stable" but the surface hasn't committed a frame yet — freezing
|
|
||||||
// there leaves the wallpaper invisible until something else forces a
|
|
||||||
// repaint.
|
|
||||||
return base.status === Image.Ready
|
|
||||||
&& !root.incomingBackground
|
|
||||||
&& !root.finishingTransition
|
|
||||||
&& root.revealProgress >= 1
|
|
||||||
&& oldFrame.status !== Image.Loading
|
|
||||||
&& incomingFrame.status !== Image.Loading
|
|
||||||
}
|
|
||||||
|
|
||||||
function scheduleUpdatesFreeze() {
|
|
||||||
if (!backgroundIsStable()) {
|
|
||||||
freezeUpdatesTimer.stop()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
freezeUpdatesTimer.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
function maybeStartReveal() {
|
function maybeStartReveal() {
|
||||||
if (!root.incomingBackground || root.revealProgress !== 0 || maskReady) return
|
if (!root.incomingBackground || root.revealProgress !== 0 || maskReady) return
|
||||||
@@ -234,15 +207,6 @@ Item {
|
|||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||||
exclusionMode: ExclusionMode.Ignore
|
exclusionMode: ExclusionMode.Ignore
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: freezeUpdatesTimer
|
|
||||||
interval: 100
|
|
||||||
repeat: false
|
|
||||||
onTriggered: {
|
|
||||||
if (panel.backgroundIsStable()) panel.frozenBackgroundVersion = root.backgroundVersion
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
id: base
|
id: base
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@@ -256,7 +220,6 @@ Item {
|
|||||||
root.oldBackground = ""
|
root.oldBackground = ""
|
||||||
root.finishingTransition = false
|
root.finishingTransition = false
|
||||||
}
|
}
|
||||||
panel.scheduleUpdatesFreeze()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,10 +233,7 @@ Item {
|
|||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
visible: root.oldBackground !== "" && root.revealProgress < 1
|
visible: root.oldBackground !== "" && root.revealProgress < 1
|
||||||
onStatusChanged: {
|
onStatusChanged: panel.maybeStartReveal()
|
||||||
panel.maybeStartReveal()
|
|
||||||
panel.scheduleUpdatesFreeze()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@@ -298,10 +258,7 @@ Item {
|
|||||||
cache: false
|
cache: false
|
||||||
smooth: true
|
smooth: true
|
||||||
mipmap: true
|
mipmap: true
|
||||||
onStatusChanged: {
|
onStatusChanged: panel.maybeStartReveal()
|
||||||
panel.maybeStartReveal()
|
|
||||||
panel.scheduleUpdatesFreeze()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,17 +292,10 @@ Item {
|
|||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: root
|
target: root
|
||||||
function onBackgroundVersionChanged() {
|
|
||||||
panel.frozenBackgroundVersion = -1
|
|
||||||
panel.scheduleUpdatesFreeze()
|
|
||||||
}
|
|
||||||
function onFinishingTransitionChanged() { panel.scheduleUpdatesFreeze() }
|
|
||||||
function onIncomingBackgroundChanged() {
|
function onIncomingBackgroundChanged() {
|
||||||
panel.maskReady = false
|
panel.maskReady = false
|
||||||
panel.maybeStartReveal()
|
panel.maybeStartReveal()
|
||||||
panel.scheduleUpdatesFreeze()
|
|
||||||
}
|
}
|
||||||
function onRevealProgressChanged() { panel.scheduleUpdatesFreeze() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|||||||
Reference in New Issue
Block a user