Skip to content

fix: treat empty token in place_below as bottom sentinel - #1399

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wineee:wine-update-0.2
Sep 15, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wineee:wine-update-0.2

Conversation

@wineee

@wineee wineee commented Sep 14, 2026

Copy link
Copy Markdown
Member
  1. An empty sibling_token in place_below now places the sub-surface
    at the very bottom of the sibling stack, symmetric to the
    empty-token "top" behavior of place_above
  2. Add placeChildBelowParentBottom helper that prepends to
    belowChildren and syncs the z-order
  3. Matches the updated treeland-remote-subsurface-unstable-v1
    protocol, which documents the empty string as a sentinel for
    both restack requests

Log: place_below with an empty sibling_token no longer emits
invalid_sibling; it now moves the sub-surface to the very bottom of
the stacking order, as place_above("") already moves to the top.

Influence:

  1. Send place_below with an empty token and verify the remote
    subsurface is placed below all siblings and below parent content
  2. Send place_above with an empty token and verify it still moves
    the subsurface to the very top
  3. Send place_above/place_below with an unknown token and verify
    invalid_sibling is emitted and z-order is unchanged
  4. Regression: ordering by parent token and sibling token keeps
    working as before

fix: place_below 空 token 作为置底哨兵值处理

  1. place_below 传入空 sibling_token 时现在会将子表面放到兄弟
    堆叠的最底部,与 place_above 空 token "置顶"行为对称
  2. 新增 placeChildBelowParentBottom 辅助函数,prepend 到
    belowChildren 并同步 z-order
  3. 与更新后的 treeland-remote-subsurface-unstable-v1 协议一致,
    该协议将空字符串记录为两个重排请求的哨兵值

Log: place_below 传入空 sibling_token 不再发送 invalid_sibling,
而是将子表面移到堆叠最底部,与 place_above("") 已有的置顶行为
对称。

Influence:

  1. 发送携带空 token 的 place_below,验证远程子表面被放到所有
    兄弟之下且位于父内容之下
  2. 发送携带空 token 的 place_above,验证其仍将子表面移到最顶部
  3. 发送携带未知 token 的 place_above/place_below,验证发出
    invalid_sibling 事件且 z-order 不变
  4. 回归:按父 token 和兄弟 token 的排序行为保持不变

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements remote subsurface protocol v2 by adding explicit above-all/below-all stacking requests, changing empty or unknown sibling tokens to invalid_sibling errors, and advertising interface version 2 while retaining version-gated compatibility for v1 clients.

Sequence diagram for remote subsurface v2 stacking requests

sequenceDiagram
    participant Client
    participant Manager as WRemoteSubsurfaceManagerV1
    participant Subsurface as RemoteSubsurfaceContext
    participant Parent

    Client->>Manager: bind(version=2)
    Client->>Subsurface: place_above_all()
    Subsurface->>Manager: placeChildAboveParentTop(this)
    Manager->>Parent: syncRemoteSubsurfaceOrder(parent)
    Parent-->>Client: remote subsurface above siblings and parent content

    Client->>Subsurface: place_below_all()
    Subsurface->>Manager: placeChildBelowParentBottom(this)
    Manager->>Parent: syncRemoteSubsurfaceOrder(parent)
    Parent-->>Client: remote subsurface below siblings and parent content
Loading

Sequence diagram for invalid remote subsurface sibling tokens

sequenceDiagram
    participant Client
    participant Subsurface as RemoteSubsurfaceContext
    participant Manager as WRemoteSubsurfaceManagerV1

    Client->>Subsurface: place_above(sibling_token)
    Subsurface->>Manager: findExportedByToken(sibling_token)
    Manager-->>Subsurface: no matching sibling
    Subsurface-->>Client: invalid_sibling(sibling_token)

    Client->>Subsurface: place_below(sibling_token)
    Subsurface->>Manager: findExportedByToken(sibling_token)
    Manager-->>Subsurface: no matching sibling
    Subsurface-->>Client: invalid_sibling(sibling_token)

    Note over Client,Subsurface: Z-order remains unchanged
Loading

File-Level Changes

Change Details Files
Adds explicit v2 operations for moving a remote subsurface to the top or bottom of its parent stacking order.
  • Expose and implement place_above_all and place_below_all requests.
  • Reuse parent-boundary ordering helpers and synchronize the updated remote subsurface order.
