Skip to content

feat(dock): adapt to treeland-xwindow-control-unstable-v1 protocol - #1746

Open
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:feat/treeland-xwindow-control-protocol
Open

deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:feat/treeland-xwindow-control-protocol

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Sep 16, 2026 •

Copy link
Copy Markdown

背景

treeland-xwindow-control-unstable-v1 协议(含 set_xwindow_position_relative 接口)已从 treeland-dde-shell-v1 中独立拆分到 treeland-protocols(>=0.6.0,commit 7ba45e4 及之后)。原 treeland_dde_shell_manager_v1 中的 set_xwindow_position_relative 已标记为 deprecated。

dde-shell dock 模块需要适配,将 XEmbed 窗口相对定位调用迁移到新的 treeland_xwindow_control_v1 global 接口。

改动内容

panels/dock/waylanddockhelper.h

  • 新增 #include "qwayland-treeland-xwindow-control-unstable-v1.h"
  • 新增 TreeLandXWindowControl 类,继承 QWaylandClientExtensionTemplate<TreeLandXWindowControl> 和 QtWayland::treeland_xwindow_control_v1,提供 setXWindowPositionRelative 方法
  • 从 TreeLandDDEShellManager 中移除 setXWindowPositionRelative 方法声明(该类保留,仍用于 get_window_overlap_checker)
  • WaylandDockHelper 新增成员 QScopedPointer<TreeLandXWindowControl> m_xwindowControl

panels/dock/waylanddockhelper.cpp

  • 新增 qwayland-treeland-xwindow-control-unstable-v1.h 和 wayland-treeland-xwindow-control-unstable-v1-client-protocol.h 两个 include
  • 实现 TreeLandXWindowControl 构造函数和 setXWindowPositionRelative(检查 isActive(),转调新接口)
  • 删除 TreeLandDDEShellManager::setXWindowPositionRelative 实现
  • 构造函数中新增 m_xwindowControl.reset(new TreeLandXWindowControl())
  • moveXEmbedWindow 中 isActive 检查和 setXWindowPositionRelative 调用从 m_ddeShellManager 改为 m_xwindowControl
  • m_ddeShellManager 的 activeChanged 信号连接和 overlap checker 逻辑保持不动

panels/dock/CMakeLists.txt

  • find_package(TreelandProtocols REQUIRED) → find_package(TreelandProtocols 0.6.0 REQUIRED)
  • qt_generate_wayland_protocol_client_sources 的 FILES 列表追加 treeland-xwindow-control-unstable-v1.xml

debian/control

  • treeland-protocols (>> 0.5.9) → treeland-protocols (>= 0.6.0)

注意事项

  • 新接口 set_xwindow_position_relative 的请求签名和回调语义与旧接口完全一致,moveXEmbedWindow 中的 wl_callback listener 逻辑无需改动
  • TreeLandDDEShellManager 类保留,仅移除 setXWindowPositionRelative 方法
  • 编译环境需安装包含 treeland-xwindow-control-unstable-v1.xml 的 treeland-protocols 包(commit 7ba45e4 或后续发布版本)

Issue: DDE-320

Summary by Sourcery

Adapt dock XEmbed positioning to the standalone Treeland XWindow Control protocol.

Enhancements:

  • Migrate dock XEmbed window relative positioning to the standalone Treeland XWindow Control protocol while retaining DDE shell functionality for window overlap checking.

Build:

  • Require TreelandProtocols 0.6.0 or newer and generate client bindings for the XWindow Control protocol.

Chores:

  • Update the Debian dependency to require treeland-protocols 0.6.0 or newer.

set_xwindow_position_relative has been split from treeland-dde-shell-v1
into the standalone treeland-xwindow-control-unstable-v1 protocol in
treeland-protocols (>=0.6.0, commit 7ba45e4).

Changes:
- Add TreeLandXWindowControl class (QWaylandClientExtensionTemplate +
  QtWayland::treeland_xwindow_control_v1) to bind the new global interface
- Move setXWindowPositionRelative from TreeLandDDEShellManager to
  TreeLandXWindowControl; moveXEmbedWindow now calls the new interface
