mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-15 15:45:20 -04:00
fix(wallpaper): simplify wallpaper rendering logic & reliability
- Keep wallpaper surfaces persistent and remove `updatesEnabled` throttling that could leave wallpapers grey or frozen after DPMS, suspend, fullscreen, or output changes Fixes #2612 Fixes #2299 Fixes #2272 Fixes #2028
This commit is contained in:
+2
-19
@@ -64,27 +64,15 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property bool wallpaperSurfacesLoaded: true
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: blurredWallpaperBackgroundLoader
|
id: blurredWallpaperBackgroundLoader
|
||||||
active: root.wallpaperSurfacesLoaded && SettingsData.blurredWallpaperLayer && CompositorService.isNiri
|
active: SettingsData.blurredWallpaperLayer && CompositorService.isNiri
|
||||||
asynchronous: false
|
asynchronous: false
|
||||||
|
|
||||||
sourceComponent: BlurredWallpaperBackground {}
|
sourceComponent: BlurredWallpaperBackground {}
|
||||||
}
|
}
|
||||||
|
|
||||||
DeferredAction {
|
WallpaperBackground {}
|
||||||
id: wallpaperSurfaceReloadAction
|
|
||||||
onTriggered: root.wallpaperSurfacesLoaded = true
|
|
||||||
}
|
|
||||||
|
|
||||||
Loader {
|
|
||||||
id: wallpaperBackgroundLoader
|
|
||||||
active: root.wallpaperSurfacesLoaded
|
|
||||||
asynchronous: false
|
|
||||||
sourceComponent: WallpaperBackground {}
|
|
||||||
}
|
|
||||||
|
|
||||||
DesktopWidgetLayer {}
|
DesktopWidgetLayer {}
|
||||||
|
|
||||||
@@ -398,11 +386,6 @@ Item {
|
|||||||
frameSurfaceReloadAction.schedule();
|
frameSurfaceReloadAction.schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (root.wallpaperSurfacesLoaded) {
|
|
||||||
root.wallpaperSurfacesLoaded = false;
|
|
||||||
wallpaperSurfaceReloadAction.schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
root.dockEnabled = false;
|
root.dockEnabled = false;
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
root.dockEnabled = true;
|
root.dockEnabled = true;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import qs.Widgets
|
|||||||
import qs.Services
|
import qs.Services
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
|
readonly property var log: Log.scoped("BlurredWallpaperBackground")
|
||||||
model: {
|
model: {
|
||||||
if (SessionData.isGreeterMode) {
|
if (SessionData.isGreeterMode) {
|
||||||
return Quickshell.screens;
|
return Quickshell.screens;
|
||||||
@@ -85,7 +86,6 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
blurWallpaperWindow.updatesEnabled = Qt.binding(() => !root.source || root.effectActive || root._renderSettling || currentWallpaper.status === Image.Loading || nextWallpaper.status === Image.Loading);
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,51 +93,16 @@ Variants {
|
|||||||
property real transitionProgress: 0
|
property real transitionProgress: 0
|
||||||
readonly property bool transitioning: transitionAnimation.running
|
readonly property bool transitioning: transitionAnimation.running
|
||||||
property bool effectActive: false
|
property bool effectActive: false
|
||||||
property bool _renderSettling: true
|
|
||||||
property bool useNextForEffect: false
|
property bool useNextForEffect: false
|
||||||
|
|
||||||
Connections {
|
function handleTransitionLoadError(failedSource) {
|
||||||
target: currentWallpaper
|
log.warn("failed to load candidate wallpaper for", modelData.name + ":", failedSource);
|
||||||
function onStatusChanged() {
|
transitionDelayTimer.stop();
|
||||||
if (currentWallpaper.status !== Image.Ready && currentWallpaper.status !== Image.Error)
|
transitionAnimation.stop();
|
||||||
return;
|
root.useNextForEffect = false;
|
||||||
root._renderSettling = true;
|
root.effectActive = false;
|
||||||
renderSettleTimer.restart();
|
root.transitionProgress = 0.0;
|
||||||
}
|
nextWallpaper.source = "";
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: blurWallpaperWindow
|
|
||||||
function onWidthChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
function onHeightChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Quickshell
|
|
||||||
function onScreensChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: SettingsData
|
|
||||||
function onWallpaperFillModeChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: renderSettleTimer
|
|
||||||
interval: 1000
|
|
||||||
onTriggered: root._renderSettling = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onSourceChanged: {
|
onSourceChanged: {
|
||||||
@@ -164,8 +129,6 @@ Variants {
|
|||||||
transitionAnimation.stop();
|
transitionAnimation.stop();
|
||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
currentWallpaper.source = newSource;
|
currentWallpaper.source = newSource;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
}
|
}
|
||||||
@@ -194,8 +157,6 @@ Variants {
|
|||||||
transitionAnimation.stop();
|
transitionAnimation.stop();
|
||||||
root.transitionProgress = 0;
|
root.transitionProgress = 0;
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
currentWallpaper.source = nextWallpaper.source;
|
currentWallpaper.source = nextWallpaper.source;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
}
|
}
|
||||||
@@ -204,9 +165,6 @@ Variants {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
|
|
||||||
nextWallpaper.source = newPath;
|
nextWallpaper.source = newPath;
|
||||||
|
|
||||||
if (nextWallpaper.status === Image.Ready)
|
if (nextWallpaper.status === Image.Ready)
|
||||||
@@ -215,7 +173,7 @@ Variants {
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: !root.source || root.isColorSource
|
active: !root.source || root.isColorSource || currentWallpaper.status === Image.Error
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
||||||
sourceComponent: DankBackdrop {
|
sourceComponent: DankBackdrop {
|
||||||
@@ -238,6 +196,12 @@ Variants {
|
|||||||
cache: true
|
cache: true
|
||||||
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error) {
|
||||||
|
log.warn("failed to load active wallpaper for", modelData.name + ":", source);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
@@ -253,6 +217,10 @@ Variants {
|
|||||||
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
fillMode: root.getFillMode(SessionData.isGreeterMode ? GreetdSettings.wallpaperFillMode : SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error) {
|
||||||
|
root.handleTransitionLoadError(source);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (status !== Image.Ready)
|
if (status !== Image.Ready)
|
||||||
return;
|
return;
|
||||||
if (!root.transitioning) {
|
if (!root.transitioning) {
|
||||||
@@ -329,8 +297,6 @@ Variants {
|
|||||||
root.useNextForEffect = false;
|
root.useNextForEffect = false;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,23 +84,11 @@ Variants {
|
|||||||
|
|
||||||
readonly property bool transitioning: transitionAnimation.running
|
readonly property bool transitioning: transitionAnimation.running
|
||||||
property bool effectActive: false
|
property bool effectActive: false
|
||||||
property bool _renderSettling: true
|
|
||||||
property bool _overviewBlurSettling: false
|
|
||||||
property bool useNextForEffect: false
|
property bool useNextForEffect: false
|
||||||
property string pendingWallpaper: ""
|
property string pendingWallpaper: ""
|
||||||
property string _deferredSource: ""
|
property string _deferredSource: ""
|
||||||
readonly property bool overviewBlurActive: CompositorService.isNiri && SettingsData.blurWallpaperOnOverview && NiriService.inOverview && currentWallpaper.source !== ""
|
readonly property bool overviewBlurActive: CompositorService.isNiri && SettingsData.blurWallpaperOnOverview && NiriService.inOverview && currentWallpaper.source !== ""
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: currentWallpaper
|
|
||||||
function onStatusChanged() {
|
|
||||||
if (currentWallpaper.status !== Image.Ready && currentWallpaper.status !== Image.Error)
|
|
||||||
return;
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function _recheckScreenScale() {
|
function _recheckScreenScale() {
|
||||||
const newScale = CompositorService.getScreenScale(modelData);
|
const newScale = CompositorService.getScreenScale(modelData);
|
||||||
if (newScale !== root.screenScale) {
|
if (newScale !== root.screenScale) {
|
||||||
@@ -109,32 +97,10 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: wallpaperWindow
|
|
||||||
function onWidthChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
function onHeightChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Quickshell
|
|
||||||
function onScreensChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: NiriService
|
target: NiriService
|
||||||
function onDisplayScalesChanged() {
|
function onDisplayScalesChanged() {
|
||||||
root._recheckScreenScale();
|
root._recheckScreenScale();
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,29 +108,6 @@ Variants {
|
|||||||
target: WlrOutputService
|
target: WlrOutputService
|
||||||
function onWlrOutputAvailableChanged() {
|
function onWlrOutputAvailableChanged() {
|
||||||
root._recheckScreenScale();
|
root._recheckScreenScale();
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: NiriService
|
|
||||||
function onInOverviewChanged() {
|
|
||||||
root._overviewBlurSettling = true;
|
|
||||||
overviewBlurSettleTimer.restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: SettingsData
|
|
||||||
function onBlurWallpaperOnOverviewChanged() {
|
|
||||||
root._overviewBlurSettling = true;
|
|
||||||
overviewBlurSettleTimer.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onWallpaperFillModeChanged() {
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,26 +124,22 @@ Variants {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
function handleTransitionLoadError(failedSource) {
|
||||||
target: IdleService
|
log.warn("failed to load candidate wallpaper for", modelData.name + ":", failedSource);
|
||||||
function onIsShellLockedChanged() {
|
transitionDelayTimer.stop();
|
||||||
if (!IdleService.isShellLocked) {
|
transitionAnimation.stop();
|
||||||
root._renderSettling = true;
|
root.useNextForEffect = false;
|
||||||
renderSettleTimer.restart();
|
root.effectActive = false;
|
||||||
}
|
root.transitionProgress = 0.0;
|
||||||
}
|
currentWallpaper.layer.enabled = false;
|
||||||
}
|
nextWallpaper.layer.enabled = false;
|
||||||
|
nextWallpaper.source = "";
|
||||||
|
|
||||||
Timer {
|
if (!root.pendingWallpaper)
|
||||||
id: renderSettleTimer
|
return;
|
||||||
interval: 1000
|
const pending = root.pendingWallpaper;
|
||||||
onTriggered: root._renderSettling = false
|
root.pendingWallpaper = "";
|
||||||
}
|
Qt.callLater(() => root.changeWallpaper(pending, true));
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: overviewBlurSettleTimer
|
|
||||||
interval: 150
|
|
||||||
onTriggered: root._overviewBlurSettling = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFillMode(modeName) {
|
function getFillMode(modeName) {
|
||||||
@@ -227,11 +166,6 @@ Variants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
wallpaperWindow.updatesEnabled = Qt.binding(() => !root.source || root.effectActive || root._renderSettling || root.overviewBlurActive || root._overviewBlurSettling || root.pendingWallpaper !== "" || root._deferredSource !== "" || currentWallpaper.status === Image.Loading || nextWallpaper.status === Image.Loading);
|
|
||||||
|
|
||||||
if (!source) {
|
|
||||||
root._renderSettling = false;
|
|
||||||
}
|
|
||||||
isInitialized = true;
|
isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,8 +196,6 @@ Variants {
|
|||||||
transitionAnimation.stop();
|
transitionAnimation.stop();
|
||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
root.screenScale = CompositorService.getScreenScale(modelData);
|
root.screenScale = CompositorService.getScreenScale(modelData);
|
||||||
currentWallpaper.source = newSource;
|
currentWallpaper.source = newSource;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
@@ -328,9 +260,6 @@ Variants {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
|
|
||||||
nextWallpaper.source = newPath;
|
nextWallpaper.source = newPath;
|
||||||
|
|
||||||
if (nextWallpaper.status === Image.Ready)
|
if (nextWallpaper.status === Image.Ready)
|
||||||
@@ -339,7 +268,7 @@ Variants {
|
|||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
active: !root.source || root.isColorSource
|
active: !root.source || root.isColorSource || currentWallpaper.status === Image.Error
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
|
|
||||||
sourceComponent: DankBackdrop {
|
sourceComponent: DankBackdrop {
|
||||||
@@ -364,6 +293,12 @@ Variants {
|
|||||||
cache: true
|
cache: true
|
||||||
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
sourceSize: Qt.size(root.textureWidth, root.textureHeight)
|
||||||
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(modelData.name))
|
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||||
|
|
||||||
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error) {
|
||||||
|
log.warn("failed to load active wallpaper for", modelData.name + ":", source);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
@@ -380,11 +315,13 @@ Variants {
|
|||||||
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(modelData.name))
|
fillMode: root.getFillMode(SessionData.getMonitorWallpaperFillMode(modelData.name))
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
|
if (status === Image.Error) {
|
||||||
|
root.handleTransitionLoadError(source);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (status !== Image.Ready)
|
if (status !== Image.Ready)
|
||||||
return;
|
return;
|
||||||
if (root.actualTransitionType === "none") {
|
if (root.actualTransitionType === "none") {
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
currentWallpaper.source = source;
|
currentWallpaper.source = source;
|
||||||
nextWallpaper.source = "";
|
nextWallpaper.source = "";
|
||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
@@ -632,8 +569,6 @@ Variants {
|
|||||||
root.transitionProgress = 0.0;
|
root.transitionProgress = 0.0;
|
||||||
currentWallpaper.layer.enabled = false;
|
currentWallpaper.layer.enabled = false;
|
||||||
nextWallpaper.layer.enabled = false;
|
nextWallpaper.layer.enabled = false;
|
||||||
root._renderSettling = true;
|
|
||||||
renderSettleTimer.restart();
|
|
||||||
root.effectActive = false;
|
root.effectActive = false;
|
||||||
|
|
||||||
if (!root.pendingWallpaper)
|
if (!root.pendingWallpaper)
|
||||||
|
|||||||
Reference in New Issue
Block a user