Skip to content

feat: adapt to treeland-region-watch-unstable-v1 protocol - #1756

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/bot/33c2f56674a2
Oct 12, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
deepin-wm:agent/bot/33c2f56674a2

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Oct 12, 2026 •

Copy link
Copy Markdown

Description

Adapt the dock panel to the new treeland-region-watch-unstable-v1 protocol, replacing the deprecated treeland_window_overlap_checker interface from dde-shell-v1.

Changes

  1. CMakeLists.txt — Add treeland-region-watch-unstable-v1.xml protocol source and lock TreelandProtocols to >= 0.7.0
  2. waylanddockhelper.h — Replace TreeLandWindowOverlapChecker with TreeLandRegionWatchManager + TreeLandRegionWatch; rename updateOverlapCheckerPos → updateRegionWatchPos; add output_removed event override
  3. waylanddockhelper.cpp — Adapt to new protocol creation path (get_region_watch), extract shared ensureRegionWatch lambda, migrate anchor enums, replace update() → set_region(), add output_removed event handling

Related

Summary by Sourcery

Migrate dock panel overlap monitoring to the Treeland region-watch protocol.

New Features:

  • Adapt dock overlap detection to the Treeland region-watch protocol, including output removal handling.

Enhancements:

  • Replace the deprecated window overlap checker integration with the region-watch manager and watcher APIs.
  • Update dock region reporting for the new protocol’s anchors and region-setting behavior.

Build:

  • Require TreelandProtocols 0.7.0 and generate client sources for the region-watch protocol.

@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

@sourcery-ai

sourcery-ai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The dock panel now tracks window overlap through Treeland’s treeland-region-watch-unstable-v1 protocol instead of the deprecated dde-shell overlap-checker interface, including updated protocol generation, lifecycle management, region updates, and output-removal handling.

Sequence diagram for dock region-watch overlap tracking

sequenceDiagram
    participant DockPanel
    participant WaylandDockHelper
    participant RegionWatchManager
    participant RegionWatch
    participant Treeland

    DockPanel->>WaylandDockHelper: hideModeChanged
    WaylandDockHelper->>RegionWatchManager: get_region_watch()
    RegionWatchManager-->>WaylandDockHelper: treeland_region_watch_v1
    WaylandDockHelper->>RegionWatch: set_region(width, height, anchor, output)
    Treeland-->>RegionWatch: treeland_region_watch_v1_enter()
    RegionWatch->>WaylandDockHelper: isWindowOverlapChanged(true)
    Treeland-->>RegionWatch: treeland_region_watch_v1_leave()
    RegionWatch->>WaylandDockHelper: isWindowOverlapChanged(false)
    Treeland-->>RegionWatch: treeland_region_watch_v1_output_removed()
    RegionWatch->>WaylandDockHelper: isWindowOverlapChanged(false)
Loading

File-Level Changes

Change Details Files
Replace the deprecated overlap-checker protocol with the region-watch protocol throughout the dock’s Wayland integration.
  • Require TreelandProtocols 0.7.0 and generate client bindings for the region-watch XML.
  • Instantiate a region-watch manager and create/destroy per-dock region-watch objects based on SmartHide mode and protocol availability.
  • Migrate dock geometry updates to region-watch anchors and set_region().
  • Handle enter, leave, and output_removed events to maintain overlap state.
panels/dock/CMakeLists.txt
panels/dock/waylanddockhelper.h
panels/dock/waylanddockhelper.cpp

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

Copilot AI 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.

🟡 Changes recommended

The region watch is not reliably rebound when the dock changes screens, which can leave smart-hide overlap monitoring inactive.

1 open finding
What changed in this PR

This PR moves dock smart-hide overlap monitoring from the deprecated DDE shell interface to Treeland’s region-watch protocol.

Changes:

  • Generate the new protocol client and require TreelandProtocols 0.7.0.
  • Replace the overlap checker with a region watch and handle output removal.
File Description
panels/​dock/​waylanddockhelper.h Declares the region-watch classes and event handlers.
panels/​dock/​waylanddockhelper.cpp Creates and updates the watch and handles overlap events.
panels/​dock/​CMakeLists.txt Adds the protocol source and raises the required version.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +46 to +48
connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateRegionWatchPos);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

非本次引入

