Skip to content

fix: replace hardcoded wallpaper timers with event-driven ready signal#1029

Draft
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/developer/43f0b2f3
Draft

fix: replace hardcoded wallpaper timers with event-driven ready signal#1029
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/developer/43f0b2f3

Conversation

@deepin-wm

Copy link
Copy Markdown
Contributor

修复壁纸切换3秒延迟

问题

个性化切换壁纸时,存在约3秒延迟,无法立即切换。

根因

WallpaperItem::scheduleUpdate() 中使用 QTimer::singleShot(3000, ...) 硬编码了3秒延迟,compositor不知道wallpaper客户端何时完成渲染,因此用固定3秒等待作为同步机制。

修改方案

用协议 v2 已定义的 ready 机制替代硬编码定时器,实现事件驱动的壁纸切换:

  • 监听 TreelandWallpaperSurfaceInterfaceV1::ready() 信号后立即更新
  • 保留 500ms fallback 超时
  • 客户端在 afterRendering 后发送 ready 请求

涉及文件

  • src/wallpaper/wallpaperitem.cpp / .h — 替换定时器为事件驱动逻辑
  • src/modules/wallpaper/wallpapershellinterfacev1.cpp / .h — 添加 ready 信号
  • wallpaper-factory/qwaylandwallpapersurface.cpp / _p.h — 客户端发送 ready 请求

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @deepin-wm, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1. Replace 3000ms QTimer in WallpaperItem::scheduleUpdate() with
   event-driven logic that listens for the ready signal from
   wallpaper surface
2. Add 500ms fallback timer in case the client does not send
   the ready request
3. Implement ready() signal in TreelandWallpaperSurfaceInterfaceV1
   and emit it when the client sends the ready request
4. Client (wallpaper-factory) sends ready after QQuickWindow
   afterRendering, with m_readySent guard to prevent duplicates
5. Remove 2000ms QTimer delay in updateSurface() for Desktop
   wallpaper, emit sourceChanged() immediately instead
6. Add clearPendingUpdate() and applyPendingUpdate() helper
   methods for clean signal/timer lifecycle management

Log: Wallpaper switching now responds immediately instead of
waiting 3 seconds

Influence:
1. Test wallpaper switching responsiveness in personalization
   settings
2. Verify wallpaper changes with both static and video wallpapers
3. Test fallback behavior when wallpaper client does not send
   ready signal
4. Verify no regression on lockscreen wallpaper updates
5. Test rapid consecutive wallpaper switches

fix: 替换壁纸硬编码定时器为事件驱动的ready信号机制

1. 替换WallpaperItem::scheduleUpdate()中的3000ms定时器为
   事件驱动逻辑,监听壁纸surface的ready信号后立即更新
2. 添加500ms兜底定时器,防止客户端未发送ready请求时
   壁纸无法更新
3. 在TreelandWallpaperSurfaceInterfaceV1中实现ready()信号,
   客户端发送ready请求时触发
4. 客户端(wallpaper-factory)在QQuickWindow afterRendering后
   发送ready请求,使用m_readySent防止重复发送
5. 移除updateSurface()中桌面壁纸的2000ms延迟,改为
   立即emit sourceChanged()
6. 添加clearPendingUpdate()和applyPendingUpdate()辅助方法,
   管理信号和定时器的生命周期

Log: 壁纸切换立即响应,不再等待3秒

Influence:
1. 测试个性化设置中壁纸切换的响应速度
2. 验证静态壁纸和视频壁纸的切换功能
3. 测试壁纸客户端未发送ready信号时的兜底行为
4. 验证锁屏壁纸更新无回归问题
5. 测试快速连续切换壁纸的场景
@deepin-wm deepin-wm force-pushed the agent/developer/43f0b2f3 branch from 36ff7cc to c53502a Compare June 18, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants