https://bugs.kde.org/show_bug.cgi?id=480643

--- Comment #1 from bastimeyer...@gmail.com ---
I've applied the following patch to my plasma-workspace build, which works fine
for me. This always aligns the timers with unix epoch and makes the slideshows
shorter, depending on the time when the slideshows have started in these strict
time intervals. This fixes the desync issues when loading a desktop on various
screens/activities for the first time, restarting the slideshows, skipping
wallpapers, or when there's a random delay during the wallpaper transition
(different issue).

I don't really intend to open a pull request, because as said, I'm not familiar
with C++/Qt/QML and the plasma-workspace setup, so I wouldn't be able to easily
implement a config option for that or make other adjustments if requested.

Please have a look and see if these changes make sense to you. Thanks.

```diff
diff --git a/wallpapers/image/plugin/imagebackend.cpp
b/wallpapers/image/plugin/imagebackend.cpp
index ce5b5aac5c..a3c1a531c8 100644
--- a/wallpapers/image/plugin/imagebackend.cpp
+++ b/wallpapers/image/plugin/imagebackend.cpp
@@ -14,6 +14,7 @@

 #include <math.h>

+#include <QDateTime>
 #include <QFileDialog>
 #include <QGuiApplication>
 #include <QImageReader>
@@ -446,8 +447,15 @@ void ImageBackend::nextSlide()
         m_currentSlide += 1;
         next = m_slideFilterModel->index(m_currentSlide,
0).data(ImageRoles::PackageNameRole).toString();
     }
+
+    QDateTime dtnow = QDateTime::currentDateTimeUtc();
+    qint64 now = dtnow.toMSecsSinceEpoch();
+    int delay_ms = m_delay * 1000;
+    int offset_ms = now % delay_ms;
+    int duration_ms = delay_ms - offset_ms;
+
     m_timer.stop();
-    m_timer.start(m_delay * 1000);
+    m_timer.start(duration_ms);
     if (next.isEmpty()) {
         m_image = QUrl::fromLocalFile(previousPath);
     } else {
```

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to