Skip to content

feat(wallpaper): add curtain-style transition for wallpaper switching - #1450

Draft
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/1ab42ef8b147
Draft

deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/1ab42ef8b147

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

为壁纸切换添加拉幕式(curtain-style)过渡动画,并修复快速连续切换场景下的槽位可见性问题。

  • feat(wallpaper): 壁纸切换过渡由交叉淡化改为拉幕式:新壁纸槽位先停靠在屏幕右侧外,待 wallpaperReady 后以 OutCubic 缓动滑入覆盖旧壁纸(时长复用 transitionDuration,默认 500ms),滑动结束后恢复 anchors.fill 布局并清理旧槽位。
  • fix(wallpaper): 快速连续切换时先 stop() 在途动画让当前槽位原地完成,已显示的被顶替槽位升级为 backdrop、未显示的停靠槽位直接回收,保证新壁纸就绪前屏幕上始终有一个全覆盖的可见壁纸;同时修复零尺寸分支下可能出现的永久黑屏。

Checklist

  • 代码审查通过(复审报告确认无阻塞问题,可合入)
  • 本地/远程整机编译通过(1915/1915 后增量重链无告警)
  • 仅改动 src/wallpaper/wallpaperswitcheritem.{h,cpp}(+72/-35)

关联 Multica Issue: WM-557

Summary by Sourcery

Add a curtain-style wallpaper transition while making rapid switching robust.

New Features:

  • Replace wallpaper cross-fading with a curtain-style slide-in transition using the configured transition duration.

Bug Fixes:

  • Preserve a fully visible wallpaper during rapid successive switches and prevent black screens when the switcher has zero dimensions.

Enhancements:

  • Rename the wallpaper transition timing property and lifecycle signals from opacity duration to transition duration.
  • Improve cleanup and handling of in-flight and not-yet-visible wallpaper slots during transitions.

deepin-wm added 2 commits September 29, 2026 15:26
将壁纸切换过渡从交叉淡化改为拉幕式效果:新壁纸在 wallpaperReady
后从屏幕右侧滑入覆盖旧壁纸,滑动结束后恢复 anchors.fill 布局并
清理旧槽位,同时避免快速连续切换时对动画中槽位的悬空删除。

Switch the wallpaper transition from cross-fade to a curtain effect:
once the new wallpaper surface is ready, it slides in from the right
edge to cover the old one; anchors.fill is restored and the old slot
is cleaned up when the slide finishes.

Log: 壁纸切换改为拉幕式过渡动画
Influence: 壁纸切换动画由交叉淡化改为拉幕式滑入,过渡更自然。
Multica Issue: WM-557
修复评审问题 1/2/3 并采纳问题 4:
- finishSlideIn 恢复槽位可见性,修复零尺寸分支下壁纸区域永久黑屏;
- 切换前先停止在途动画让当前槽位原地完成,已显示的被顶替槽位
  升级为 backdrop、未显示的停靠槽位直接回收,保证新壁纸就绪前
  屏幕上始终有一个全覆盖的可见壁纸;
- 用显式 shown 标记代替 isVisible() 判断,避免祖先不可见时误删;
- ready/finished 回调改捕 QPointer,析构时先停动画;
- opacityDuration 更名 transitionDuration(QML 无调用方)。

Fixes from code review: restore slot visibility in finishSlideIn to
avoid a permanent black screen in the zero-size path; stop the
in-flight slide before superseding so a shown slot always remains as
backdrop while the next wallpaper waits for ready; use an explicit
shown flag instead of isVisible(); guard callbacks with QPointer;
rename opacityDuration to transitionDuration.

Log: 修复快速切换壁纸槽位可见性问题
Influence: 快速切换中始终保留可见壁纸槽位,消除黑屏回归。
Multica Issue: WM-557
@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

@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

@sourcery-ai

sourcery-ai Bot commented Sep 29, 2026

Copy link
Copy Markdown

Reviewer's Guide

本 PR 在 WallpaperSwitcherItem 中以基于 x 坐标的拉幕式滑入动画替换交叉淡化,并围绕 wallpaperReady、快速连续切换和零尺寸布局重构槽位可见性与生命周期管理;同时将公开的时长属性重命名为 transitionDuration。