1. Add treeland-region-watch-unstable-v1.xml to CMakeLists.txt and lock TreelandProtocols to 0.7.0
2. Replace TreeLandWindowOverlapChecker with TreeLandRegionWatchManager and TreeLandRegionWatch
3. Extract shared ensureRegionWatch lambda to deduplicate region watch setup logic
4. Migrate anchor enums from treeland_window_overlap_checker to treeland_region_watch_v1
5. Replace update() with set_region() and add output_removed event handler
6. Rename updateOverlapCheckerPos to updateRegionWatchPos for consistency

Influence:
1. Test dock smart-hide behavior with windows overlapping the dock area
2. Verify dock visibility when windows enter and leave the dock region
3. Test dock position changes (top, bottom, left, right) trigger correct region watch updates
4. Verify output_removed event correctly resets overlap state when display is disconnected

feat: 适配 treeland-region-watch-unstable-v1 协议

1. 在 CMakeLists.txt 中新增 treeland-region-watch-unstable-v1.xml 并锁定 TreelandProtocols 至 0.7.0
2. 将 TreeLandWindowOverlapChecker 替换为 TreeLandRegionWatchManager 和 TreeLandRegionWatch
3. 提取共享的 ensureRegionWatch lambda 去重区域监听初始化逻辑
4. 将 anchor 枚举从 treeland_window_overlap_checker 迁移至 treeland_region_watch_v1
5. 将 update() 替换为 set_region() 并新增 output_removed 事件处理
6. 将 updateOverlapCheckerPos 重命名为 updateRegionWatchPos 以保持一致性

Influence:
1. 测试任务栏智能隐藏模式下窗口遮挡时的行为
2. 验证窗口进入和离开任务栏区域时任务栏可见性变化
3. 测试任务栏位置切换(上、下、左、右)时区域监听正确更新
4. 验证显示器断开时 output_removed 事件正确重置遮挡状态
@deepin-wm
deepin-wm force-pushed the agent/bot/33c2f56674a2 branch from d087a61 to f687d4a Compare October 12, 2026 10:01
@wineee
wineee marked this pull request as ready for review October 12, 2026 10:05

@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="panels/dock/waylanddockhelper.cpp" line_range="48" />
<code_context>
-    connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateOverlapCheckerPos);
+    connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos);
+    connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos);
+    connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateRegionWatchPos);

-    connect(m_ddeShellManager.get(), &TreeLandDDEShellManager::activeChanged, this, [this]() {
</code_context>
<issue_to_address>
**Overlap tracking stops after screen changes**

When the dock moves to another screen, including after its monitored output is removed, `updateRegionWatchPos()` is not called on `dockScreenChanged`, so `set_region()` keeps targeting the old output; `output_removed()` only clears overlap state, leaving SmartHide without updates on the new display.

Connect `DockPanel::dockScreenChanged` to `updateRegionWatchPos()`.

Also at `panels/dock/waylanddockhelper.cpp:291-294`.
</issue_to_address>

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

connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateOverlapCheckerPos);
connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateRegionWatchPos);
connect(m_panel, &DockPanel::rootObjectChanged, this, &WaylandDockHelper::updateRegionWatchPos);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟠 High · Overlap tracking stops after screen changes

When the dock moves to another screen, including after its monitored output is removed, updateRegionWatchPos() is not called on dockScreenChanged, so set_region() keeps targeting the old output; output_removed() only clears overlap state, leaving SmartHide without updates on the new display.

Connect DockPanel::dockScreenChanged to updateRegionWatchPos().

Also at panels/dock/waylanddockhelper.cpp:291-294.

Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at line 48:

**Overlap tracking stops after screen changes**

When the dock moves to another screen, including after its monitored output is removed, `updateRegionWatchPos()` is not called on `dockScreenChanged`, so `set_region()` keeps targeting the old output; `output_removed()` only clears overlap state, leaving SmartHide without updates on the new display.

Connect `DockPanel::dockScreenChanged` to `updateRegionWatchPos()`.

Also at `panels/dock/waylanddockhelper.cpp:291-294`.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, 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

@18202781743

Copy link
Copy Markdown
Contributor

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 51c42e2 into linuxdeepin:master Oct 12, 2026
6 of 10 checks passed
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.

5 participants