waylib/src/server/protocols/wremotesubsurfacemanagerv1.cpp
Makes sibling-token validation consistent and removes the legacy empty-token promotion behavior.
  • Reject empty and unknown tokens for place_above with invalid_sibling.
  • Let place_below use the same lookup-based validation path, preserving invalid_sibling behavior.
waylib/src/server/protocols/wremotesubsurfacemanagerv1.cpp
Upgrades the advertised remote subsurface manager protocol version to v2.
  • Change InterfaceVersion from 1 to 2 so the new requests are negotiated through the wire-level version check.
waylib/src/server/protocols/wremotesubsurfacemanagerv1.h

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="waylib/src/server/protocols/wremotesubsurfacemanagerv1.cpp" line_range="185-189" />
<code_context>
     void set_position(Resource *resource, int32_t x, int32_t y) override;
     void place_above(Resource *resource, const QString &sibling_token) override;
     void place_below(Resource *resource, const QString &sibling_token) override;
+    void place_above_all(Resource *resource) override;
+    void place_below_all(Resource *resource) override;

</code_context>
<issue_to_address>
**issue (bug_risk):** The implementation adds `place_above_all` and `place_below_all` overrides and advertises interface version 2, but the diff does not update the `treeland-remote-subsurface-unstable-v1.xml` protocol source used by CMake to generate the QtWayland server base classes. The generated base therefore has no v2 requests, so these `override` declarations fail to compile; if the generated code is supplied externally, the server instead advertises version 2 without exposing the new requests in the wire protocol.

**Suggested fix:** Update the protocol XML (and its generated bindings or protocol dependency) to define both requests at version 2 before compiling this implementation.
</issue_to_address>

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

Comment thread waylib/src/server/protocols/wremotesubsurfacemanagerv1.cpp Outdated
1. An empty sibling_token in place_below now places the sub-surface
   at the very bottom of the sibling stack, symmetric to the
   empty-token "top" behavior of place_above
2. Add placeChildBelowParentBottom helper that prepends to
   belowChildren and syncs the z-order
3. Matches the updated treeland-remote-subsurface-unstable-v1
   protocol, which documents the empty string as a sentinel for
   both restack requests

Log: place_below with an empty sibling_token no longer emits
invalid_sibling; it now moves the sub-surface to the very bottom of
the stacking order, as place_above("") already moves to the top.

Influence:
1. Send place_below with an empty token and verify the remote
   subsurface is placed below all siblings and below parent content
2. Send place_above with an empty token and verify it still moves
   the subsurface to the very top
3. Send place_above/place_below with an unknown token and verify
   invalid_sibling is emitted and z-order is unchanged
4. Regression: ordering by parent token and sibling token keeps
   working as before

fix: place_below 空 token 作为置底哨兵值处理

1. place_below 传入空 sibling_token 时现在会将子表面放到兄弟
   堆叠的最底部,与 place_above 空 token "置顶"行为对称
2. 新增 placeChildBelowParentBottom 辅助函数,prepend 到
   belowChildren 并同步 z-order
3. 与更新后的 treeland-remote-subsurface-unstable-v1 协议一致,
   该协议将空字符串记录为两个重排请求的哨兵值

Log: place_below 传入空 sibling_token 不再发送 invalid_sibling,
而是将子表面移到堆叠最底部,与 place_above("") 已有的置顶行为
对称。

Influence:
1. 发送携带空 token 的 place_below,验证远程子表面被放到所有
   兄弟之下且位于父内容之下
2. 发送携带空 token 的 place_above,验证其仍将子表面移到最顶部
3. 发送携带未知 token 的 place_above/place_below,验证发出
   invalid_sibling 事件且 z-order 不变
4. 回归:按父 token 和兄弟 token 的排序行为保持不变

PMS: TASK-393795
@wineee wineee changed the title feat: implement remote subsurface protocol v2 fix: treat empty token in place_below as bottom sentinel Sep 14, 2026
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@wineee

wineee commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

/merge

@deepin-bot
deepin-bot Bot merged commit 3c31ceb into linuxdeepin:master Sep 15, 2026
10 of 11 checks passed
@wineee
wineee deleted the wine-update-0.2 branch September 15, 2026 01:50
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