Skip to content

feat: add treeland-foreign-toplevel-manager-unstable-v3, deprecate v2 - #129

Open
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:dk-2-AUTO
Open

glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:dk-2-AUTO

Conversation

@glyvut

@glyvut glyvut commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

v3 replaces v2 and reworks the dock preview popover:

  • The tooltip is a client-drawn wl_surface. get_tooltip_surface returns a treeland_tooltip_surface_v3 that the client marks ready; the compositor shows the tooltip only once ready and a committed buffer have both arrived, draws its popover frame behind it, and uses the committed surface size. show_tooltip(text) is gone.
  • show and close cover the whole popover, and the tooltip surface never takes input, focus, or activation.

Log: 新增 v3 协议,dock tooltip 改为客户端 surface 并就绪后显示
PMS: TASK-396711
Influence: dock 预览与 tooltip 走 v3,v2 废弃;tooltip 内容由客户端绘制

Summary by Sourcery

Introduce the v3 foreign toplevel manager protocol with client-rendered dock tooltips and deprecate v2.

New Features:

  • Add the unstable v3 foreign toplevel manager protocol with client-drawn tooltip surfaces for dock previews.

Enhancements:

  • Replace text tooltips with compositor-framed client surfaces that use committed content and share the preview popover lifecycle.
  • Ensure tooltip surfaces are non-interactive and that preview and tooltip display are mutually exclusive.

Build:

  • Register the v3 protocol as the active DDE protocol and retain v2 as deprecated.

Documentation:

  • Document the v3 protocol, tooltip surface behavior, migration guidance, and deprecation of v2 in English and Chinese.

@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds the v3 foreign toplevel manager protocol as the replacement for v2, updates build and migration documentation, and redesigns dock tooltips around client-rendered wl_surfaces that become visible only after a committed buffer and explicit ready request; v2 remains available only as deprecated XML.

Sequence diagram for the v3 client-drawn dock tooltip

sequenceDiagram
    participant Dock as Dock client
    participant Compositor
    participant Surface as wl_surface
    participant Tooltip as treeland_tooltip_surface_v3

    Dock->>Compositor: get_tooltip_surface
    Compositor-->>Dock: treeland_tooltip_surface_v3
    Dock->>Surface: commit buffer
    Dock->>Tooltip: ready
    Compositor->>Compositor: wait for committed buffer and ready
    Compositor-->>Dock: show tooltip with compositor popover frame
    Compositor->>Surface: use committed logical size
    Dock->>Tooltip: destroy
    Compositor->>Compositor: hide tooltip and release surface role
Loading

Flow diagram for v3 dock popover replacement and closing

flowchart TD
    A[Dock preview context] --> B{Popover action}
    B -->|get_tooltip_surface| C[Tooltip surface pending]
    C --> D{Committed buffer and ready?}
    D -->|No| C
    D -->|Yes| E[Show client content with compositor frame]
    B -->|show| F[Show thumbnail preview]
    F --> G[Replace and clear tooltip ready state]
    B -->|close| H[Hide preview and tooltip]
    H --> I[Tooltip object remains valid; ready must be sent again]
Loading

File-Level Changes

Change Details Files
Introduces the v3 foreign toplevel protocol and moves v2 to the deprecated protocol set.
  • Adds the v3 XML with renamed manager, handle, and dock preview interfaces, reset to version 1.
  • Updates protocol installation lists and English/Chinese documentation for v3 adoption and v2 migration.
  • Preserves the v2 XML unchanged under deprecated/.
CMakeLists.txt
dde/README.md
dde/README.zh_CN.md
dde/treeland-foreign-toplevel-manager-unstable-v3.xml
deprecated/treeland-foreign-toplevel-manager-unstable-v2.xml
Replaces compositor-rendered text tooltips with client-drawn tooltip surfaces governed by an explicit readiness lifecycle.
  • Adds get_tooltip_surface, assigning a compositor-side role to a client-owned wl_surface and returning a tooltip object.
  • Adds ready gating so the compositor displays the tooltip and frame only after both readiness and a committed buffer are present.
  • Uses the committed surface size, keeps the tooltip input-inert and client-owned, and releases the role when the tooltip object is destroyed.
  • Documents invalid-surface validation, buffer reuse, replacement, close, and destruction semantics.
dde/README.md
dde/README.zh_CN.md
dde/treeland-foreign-toplevel-manager-unstable-v3.xml
Unifies dock preview and tooltip visibility under one popover lifecycle.
  • Makes show replace a visible tooltip and close hide both preview and tooltip.
  • Defines shared positioning relative to the anchor surface and compositor-drawn framing behind tooltip content.
  • Retains tooltip objects across context destruction or hiding while clearing readiness when the current popover is replaced or closed.
dde/README.md
dde/README.zh_CN.md
dde/treeland-foreign-toplevel-manager-unstable-v3.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 3 issues

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

## Individual Comments

