Summary: | Update slideshow in strict intervals, aligned to UNIX epoch | ||
---|---|---|---|
Product: | [Plasma] plasmashell | Reporter: | bastimeyer123 |
Component: | Image Wallpaper | Assignee: | Plasma Bugs List <plasma-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | nate, notmart, qydwhotmail |
Priority: | NOR | Keywords: | multiscreen |
Version: | 5.27.10 | ||
Target Milestone: | 1.0 | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/plasma/plasma-workspace/-/commit/170a0c9e396028a564c1ee12a0a85207d6fa9fb3 | Version Fixed In: | 6.3.0 |
Sentry Crash Report: |
Description
bastimeyer123
2024-01-31 23:19:03 UTC
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 { ``` It might make sense to do this without any option, TBH. So I wouldn't be so quick to assume your patch would be rejected. (In reply to Nate Graham from comment #2) > It might make sense to do this without any option, TBH. So I wouldn't be so quick to assume your patch would be rejected. As said, I'm not a C++/Qt dev, so I'm not familiar with it, as well as your workflows and other requirements, but I can see if I can submit a pull request with my changes later for you guys to review. I've been using a slightly different patch for a few months now though, because the diff I've posted earlier had some surprising QTimer precision issues. It's been working well for me without any issues. A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4665 Implemented by Sebastian Meyer in https://invent.kde.org/plasma/plasma-workspace/-/commit/170a0c9e396028a564c1ee12a0a85207d6fa9fb3 for Plasma 6.3.0! |