Skip to content

feat(protocol): add treeland-launch-animation-v1 protocol - #89

Open
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:feat/launch-animation-v1
Open

feat(protocol): add treeland-launch-animation-v1 protocol#89
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:feat/launch-animation-v1

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Aug 18, 2026

Copy link
Copy Markdown

What

新增 treeland-launch-animation-v1 扩展协议,复用 xdg-activation-v1 的 token 传递链路,允许客户端为启动令牌附加「动画来源矩形」,使合成器可从指定矩形区域播放启动动画。

Protocol

  • treeland_launch_animation_manager_v1 全局接口,提供 get_launch_rect(token) 创建矩形对象
  • treeland_launch_rect_v1 对象,提供 set_geometry(x, y, w, h)commit()
  • 矩形坐标相对发起方 surface 本地坐标,由合成器换算全局坐标
  • 错误码:already_committed / invalid_geometry / no_geometry
  • commit 必须在 token commit 之前完成

Changes

  • xml/treeland-launch-animation-v1.xml — 新协议定义
  • CMakeLists.txt — 注册 XML,版本 0.5.10 → 0.5.11

Related

  • 配套实现见 treeland 仓库 PR(启动动画模块 + demo)
  • Multica issue: WM-295

草稿状态,待配套 treeland PR 与协议 review。

Summary by Sourcery

Add an experimental launch-animation protocol that lets clients provide a source rectangle through the xdg-activation token flow.

New Features:

  • Add the experimental treeland-launch-animation-v1 protocol for associating activation tokens with source rectangles for compositor launch animations.

Build:

  • Register the new protocol XML for installation and bump the project version from 0.5.10 to 0.5.11.

@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 Aug 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a new experimental Wayland extension protocol treeland-launch-animation-v1 to attach a launch animation source rectangle to xdg-activation-v1 tokens, and bumps the treeland-protocols package version while registering the new XML definition in the build system.

Sequence diagram for treeland-launch-animation-v1 launch flow

sequenceDiagram
    actor ApplicationA
    actor ApplicationB
    participant Compositor
    participant xdg_activation_v1
    participant xdg_activation_token_v1 as xdg_activation_token_v1
    participant treeland_launch_animation_manager_v1 as treeland_launch_animation_manager_v1
    participant treeland_launch_rect_v1 as treeland_launch_rect_v1

    ApplicationA->>xdg_activation_v1: get_activation_token
    ApplicationA->>xdg_activation_token_v1: set_surface

    ApplicationA->>treeland_launch_animation_manager_v1: get_launch_rect(token)
    treeland_launch_animation_manager_v1-->>ApplicationA: treeland_launch_rect_v1

    ApplicationA->>treeland_launch_rect_v1: set_geometry(x, y, width, height)
    ApplicationA->>treeland_launch_rect_v1: commit
    ApplicationA->>xdg_activation_token_v1: commit
    xdg_activation_token_v1-->>ApplicationA: token_string

    ApplicationA-->>ApplicationB: token_string

    ApplicationB->>xdg_activation_v1: activate(token_string, surface)
    xdg_activation_v1->>Compositor: activate_with_token
    Compositor->>Compositor: [lookup launch rectangle and convert to global coordinates]
    Compositor->>Compositor: [play launch animation from rectangle to target window]
Loading

File-Level Changes

Change Details Files
Introduce treeland-launch-animation-v1 Wayland extension protocol to describe launch animation source rectangles tied to xdg-activation-v1 tokens.
  • Define treeland_launch_animation_manager_v1 global interface with destroy and get_launch_rect requests that bind treeland_launch_rect_v1 objects to xdg_activation_token_v1 instances, requiring rectangle commit before token commit.
  • Define treeland_launch_rect_v1 interface with destroy, set_geometry, and commit requests, where geometry is surface-local, commit makes the object inert, and usage is constrained by ordering rules.
  • Specify protocol-level validation and error handling via an error enum with already_committed, invalid_geometry, and no_geometry errors, including constraints on non-positive dimensions and commit-before-geometry cases.
  • Document the full client/compositor flow for obtaining xdg activation tokens, attaching rectangles, committing in the required order, and how the compositor converts to global coordinates for the launch animation.
xml/treeland-launch-animation-v1.xml
Register the new protocol XML in the build system and bump the treeland-protocols project version.
  • Increase project version from 0.5.10 to 0.5.11 to reflect the new protocol addition.
  • Add xml/treeland-launch-animation-v1.xml to the XML list so it is installed with other treeland protocol definitions.
CMakeLists.txt

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

