Skip to content

feat(window-transition): implement window transition protocol - #1394

Open
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:feat/animation-new
Open

feat(window-transition): implement window transition protocol#1394
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:feat/animation-new

Conversation

@glyvut

@glyvut glyvut commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Add the server-side implementation of treeland-window-transition-unstable-v1, which plays a window open/close transition relative to a source rectangle attached to an xdg-activation token.

A client attaches a persistent transition rectangle (geometry plus an optional source image) to an xdg_activation_token_v1 before committing the token. At activation the compositor associates the rectangle with the target window, animating from the rectangle's global position on open and back to it on close. The rectangle stays alive, so set_geometry and set_source_buffer update it immediately.

新增 treeland-window-transition-unstable-v1 的服务端实现,基于关联到 xdg-activation token 的源矩形播放窗口打开/关闭转场。

客户端在提交 token 前挂载一个持久的转场矩形(几何信息及可选源图像)。
激活时合成器将矩形关联到目标窗口,打开时从矩形的全局位置播放动画,
关闭时过渡回该矩形。矩形持续存活,set_geometry / set_source_buffer
可立即更新。

Log: 实现窗口转场协议,基于激活 token 的源矩形播放开/关转场
Influence: 新增窗口转场模块、QML 动画组件及 test-window-transition 样例; 激活流程支持矩形关联并播放开/关动画。

Summary by Sourcery

Implement activation-token-based window transitions from a persistent source rectangle, including compositor integration, animations, lifecycle management, and an example client.

New Features:

  • Add the server-side treeland-window-transition-unstable-v1 protocol, allowing clients to associate persistent source rectangles and optional images with activation tokens for window open and close transitions.
  • Integrate activation-token transitions with window lifecycle handling, including pending activation for unmapped targets and live updates to transition geometry and source imagery.
  • Provide a reusable QML window-transition animation with scaling, movement, fading, optional blur, and source-buffer rendering.
  • Add a Qt Wayland client example demonstrating transitions for newly launched and modal windows.

Enhancements:

  • Extend activation handling to retain token origin information and coordinate transition-rectangle ownership, association, expiry, and cleanup.
  • Expose window-transition state and animation support through SurfaceWrapper and the QML engine.

Build:

  • Build and install the window-transition protocol module and test-window-transition example.

Tests:

  • Add the test-window-transition sample application for exercising activation-token transitions, geometry updates, source buffers, and disabled animation.

Chores:

  • Add dedicated logging for the window-transition module.

@sourcery-ai

sourcery-ai Bot commented Sep 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements activation-token-based window transitions end to end: clients attach persistent source rectangles and optional images, the compositor associates them with activated windows, and QML-rendered open/close animations use live source geometry with lifecycle-safe fallback and cleanup.

Sequence diagram for activation-token window transition

sequenceDiagram
    participant Client
    participant ActivationManager
    participant TransitionManager
    participant SurfaceWrapper
    participant WindowTransition

    Client->>TransitionManager: get_window_transition_rect(token)
    Client->>TransitionManager: set_geometry(x,y,width,height)
    Client->>TransitionManager: set_source_buffer(buffer)
    Client->>ActivationManager: commit()
    ActivationManager->>TransitionManager: takeCommittedRect(token, tokenResource)
    Client->>ActivationManager: activate(token, targetSurface)
    ActivationManager->>SurfaceWrapper: activateRequested(token, targetSurface, originatingSurface)
    TransitionManager->>SurfaceWrapper: associatePendingRect(token, target, origin)
    SurfaceWrapper->>SurfaceWrapper: setPendingActivation(seat)
    SurfaceWrapper->>WindowTransition: createWindowTransition(fromRect, toRect, sourceBuffer)
    WindowTransition-->>SurfaceWrapper: finished()
Loading

File-Level Changes

Change Details Files
Adds the server-side window-transition Wayland protocol with persistent, token-bound source rectangles.
  • Creates the manager and rectangle protocol globals and validates rectangle geometry and source buffers.
  • Tracks committed rectangles by activation-token resource, transfers them to pending token entries, expires unactivated entries, and emits lifecycle notifications.
  • Updates rectangle geometry and source imagery immediately after association with a target window.
src/modules/window-transition/CMakeLists.txt
src/modules/window-transition/windowtransitionmanagerinterfacev1.h
src/modules/window-transition/windowtransitionmanagerinterfacev1.cpp
src/modules/CMakeLists.txt
src/common/treelandlogging.cpp
src/common/treelandlogging.h
Extends activation-token handling to preserve launch context and connect activation with transition rectangles.
  • Stores the originating surface in committed token metadata and exposes it with activation requests.
  • Consumes the token-bound rectangle during token commit and associates or discards it when activation arrives.
  • Defers active activation until an unmapped target surface is initialized and mapped.
src/modules/activation/activationmanagerinterfacev1.h
src/modules/activation/activationmanagerinterfacev1.cpp
src/seat/helper.h
src/seat/helper.cpp
Integrates open and close transitions into surface lifecycle and compositor animation rendering.
  • Computes the source rectangle in global coordinates from the originating surface and drives open/close geometry animations.
  • Adds QML rendering for surface content, optional source-buffer imagery, shadows, blur, fade, and geometry interpolation.
  • Falls back to existing animations when the rectangle is unavailable, disabled, stale, or incompatible with the surface lifecycle; manages buffer lifetime and cleanup.
