Skip to content

refactor(window-transition): attach rect to activation token string - #118

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

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

Conversation

@glyvut

@glyvut glyvut commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Change get_window_transition_rect to accept the committed activation token string instead of an xdg_activation_token_v1 object, so the client no longer needs to hold the token object to create the rect.

将 get_window_transition_rect 改为接收已提交的激活令牌字符串,
不再接收 xdg_activation_token_v1 对象,客户端无需持有令牌对象
即可创建转场矩形。

Log: 转场矩形改用令牌字符串关联
PMS: TASK-395857
Influence: 客户端需在提交令牌后再调用 get_window_transition_rect; 矩形不再要求在令牌提交前创建

Summary by Sourcery

Associate window transition rectangles with committed activation token strings instead of token objects.

Enhancements:

  • Associate window transition rectangles with committed activation token strings, allowing clients to create rectangles without retaining the activation token object.

Documentation:

  • Update the window transition protocol documentation and call sequence to require committing the activation token before creating its transition rectangle.

Change get_window_transition_rect to accept the committed activation
token string instead of an xdg_activation_token_v1 object, so the
client no longer needs to hold the token object to create the rect.

将 get_window_transition_rect 改为接收已提交的激活令牌字符串,
不再接收 xdg_activation_token_v1 对象,客户端无需持有令牌对象
即可创建转场矩形。

Log: 转场矩形改用令牌字符串关联
PMS: TASK-395857
Influence: 客户端需在提交令牌后再调用 get_window_transition_rect;
矩形不再要求在令牌提交前创建
@sourcery-ai

sourcery-ai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Reviewer's Guide

The protocol documentation now associates window transition rectangles with committed activation token strings, allowing clients to release the token object before creating the rectangle and shifting rectangle creation until after token commitment.

Sequence diagram for committed activation token transition setup

sequenceDiagram
    participant A as OriginatingSurface
    participant M as TransitionManager
    participant T as ActivationToken
    participant B as TargetWindow
    participant C as Compositor

    A->>T: set_surface
    A->>T: commit
    T-->>A: token string
    A->>M: get_window_transition_rect(token string)
    M-->>A: rect object
    A->>A: set_geometry
    A->>B: pass token string
    B->>C: xdg_activation_v1.activate(token string, surface)
    C->>C: look up rectangle by token string
    C-->>B: play open transition
Loading

Sequence diagram for live transition rectangle updates and close animation

sequenceDiagram
    participant A as OriginatingSurface
    participant R as TransitionRect
    participant B as TargetWindow
    participant C as Compositor

    A->>R: set_geometry
    A->>R: set_source_surface
    A->>R: set_geometry
    B->>C: close
    C->>R: use latest geometry
    C-->>B: play close transition to rectangle
    C-->>A: closed
    A->>R: destroy
Loading

File-Level Changes

Change Details Files
Redefine rectangle association to use the committed activation token string instead of the token protocol object.
  • Change the request argument from an object reference to a string token.
  • Require clients to commit the activation token before creating the transition rectangle.
  • Update the documented flow and lifecycle semantics to reflect post-commit rectangle creation and continued geometry updates.
public/treeland-window-transition-unstable-v1.xml

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

@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 1 issue

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

## Individual Comments

### Comment 1
<location path="public/treeland-window-transition-unstable-v1.xml" line_range="50-51" />
<code_context>
-        1. A, the originating surface, obtains an xdg_activation_token_v1
-           and calls set_surface to identify itself.
+        1. A, the originating surface, obtains an xdg_activation_token_v1,
+           calls set_surface to identify itself, and calls commit to obtain
+           the token string.
         2. A calls get_window_transition_rect on this manager, passing the
-           token.
</code_context>
<issue_to_address>
**issue:** The documented flow says that A calls `commit` to obtain the token string, but the xdg-activation protocol delivers that string asynchronously in the token object's `done` event. A client following this sequence has no documented point at which it should wait before calling `get_window_transition_rect`, so it can attempt the request before a token string exists.

**Triggers:** When a client follows the numbered flow literally and issues the rectangle request immediately after sending `commit`.

**Suggested fix:** State that A must wait for the xdg activation token object's `done` event and use the token string carried by that event before calling `get_window_transition_rect`.
</issue_to_address>

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

Comment on lines +50 to +51
calls set_surface to identify itself, and calls commit to obtain
the token string.

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: The documented flow says that A calls commit to obtain the token string, but the xdg-activation protocol delivers that string asynchronously in the token object's done event. A client following this sequence has no documented point at which it should wait before calling get_window_transition_rect, so it can attempt the request before a token string exists.

Triggers: When a client follows the numbered flow literally and issues the rectangle request immediately after sending commit.

Suggested fix: State that A must wait for the xdg activation token object's done event and use the token string carried by that event before calling get_window_transition_rect.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: glyvut, wineee

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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 100 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 100 分,大于 70 分通过阈值,代码质量符合要求。本次变更为 Wayland 协议 XML 定义文件的重构,将 get_window_transition_rect 的 token 参数从 xdg_activation_token_v1 对象改为已提交的激活令牌字符串,逻辑清晰,文档完整,无安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: XML 语法正确,Wayland 协议定义规范。type="string" 是合法的 Wayland 协议参数类型。流程重排序逻辑合理:先 commit 获取令牌字符串,再调用 get_window_transition_rect 传入字符串,与新的接口定义一致。


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 文档描述完整且一致,所有引用 token 的位置均已从 object 更新为 string。协议流程步骤从 11 步精简为 10 步,编号连续无遗漏。description 标签内容准确描述了接口用途和使用方式。


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 协议定义文件无运行时性能影响。使用字符串替代对象引用简化了客户端实现,客户端无需持有令牌对象即可创建转场矩形,降低了资源管理复杂度。


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: 存在0个安全漏洞。本次变更为协议定义层面的接口重构,不涉及用户输入处理、凭证管理或权限控制。令牌字符串仍通过 xdg_activation 协议的 commit 机制获取,安全性由协议实现层保障。


💡 改进建议代码示例

// 本次变更为 Wayland 协议定义文件重构,代码质量优秀,无需修改
// get_window_transition_rect 接口变更前:
//   <arg name="token" type="object" interface="xdg_activation_token_v1" .../>
// 变更后:
//   <arg name="token" type="string" .../>
// 接口设计合理,文档完整,无需额外改进

本报告由 AI 代码审查工具自动生成

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