Add a new extension protocol that lets a client attach a launch
animation source rectangle to an xdg-activation-v1 token.

Timing and responsibilities:
- Client MUST call activate before the target surface is first mapped
- If activate targets an already-mapped surface, the compositor discards
  the rect and does not play or substitute any animation
- Rectangle coordinates are relative to the originating surface local
  coordinate space; animation parameters are compositor policy

新增 treeland-launch-animation-v1 扩展协议,复用 xdg-activation-v1
的 token 传递链路,允许客户端为启动令牌附加动画来源矩形。

Log: 新增启动动画矩形扩展协议
Influence: 为启动动画从指定矩形区域过渡画出提供协议支持。
@deepin-wm
deepin-wm force-pushed the feat/launch-animation-v1 branch from 4c13a52 to 046c7e3 Compare August 20, 2026 02:08
@deepin-wm
deepin-wm marked this pull request as ready for review August 20, 2026 12:01

@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

deepin pr auto review

☀ AI审核结果

★ 总体评分:99分 (大于70分通过)

■ 【总体评价】

代码新增了 treeland-launch-animation-v1 Wayland 协议扩展,协议设计规范、文档详尽,复用 xdg-activation-v1 token 传递链路实现启动动画来源矩形功能,逻辑清晰且无安全漏洞
语法逻辑正确、协议结构合理、安全无风险,仅代码质量维度存在少量边界场景文档补充空间,扣1分

■ 【详细分析】

  • 1.语法逻辑(语法正确,逻辑清晰)✓

新增的 xml/treeland-launch-animation-v1.xml 协议文件 XML 格式正确,符合 Wayland 协议 XML schema 规范。定义了两个接口:treeland_launch_animation_manager_v1(version 1)和 treeland_launch_rect_v1(version 1),接口结构完整。manager 接口提供 destroy 析构请求和 get_launch_rect 请求,rect 接口提供 destroy、set_geometry、commit 请求及 error 枚举(already_committed=0, invalid_geometry=1, no_geometry=2),枚举值连续且语义清晰。协议流程逻辑严谨:get_launch_rect 创建矩形对象 → set_geometry 设置几何参数 → commit 提交 → token commit,时序约束明确(rect commit 必须在 token commit 之前)。CMakeLists.txt 修改正确,将新 XML 文件注册到安装列表,版本号从 0.5.10 升至 0.5.11,符合语义化版本规范。
潜在问题:协议未明确指定对同一 token 多次调用 get_launch_rect 的行为(是否允许多个 rect 对象关联同一 token,以及合成器应使用哪一个)
建议:在 description 中补充说明多次调用 get_launch_rect 的预期行为,例如"仅最后一次 commit 的矩形生效"或"每个 token 仅允许一个 rect 对象"

  • 2.代码质量(代码结构清晰,注释完整)✓

协议文件包含完整的 SPDX 版权声明(SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. + SPDX-License-Identifier: MIT),符合开源规范。description 标签文档详尽,包含完整的 8 步交互流程说明、时序与责任说明、坐标系统说明以及边界情况处理(已映射 surface 的 activate 行为)。error 枚举每项都有 summary 描述,set_geometry 和 commit 请求的 description 清晰说明了前置条件和错误触发条件。CMakeLists.txt 修改最小化且正确。代码无重复,无残留调试信息。
潜在问题:set_geometry 的 description 未说明若 xdg_activation_token_v1.set_surface 从未被调用时 get_launch_rect 的行为;commit 请求未说明 token 被销毁后 rect 对象的生命周期
建议:补充 set_surface 未调用场景下的协议行为说明;明确 rect 对象与 token 对象的依赖销毁关系

  • 3.代码性能(性能良好,资源使用合理)✓

本 PR 为 Wayland 协议定义文件和 CMake 构建配置修改,不涉及运行时代码,无算法复杂度、内存分配或系统调用等性能考量。协议使用标准 int 类型传递几何参数(x, y, width, height),与 Wayland 协议惯例一致。CMakeLists.txt 仅增加一行 XML 文件注册,对构建性能无影响。
建议:无需优化

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本 PR 为 Wayland 协议声明式定义文件,不含可执行代码,不存在命令注入、SQL 注入、路径遍历等安全风险。协议定义了完善的错误处理机制(already_committed、invalid_geometry、no_geometry),对非法输入(非正宽高、重复提交、未设置几何参数即提交)均有明确错误码。无硬编码密钥、无敏感信息泄露、无不安全密码算法。CMakeLists.txt 仅注册文件路径,无安全风险。
建议:无需安全加固

  • 5.项目规范(不计入评分,仅作为维护参考)