src/surface/surfacewrapper.h
src/surface/surfacewrapper.cpp
src/core/qmlengine.h
src/core/qmlengine.cpp
src/core/qml/Animations/WindowTransition.qml
src/CMakeLists.txt
Adds an end-to-end Qt/Wayland example for exercising activation-token window transitions.
  • Generates client protocol bindings and provides sender, receiver, and same-process modal launch flows.
  • Demonstrates persistent geometry updates, optional source-buffer toggling, disabled animation behavior, and cleanup after target closure.
examples/CMakeLists.txt
examples/test-window-transition/CMakeLists.txt
examples/test-window-transition/main.cpp

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

@glyvut
glyvut force-pushed the feat/animation-new branch 4 times, most recently from c610a59 to 033c530 Compare September 11, 2026 09:03
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: glyvut

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

@glyvut
glyvut marked this pull request as ready for review September 11, 2026 09:03

@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.

Hey - I've found 2 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/modules/activation/activationmanagerinterfacev1.cpp" line_range="231-251" />
<code_context>
         auto it = std::find_if(m_tokens.begin(), m_tokens.end(),
</code_context>
<issue_to_address>
**issue (bug_risk):** Expired activation tokens are accepted because the new single-pass lookup computes disposition without checking `it->expiry.hasExpired()`. A token can therefore still activate a window after the intended 60-second lifetime.

**Triggers:** When a client waits until the activation token has expired before calling activate.

**Suggested fix:** Reject the token and use `Invalid` disposition when `it->expiry.hasExpired()` is true.
</issue_to_address>

### Comment 2
<location path="examples/test-window-transition/CMakeLists.txt" line_range="21-28" />
<code_context>
+        Qt6::Gui
+        Qt6::Widgets
+        Qt6::WaylandClient
+        Qt6::GuiPrivate
+        Qt6::WaylandClientPrivate
+)
+
+install(TARGETS ${BIN_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
</code_context>
<issue_to_address>
**issue (bug_risk):** The example links `Qt6::GuiPrivate` and `Qt6::WaylandClientPrivate` unconditionally, although those components are only found when Qt is at least 6.10. With an older supported Qt version, CMake cannot resolve these imported targets and configuration fails.

**Triggers:** When building the examples with Qt older than 6.10.

**Suggested fix:** Only link the private Qt targets in the same Qt-version conditional, or require Qt 6.10 for this example.

```suggestion
target_link_libraries(${BIN_NAME}
    PRIVATE
        Qt6::Gui
        Qt6::Widgets
        Qt6::WaylandClient
)

if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
    target_link_libraries(${BIN_NAME}
        PRIVATE
            Qt6::GuiPrivate
            Qt6::WaylandClientPrivate
    )
endif()
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/modules/activation/activationmanagerinterfacev1.cpp
Comment on lines +21 to +28
target_link_libraries(${BIN_NAME}
PRIVATE
Qt6::Gui
Qt6::Widgets
Qt6::WaylandClient
Qt6::GuiPrivate
Qt6::WaylandClientPrivate
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The example links Qt6::GuiPrivate and Qt6::WaylandClientPrivate unconditionally, although those components are only found when Qt is at least 6.10. With an older supported Qt version, CMake cannot resolve these imported targets and configuration fails.

Triggers: When building the examples with Qt older than 6.10.

Suggested fix: Only link the private Qt targets in the same Qt-version conditional, or require Qt 6.10 for this example.

Suggested change
target_link_libraries(${BIN_NAME}
PRIVATE
Qt6::Gui
Qt6::Widgets
Qt6::WaylandClient
Qt6::GuiPrivate
Qt6::WaylandClientPrivate
)
target_link_libraries(${BIN_NAME}
PRIVATE
Qt6::Gui
Qt6::Widgets
Qt6::WaylandClient
)
if(Qt6_VERSION VERSION_GREATER_EQUAL 6.10)
target_link_libraries(${BIN_NAME}
PRIVATE
Qt6::GuiPrivate
Qt6::WaylandClientPrivate
)
endif()

Add the server-side implementation of treeland-window-transition-unstable-v1,
which plays a window open/close transition relative to a source rectangle
attached to an xdg-activation token.

A client attaches a persistent transition rectangle (geometry plus an
optional source image) to an xdg_activation_token_v1 before committing the
token. At activation the compositor associates the rectangle with the target
window, animating from the rectangle's global position on open and back to it
on close. The rectangle stays alive, so set_geometry and set_source_buffer
update it immediately.

新增 treeland-window-transition-unstable-v1 的服务端实现,基于关联到
xdg-activation token 的源矩形播放窗口打开/关闭转场。

客户端在提交 token 前挂载一个持久的转场矩形(几何信息及可选源图像)。
激活时合成器将矩形关联到目标窗口,打开时从矩形的全局位置播放动画,
关闭时过渡回该矩形。矩形持续存活,set_geometry / set_source_buffer
可立即更新。

Log: 实现窗口转场协议,基于激活 token 的源矩形播放开/关转场
Influence: 新增窗口转场模块、QML 动画组件及 test-window-transition 样例;
激活流程支持矩形关联并播放开/关动画。
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