Revert "Wallpaper: improved image switching to avoid main thread micro freeze."

This reverts commit 6e368601b4.
This commit is contained in:
ItsLemmy
2025-11-13 15:45:46 -05:00
parent aa0a6c2cdd
commit 04fcb94ebc
+12 -29
View File
@@ -306,37 +306,20 @@ Variants {
duration: transitionType == "stripes" ? Settings.data.wallpaper.transitionDuration * 1.6 : Settings.data.wallpaper.transitionDuration
easing.type: Easing.InOutCubic
onFinished: {
// Strategy: Keep transitionProgress at 1.0 (showing nextWallpaper)
// until currentWallpaper finishes loading asynchronously
// Assign new image to current BEFORE clearing to prevent flicker
const tempSource = nextWallpaper.source
const tempSourceSize = nextWallpaper.sourceSize
// Enable async loading to prevent blocking
currentWallpaper.asynchronous = true
// Create one-time connection to wait for async load to complete
const onCurrentLoaded = function () {
if (currentWallpaper.status === Image.Ready || currentWallpaper.status === Image.Error) {
// Disconnect this handler
currentWallpaper.statusChanged.disconnect(onCurrentLoaded)
// Now it's safe to reset progress and cleanup
transitionProgress = 0.0
// Force complete cleanup to free texture memory (~18-25MB per monitor)
Qt.callLater(() => {
nextWallpaper.source = ""
nextWallpaper.sourceSize = undefined
})
}
}
// Connect the handler BEFORE changing source
currentWallpaper.statusChanged.connect(onCurrentLoaded)
// Trigger async load (keeps nextWallpaper visible via progress=1.0)
currentWallpaper.sourceSize = tempSourceSize
currentWallpaper.source = tempSource
transitionProgress = 0.0
// Now clear nextWallpaper after currentWallpaper has the new source
// Force complete cleanup to free texture memory (~18-25MB per monitor)
Qt.callLater(() => {
nextWallpaper.source = ""
nextWallpaper.sourceSize = undefined
Qt.callLater(() => {
currentWallpaper.asynchronous = true
})
})
}
}