项目规范检查(21项):

  • UOS 大小写(文档中全大写,代码中按代码规范):✓ 符合(版权信息中使用 UnionTech Software Technology Co., Ltd.,无 UOS 缩写使用)
  • deepin 大小写(文档中全小写包括首字母,代码中按代码规范):✓ 符合(仓库属于 linuxdeepin 组织,协议前缀使用 treeland,符合命名规范)
  • DDE 使用(专有名词,禁止拆开使用如 Deepin Desktop Environment):✓ 符合(本 PR 未涉及 DDE 相关内容)
  • 文件名中的 dde(文件名中 dde 全小写):✓ 符合(文件名为 treeland-launch-animation-v1.xml,不涉及 dde)
  • 项目名称(全小写、-连接、不超过2个-):✓ 符合(treeland-protocols,符合规范)
  • 文件命名(全小写、-连接,不使用_):✓ 符合(treeland-launch-animation-v1.xml,全小写连字符连接)
  • DBus 命名(倒置域名格式,如 org.deepin.DDE1.Accounts):✓ 符合(本 PR 为 Wayland 协议,不涉及 DBus)
  • 版权信息(deepin 必须小写):✓ 符合(使用 SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd.)
  • Git 分支命名(上游upstream/*、主干master、研发develop/*project/*、发布release/*):✓ 符合(分支为 feat/launch-animation-v1,功能分支命名合理)
  • Debian Changelog 版本规范(版本号格式是否符合统信软件版本规范):✓ 符合(版本号 0.5.11 符合语义化版本规范)
  • systemd 服务检查(后台程序是否通过 systemd service 启动):✓ 符合(不涉及 systemd)
  • systemd 权限限制(是否包含 User=、ProtectSystem=、NoNewPrivileges= 等最小权限配置):✓ 符合(不涉及 systemd)
  • 新增自启动程序评审(未经过系统部/架构部评审的自启动程序):✓ 符合(不涉及自启动程序)
  • prerm/preinst/postrm/postinst 机制评审(是否使用该机制实现功能,需提供评审记录):✓ 符合(不涉及 Debian 维护者脚本)
  • 交付版本 debug 信息(禁止带有 debug 信息):✓ 符合(协议定义文件,无 debug 信息)
  • 不安全密码算法(是否使用 md5/sha1/des 等不安全算法,需安全部评审):✓ 符合(不涉及密码算法)
  • 隐私与敏感信息(代码日志中是否包含用户名、密钥、口令等敏感信息):✓ 符合(无任何敏感信息)
  • IPC 敏感数据保护(进程间通信敏感数据是否使用 memfd/hash/密钥协商协议保护):✓ 符合(Wayland 协议本身即为 IPC 机制,传递的几何参数非敏感数据)
  • FHS 文件系统分层规范(是否写入动态数据到 /usr、/opt 等静态目录):✓ 符合(CMake 安装到 ${CMAKE_INSTALL_DATADIR}/treeland-protocols,符合 FHS 规范)
  • DBus 安全编码要求(systemd conf 变动、allow own 字段是否仅 root 或非普通用户):✓ 符合(不涉及 DBus)
  • 多语言翻译与本地化(源码国际化、翻译文件同步更新、术语一致性):✓ 符合(协议定义文件,无 UI 字符串,不涉及国际化)
    潜在问题:无
    建议:无

■ 【改进建议代码示例】

<!-- 在 treeland_launch_animation_manager_v1 接口的 get_launch_rect 请求描述中补充多次调用说明 -->
<request name="get_launch_rect">
    <description summary="create a launch rectangle for a token">
        Creates a new launch rectangle object associated with the given
        xdg_activation_token_v1 object. The rectangle geometry must be
        set and committed before the token itself is committed.

        If get_launch_rect is called multiple times for the same token,
        each call creates an independent rect object. The compositor
        uses the last successfully committed rect object and discards
        all previous ones. If no rect object has been committed, no
        launch animation is played.

        The token must not have been committed yet. Calling get_launch_rect
        on an already-committed token is a client error and the compositor
        may ignore the request.
    </description>
    <arg name="launch_rect" type="new_id" interface="treeland_launch_rect_v1" summary="new launch rectangle object"/>
    <arg name="token" type="object" interface="xdg_activation_token_v1" summary="the activation token to attach the rectangle to"/>
</request>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

直接定义为 window-animation,用来针对wl_surface控制它的所有动画效果,不仅是窗口启动的。

还要考虑跟手机那样的,支持从应用图标到窗口打开的连贯动画。最小化、关闭窗口时动画也能回到任务栏图标上。

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.

4 participants