- TreeLandDDEShellManager is retained for get_window_overlap_checker
- Add treeland-xwindow-control-unstable-v1.xml to
  qt_generate_wayland_protocol_client_sources in panels/dock/CMakeLists.txt
- Lock find_package(TreelandProtocols) to 0.6.0
- Update debian/control Build-Depends to treeland-protocols (>= 0.6.0)

Issue: DDE-320
@sourcery-ai

sourcery-ai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Reviewer's Guide

The dock now positions XEmbed windows through the standalone treeland_xwindow_control_v1 global, preserving the existing callback handling and DDE shell overlap-checker integration while requiring and generating the protocol from TreelandProtocols 0.6.0 or newer.

Sequence diagram for XEmbed positioning via xwindow control

sequenceDiagram
    participant Dock as WaylandDockHelper
    participant Control as TreeLandXWindowControl
    participant Wayland as treeland_xwindow_control_v1
    participant Callback as wl_callback

    Dock->>Control: setXWindowPositionRelative(wid, anchorSurface, dx, dy)
    Control->>Control: isActive()
    Control->>Wayland: set_xwindow_position_relative(wid, anchor, dx, dy)
    Wayland-->>Control: wl_callback
    Control-->>Dock: wl_callback
    Dock->>Callback: register listener
    Wayland-->>Callback: asynchronous result
Loading

File-Level Changes

Change Details Files
Migrate XEmbed relative positioning from the deprecated DDE shell request to the standalone Treeland XWindow Control protocol.
  • Add a client-extension wrapper that checks activation and forwards fixed-point coordinates to the new protocol request.
  • Instantiate the new control extension and use it for readiness checks and asynchronous positioning callbacks.
  • Retain the DDE shell manager for window-overlap functionality while removing its obsolete positioning API.
panels/dock/waylanddockhelper.h
panels/dock/waylanddockhelper.cpp
Generate and consume client bindings for the new protocol with an explicit minimum protocol package version.
  • Require TreelandProtocols 0.6.0 or newer.
  • Add the xwindow-control protocol XML to generated Wayland client sources and include its generated headers.
  • Raise the Debian dependency to treeland-protocols >= 0.6.0.
panels/dock/CMakeLists.txt
debian/control

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-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 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 reviewed your changes and they look great!


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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 总体评分 98 分,大于 70 分通过阈值,代码质量符合要求。本次变更为 Wayland 协议迁移,将 XEmbed 窗口定位接口从 TreeLandDDEShellManager 迁移到独立的 TreeLandXWindowControl,实现清晰、逻辑正确,未发现安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

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

建议: 语法正确,逻辑清晰,空指针检查和 isActive 检查完善,无需修改


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. panels/dock/waylanddockhelper.h:101 - TreeLandXWindowControl::setXWindowPositionRelative 方法声明缺少注释,原 TreeLandDDEShellManager 中的注释在迁移时未同步
  2. panels/dock/waylanddockhelper.cpp:244 - setXWindowPositionRelative 实现缺少注释说明方法用途和返回值

建议: 为新增的 TreeLandXWindowControl::setXWindowPositionRelative 方法添加注释,说明方法用途和返回值语义,保持与原方法注释一致


3. 代码性能 ✅

评价: 优秀 ✅ 通过

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

建议: 性能良好,方法为简单委托模式,QScopedPointer 自动管理内存,无需优化


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: 无安全漏洞,安全合规


💡 改进建议代码示例

// 建议在 waylanddockhelper.h 中为 setXWindowPositionRelative 添加注释
class TreeLandXWindowControl : public QWaylandClientExtensionTemplate<TreeLandXWindowControl>, public QtWayland::treeland_xwindow_control_v1
{
    Q_OBJECT

public:
    explicit TreeLandXWindowControl();

    // Move XEmbed window to position relative to anchor surface
    // Returns wl_callback* or nullptr if not active
    struct ::wl_callback *setXWindowPositionRelative(uint32_t wid, struct ::wl_surface *anchor, double dx, double dy);
};

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

@wineee

wineee commented Sep 16, 2026

Copy link
Copy Markdown
Member

@deepin-bot

deepin-bot Bot commented Sep 22, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.55
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1752

@deepin-bot

deepin-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 2.0.56
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1753

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