Skip to content

feat(protocol): add treeland-snap-target-unstable-v1 protocol - #87

Open
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:master
Open

glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:master

Conversation

@glyvut

@glyvut glyvut commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Add the experimental compositor snap-target protocol for driving client-rendered snap previews.

New Features:

  • Add the experimental treeland snap-target protocol for compositor-provided snap region hints, optional owning-process pidfds, and custom snap preview surfaces.

Build:

  • Install and distribute the new snap-target protocol XML as a public protocol.

Documentation:

  • Document the new snap-target protocol and its pidfd event option in English and Chinese public protocol catalogs.

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

@sourcery-ai

sourcery-ai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds and installs an experimental compositor-side snap-target Wayland protocol that lets clients render snap previews, optionally receive owning-process pidfds, and use specially tagged overlay surfaces, with corresponding English and Chinese documentation.

Sequence diagram for the snap target session

sequenceDiagram
    participant Client
    participant Compositor

    Client->>Compositor: start(events)
    alt Snap session available
        Compositor->>Compositor: Capture window layout and stacking order
        Compositor-->>Client: pidfd(pidfd) when enabled and applicable
        Compositor-->>Client: snap_region(x, y, width, height)
        Client->>Client: Render snap preview
        Client->>Compositor: stop()
    else Another client is snapping
        Compositor-->>Client: failed(snap_busy)
        Client->>Compositor: destroy()
    end
Loading

File-Level Changes

Change Details Files
Define an experimental Wayland protocol for compositor-driven snap-preview sessions.
  • Add a singleton snap-target interface with start/stop lifecycle and single-session arbitration.
  • Capture window layout at session start and emit cursor-selected target rectangles in global logical coordinates.
  • Document optional pidfd notifications, event ordering, failure handling, and stale captured targets.
public/treeland-snap-target-unstable-v1.xml
Add optional compositor-managed snap-mask overlay behavior to the protocol contract.
  • Specify the xdg-toplevel tag used to identify snap preview overlays.
  • Define overlay stacking, positioning, decoration, animation, workspace/UI exclusion, and layout-management rules.
  • Exclude tagged overlays from snap-target reporting.
public/treeland-snap-target-unstable-v1.xml
Expose and document the new public protocol.
  • Install the protocol XML with the public protocol files.
  • Add English and Chinese catalog entries describing snap-region hints and optional pidfd events.
CMakeLists.txt
public/README.md
public/README.zh_CN.md

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

@deepin-bot

deepin-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.5.10
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #88

Comment thread CMakeLists.txt Outdated
@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.6.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #108

@glyvut
glyvut force-pushed the master branch 2 times, most recently from 61964a5 to e993d0d Compare September 17, 2026 01:11
Add a public protocol for snap region hints: while a snap session is
active, the compositor tracks the cursor and reports the currently
hovered rectangle. A client may opt in to the optional pidfd event for
window targets via the event_type bitfield of start. Register the XML
in CMakeLists and list it in both READMEs.

新增 public 协议 treeland-snap-target-unstable-v1:会话期间合成器跟踪
光标并上报当前 hover 的矩形;窗口目标的 pidfd 为可选事件,需在 start
的 event_type 位掩码中启用。在 CMakeLists 注册该 XML,并更新中英文
public README 的协议表。

Log: 新增 treeland-snap-target 吸附区域提示协议
PMS: TASK-395745
Influence: 仅新增公开协议,客户端可获取当前 hover 的矩形,并可按需启用窗口属主 pidfd;不影响既有协议与消费者行为。
@glyvut glyvut changed the title capture snap feat(protocol): add treeland-snap-target-unstable-v1 protocol Sep 17, 2026
@glyvut
glyvut marked this pull request as ready for review September 17, 2026 05:54
@glyvut
glyvut requested a review from wineee September 17, 2026 05:55

@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-snap-target-unstable-v1.xml" line_range="180-184" />
<code_context>
+        This event is sent each time the snap target changes due to cursor
+        movement.
+
+        This event commits the snap target. A pidfd event, when sent for
+        this target, precedes it and reports the process owning the target.
+        When processing this event, the client should associate the most
+        recent preceding pidfd event, if any, with this target; if no pidfd
+        event precedes it, the target has no associated process.
+
+        The region is in global logical coordinates (i.e., the
</code_context>
<issue_to_address>
**issue (bug_risk):** The instruction to associate the “most recent preceding pidfd event” lets a client associate a stale window's pidfd with a later `snap_region` for an output, empty space, destroyed window, or an unidentifiable process, because those transitions intentionally omit a pidfd event. The pidfd association must be scoped to the immediately following `snap_region` event rather than retained across region events.

**Triggers:** When a window target with an emitted pidfd is followed by a non-window or otherwise unidentifiable target.

**Suggested fix:** State that a pidfd event applies only to the immediately following `snap_region` event and that every `snap_region` without an immediately preceding pidfd has no associated process.

```suggestion
        This event commits the snap target. A pidfd event, when sent for
        this target, immediately precedes it and reports the process owning
        the target. A pidfd event applies only to the immediately following
        snap_region event. Every snap_region event without an immediately
        preceding pidfd event has no associated process.
```
</issue_to_address>

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

Comment thread public/treeland-snap-target-unstable-v1.xml
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交新增 Wayland 协议定义文件 treeland-snap-target-unstable-v1.xml,用于合成器侧吸附区域提示。协议设计合理,XML 格式正确,文档详尽,无安全漏洞。CMakeLists 注册和 README 更新均符合现有模式。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

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

建议: []


2. 代码质量 ✅

评价: 优秀 ✅ 通过

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

建议: []


3. 代码性能 ✅

评价: 优秀 ✅ 通过

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

建议: []


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 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