Sequence diagram for curtain-style wallpaper switching

sequenceDiagram
    participant Switcher as WallpaperSwitcherItem
    participant Slot as WallpaperSlot
    participant Surface as WallpaperSurfaceInterface
    participant Animation as QPropertyAnimation

    Switcher->>Slot: switchToNewSlot()
    Switcher->>Slot: setVisible(false)
    Switcher->>Slot: setX(width())
    Switcher->>Surface: wallpaperReady()
    alt wallpaper ready
        Switcher->>Switcher: startSlideIn(Slot)
    else wait for ready
        Surface-->>Switcher: ready
        Switcher->>Switcher: startSlideIn(Slot)
    end
    Switcher->>Slot: setVisible(true)
    Switcher->>Animation: start x animation
    Animation-->>Switcher: finished
    Switcher->>Switcher: finishSlideIn(Slot)
    Switcher->>Slot: setX(0)
    Switcher->>Slot: anchors.fill
    Switcher->>Slot: deleteLater old slot
Loading

State diagram for wallpaper slot visibility

stateDiagram-v2
    [*] --> Parked
    Parked: visible=false, shown=false
    Parked --> Sliding: wallpaperReady / startSlideIn
    Sliding: visible=true, x=width()
    Sliding --> Displayed: animation finished / finishSlideIn
    Displayed: shown=true, anchors.fill
    Sliding --> Parked: newer switch / stop animation
    Parked --> [*]: newer switch / deleteLater
    Displayed --> Backdrop: newer switch
    Backdrop: oldSlot, fully visible
    Backdrop --> [*]: replacement finished / deleteLater
Loading

File-Level Changes

Change Details Files
将壁纸切换从交叉淡化改为等待就绪后执行的拉幕式滑入过渡。
  • 新槽位预先停靠在右侧屏幕外并保持不可见,收到 wallpaperReady 后以 OutCubic 动画滑入覆盖旧槽位。
  • 动画完成后恢复 anchors.fill,并删除旧槽位;零尺寸容器直接完成切换以避免黑屏。
  • 以 transitionDuration 替换 opacityDuration,默认时长保持 500ms。
src/wallpaper/wallpaperswitcheritem.h
src/wallpaper/wallpaperswitcheritem.cpp
重构快速连续切换时的槽位和动画生命周期管理,确保切换期间始终存在可见的全覆盖壁纸。
  • 开始新切换前停止在途滑入动画,使当前槽位完成并成为 backdrop。
  • 已显示的被顶替槽位保留为旧槽位,未显示的停靠槽位直接延迟回收。
  • 使用 shown 状态区分已显示与仅停靠的槽位,并通过 QPointer 防止就绪或动画回调访问已销毁对象。
  • 析构时停止滑入动画,避免动画完成回调在槽位释放期间继续执行。
src/wallpaper/wallpaperswitcheritem.cpp
src/wallpaper/wallpaperswitcheritem.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Interrupted animations are not finalized, and delayed-ready slots can retain stale geometry, causing uncovered wallpaper regions;动画中断及槽位尺寸过期可能导致壁纸区域未覆盖。

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

为壁纸切换引入拉幕式滑入动画,并改进连续切换时的槽位管理。 Adds a curtain-style wallpaper transition and improves slot lifecycle handling during rapid switches.

Changes:

  • 将淡入淡出替换为 OutCubic 横向滑入动画。 Replaces cross-fading with an OutCubic slide-in.
  • 重命名过渡时长 API,并跟踪活动动画。 Renames the duration API and tracks active animations.
  • 增加未就绪槽位与零尺寸处理。 Handles pending and zero-sized slots.
File Description
src/​wallpaper/​wallpaperswitcheritem.h 声明过渡 API 与动画状态。 Declares transition APIs and animation state.
src/​wallpaper/​wallpaperswitcheritem.cpp 实现拉幕动画及槽位清理。 Implements curtain animation and slot cleanup.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +196 to +199
if (m_slideAnim) {
m_slideAnim->stop(); // finished -> finishSlideIn completes the current slot
m_slideAnim = nullptr;
}
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.

3 participants