### Comment 1
<location path="dde/treeland-foreign-toplevel-manager-unstable-v3.xml" line_range="17" />
<code_context>
+        and must not rely on the current interface names, requests, events, or
+        semantics remaining stable across releases.
+
+        This protocol allows privileged clients such as dock or taskbar
+        components to observe and manage toplevel windows on behalf of the
+        compositor. It provides access to window metadata (title, app-id,
</code_context>
<issue_to_address>
**Untrusted clients can control windows**

When the compositor exposes the v3 global to a non-privileged client without filtering binds, a non-privileged Wayland client that can bind the manager receives mapped-window metadata and can send handle requests such as `close`, `activate`, and `set_fullscreen`, exposing private window information and allowing unauthorized window control.

Normatively require the compositor to reject binds from non-privileged clients, and enforce that restriction when exposing or binding the global.
</issue_to_address>

### Comment 2
<location path="dde/treeland-foreign-toplevel-manager-unstable-v3.xml" line_range="669" />
<code_context>
+                marked ready but has not been shown yet.
+
+                If the context that created this object has been destroyed
+                or no longer displays a tooltip, ready has no effect.
+
+                The client may send ready in the same batch as
</code_context>
<issue_to_address>
**Closed tooltips cannot reopen**

When a client closes a visible tooltip and then sends `ready` on its existing tooltip object, the `ready` request has no effect after `close` leaves the context displaying no tooltip, so a client following `close`'s instruction to send `ready` again cannot redisplay the still-valid tooltip and must destroy and recreate it.

Clarify that `ready` after `close` re-enables the retained tooltip, and limit the no-effect rule to cases where the tooltip object is no longer the context's active tooltip or its context has been destroyed.
</issue_to_address>

### Comment 3
<location path="dde/README.md" line_range="28" />
<code_context>

 ### 0.8.0

+#### `treeland-foreign-toplevel-manager-unstable-v2.xml`
+
+Superseded by `treeland-foreign-toplevel-manager-unstable-v3.xml`; the old v2 file moved to `deprecated/` unchanged. The protocol and its interfaces were renamed and the text tooltip was replaced by a client-drawn tooltip surface:
</code_context>
<issue_to_address>
**Protocol heading level is wrong**

The new protocol subsection uses `####` in both READMEs, but the required format uses `#####` for each protocol. The new entry therefore does not follow the prescribed breaking-change structure in either language.

Change the new protocol subsection headings to `#####` in both READMEs.

Also at `dde/README.zh_CN.md:28`.
</issue_to_address>

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

Comment thread dde/treeland-foreign-toplevel-manager-unstable-v3.xml
Comment thread dde/treeland-foreign-toplevel-manager-unstable-v3.xml Outdated
Comment thread dde/README.md

### 0.8.0

#### `treeland-foreign-toplevel-manager-unstable-v2.xml`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ Low · Protocol heading level is wrong

The new protocol subsection uses #### in both READMEs, but the required format uses ##### for each protocol. The new entry therefore does not follow the prescribed breaking-change structure in either language.

Change the new protocol subsection headings to ##### in both READMEs.

Also at dde/README.zh_CN.md:28.

Prompt for AI agents
In `dde/README.md` at line 28:

**Protocol heading level is wrong**

The new protocol subsection uses `####` in both READMEs, but the required format uses `#####` for each protocol. The new entry therefore does not follow the prescribed breaking-change structure in either language.

Change the new protocol subsection headings to `#####` in both READMEs.

Also at `dde/README.zh_CN.md:28`.

From AGENTS.md L79, AGENTS.md L90-112:

When a protocol is superseded or no longer needed, follow these steps:

Comment thread dde/treeland-foreign-toplevel-manager-unstable-v3.xml Outdated
@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

v3 replaces v2 and reworks the dock preview popover:

- The tooltip is a client-drawn wl_surface. get_tooltip_surface returns a
  treeland_tooltip_surface_v3 that the client marks ready; the compositor
  shows the tooltip only once ready and a committed buffer have both
  arrived, draws its popover frame behind it, and uses the committed
  surface size. show_tooltip(text) is gone.
- show and close cover the whole popover, and the tooltip surface never
  takes input, focus, or activation.

Log: 新增 v3 协议,dock tooltip 改为客户端 surface 并就绪后显示
PMS: TASK-396711
Influence: dock 预览与 tooltip 走 v3,v2 废弃;tooltip 内容由客户端绘制
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交新增 treeland-foreign-toplevel-manager-unstable-v3 协议定义文件,弃用 v2 并移至 deprecated 目录,同步更新 CMakeLists.txt 与中英文 README 文档。协议 XML 语法正确、结构清晰,三个接口(manager、handle、dock_preview_context)定义完整且逻辑自洽;所有请求、事件、枚举均有详尽描述;无安全漏洞,协议设计包含 surface 归属校验、tooltip surface 不接收输入/焦点等安全机制。四维度全部通过,代码质量优秀。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

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

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

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

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

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

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例


本报告由 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