Skip to content

fix: adapt dtkgui to Treeland protocol 0.6.0 API changes - #416

Draft
18202781743 wants to merge 2 commits into
masterfrom
agent/developer/6048769b90d8
Draft

18202781743 wants to merge 2 commits into
masterfrom
agent/developer/6048769b90d8

Conversation

@18202781743

@18202781743 18202781743 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adapt dtkgui to Treeland protocol changes — split the old treeland-personalization-manager-v1 into three independent protocol wrappers: treeland-appearance-v1, treeland-decoration-v1, and ext-background-effect-v1.

Changes (18 files, +686/-364)

  1. Split personalizationwaylandclientextension into treelandappearanceclientextension, treelanddecorationclientextension, and treelandbackgroundeffectclientextension
  2. Update dtreelandplatforminterface to use treeland_appearance_v1 read-only global; setters become no-op
  3. Update dtreelandplatformwindowinterface to use treeland_decoration_context_v1 + ext_background_effect_v1 surface; split dirty state management
  4. Update dtreelandwindowmanagerhelper to independently detect hasBlurWindow()/hasNoTitlebar() via separate globals
  5. Update plugins.cmake to reference three new protocol XML files
  6. Update config.tests/treeland_test CMakeLists.txt and main.cpp
  7. Update debian/control to require treeland-protocols >= 0.6.0
  8. Add window blur area support in dplatformhandle.cpp
  9. Fix accent_color override signature to 4 params (r, g, b, a) and qualify titlebar_mode enum references for treeland-protocols 0.6.0 API alignment

Commits

  • 6bba66a feat: adapt dtkgui to Treeland protocol changes
  • abd732f fix: align code with treeland-protocols 0.6.0 API

Multica Issue

DDE-402

Summary by Sourcery

Adapt dtkgui to Treeland protocols 0.6.0 by replacing the legacy personalization integration with separate appearance, decoration, and background-effect support.

New Features:

  • Add Treeland background-effect support for window blur regions and paths.
  • Split Treeland protocol integration into independent appearance, decoration, and background-effect interfaces.

Bug Fixes:

  • Update Treeland integration for the 0.6.0 protocol API, including revised decoration, appearance, and accent-color handling.

Enhancements:

  • Treat appearance data as read-only and detect decoration and blur capabilities independently.
  • Update window decoration and effect state handling to use the new Treeland protocol surfaces.

Build:

  • Generate Wayland client bindings from the Treeland appearance and decoration protocols plus the standard background-effect protocol.
  • Update Treeland configuration checks and require Treeland protocols version 0.6.0 or newer.

Tests:

  • Update the Treeland protocol configuration test for the new protocol interfaces.

Chores:

  • Remove the legacy personalization protocol wrapper and replace it with dedicated protocol extensions.

feat: 适配 dtkgui 到 Treeland 协议变更

1. Split personalizationwaylandclientextension into three independent
   protocol wrappers: treelandappearance, treelanddecoration, and
   treelandbackgroundeffect
2. Update dtreelandplatforminterface to use treeland_appearance_v1
   read-only global, replace PersonalizationManager/AppearanceContext
   dependencies, setters become no-op
3. Update dtreelandplatformwindowinterface to use
   treeland_decoration_context_v1 + ext_background_effect_v1 surface,
   split dirty state management
4. Update dtreelandwindowmanagerhelper to independently detect
   hasBlurWindow()/hasNoTitlebar() via separate globals
5. Update plugins.cmake to reference three new protocol XML files
6. Update config.tests/treeland_test CMakeLists.txt and main.cpp
7. Update debian/control to require treeland-protocols >= 0.7.0
8. Add window blur area support in dplatformhandle.cpp

1. 将 personalizationwaylandclientextension 拆分为三个独立的协议封装:
   treelandappearance、treelanddecoration、treelandbackgroundeffect
2. 更新 dtreelandplatforminterface 使用 treeland_appearance_v1 只读
   global,移除 PersonalizationManager/AppearanceContext 依赖,setter
   改为 no-op
3. 更新 dtreelandplatformwindowinterface 使用
   treeland_decoration_context_v1 + ext_background_effect_v1 surface,
   拆分 dirty state 管理
4. 更新 dtreelandwindowmanagerhelper 各 global 独立检测
   hasBlurWindow()/hasNoTitlebar()
5. 更新 plugins.cmake 引用三个新协议 XML 文件
6. 更新 config.tests/treeland_test 的 CMakeLists.txt 和 main.cpp
7. 更新 debian/control 要求 treeland-protocols >= 0.7.0
8. 在 dplatformhandle.cpp 中添加窗口模糊区域支持

Log: Treeland 协议从单一 personalization-manager 拆分为 appearance、decoration、background-effect 三个独立协议,dtkgui 需要适配新的协议接口
Influence: dtkgui Treeland 平台插件,影响窗口装饰、模糊效果和外观属性的 Wayland 适配
fix: 对齐 treeland-protocols 0.6.0 协议 API

1. Fix accent_color override signature to 4 params (r, g, b, a) to
   match treeland_appearance_v1 base class generated by 0.6.0 protocol
2. Qualify titlebar_mode enum references with TreelandDecorationContext::
   scope in dtreelandplatformwindowinterface.cpp
3. Update debian/control treeland-protocols dependency from >= 0.7.0
   to >= 0.6.0 (0.7.0 does not exist upstream)

1. 修复 accent_color 重写签名为 4 参数 (r, g, b, a),匹配 0.6.0 协议
   生成的 treeland_appearance_v1 基类签名
2. 在 dtreelandplatformwindowinterface.cpp 中为 titlebar_mode 枚举引用
   添加 TreelandDecorationContext:: 作用域限定
3. 更新 debian/control 中 treeland-protocols 依赖从 >= 0.7.0 改为
   >= 0.6.0(上游不存在 0.7.0 版本)

Log: treeland-protocols 上游最高版本为 0.6.0,代码针对不存在的 0.7.0 API 编写导致编译失败,需对齐 0.6.0 协议 API
Influence: dtkgui Treeland 平台插件编译修复,影响 accent_color 签名和 titlebar_mode 枚举作用域
@18202781743
18202781743 marked this pull request as draft September 28, 2026 05:37
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743

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

@github-actions

Copy link
Copy Markdown
Contributor
  • 检测到debian目录文件有变更: debian/control

@sourcery-ai

sourcery-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Migrates dtkgui from Treeland’s monolithic personalization protocol to the 0.6.0 appearance, decoration, and background-effect protocols, with read-only appearance handling, independent capability detection, updated decoration requests, and per-window blur-region support; build generation, configuration checks, and packaging requirements are updated accordingly.

Sequence diagram for Treeland window blur-region application

sequenceDiagram
    participant App as Application
    participant Handle as DPlatformHandle
    participant Interface as DTreeLandPlatformWindowInterface
    participant Helper as DTreeLandPlatformWindowHelper
    participant Manager as BackgroundEffectManager
    participant Surface as BackgroundEffectSurface

    App->>Handle: setWindowBlurAreaByWM(window, areas)
    Handle->>Interface: setWindowBlurAreas(areas)
    Interface->>Helper: setWindowBlurAreas(areas)
    Helper->>Helper: scheduleApply()
    Helper->>Manager: hasBlurCapability()
    Helper->>Surface: set_blur_region(waylandRegion)
Loading

Sequence diagram for Treeland appearance event handling

sequenceDiagram
    participant Treeland as treeland_appearance_v1
    participant Appearance as TreelandAppearance
    participant Platform as DTreelandPlatformInterface
    participant Theme as DPlatformTheme

    Treeland->>Appearance: treeland_appearance_v1_font(font_name)
    Appearance->>Platform: update m_fontName
    Appearance->>Theme: fontNameChanged(font_name)
    Treeland->>Appearance: treeland_appearance_v1_accent_color(r, g, b, a)
    Appearance->>Platform: update m_activeColor
    Appearance->>Theme: activeColorChanged(activeColor)
Loading

File-Level Changes

Change Details Files
Replace the legacy personalization protocol client with independent appearance, decoration, and background-effect Wayland wrappers.
  • Add singleton managers and per-surface context wrappers for the three protocol globals.
  • Consume appearance events as read-only theme updates and make platform setters no-ops.
  • Track decoration and blur support independently, including capability-change notifications.
src/plugins/platform/treeland/personalizationwaylandclientextension.cpp
src/plugins/platform/treeland/personalizationwaylandclientextension.h
src/plugins/platform/treeland/treelandappearanceclientextension.cpp
src/plugins/platform/treeland/treelandappearanceclientextension.h
src/plugins/platform/treeland/treelanddecorationclientextension.cpp
src/plugins/platform/treeland/treelanddecorationclientextension.h
src/plugins/platform/treeland/treelandbackgroundeffectclientextension.cpp
src/plugins/platform/treeland/treelandbackgroundeffectclientextension.h
src/plugins/platform/treeland/dtreelandplatforminterface.cpp
src/plugins/platform/treeland/dtreelandplatforminterface.h
src/plugins/platform/treeland/dtreelandwindowmanagerhelper.cpp
Migrate per-window decoration operations and state application to the Treeland 0.6.0 API.
  • Use decoration contexts and the renamed titlebar, corner-radius, border, shadow, and window-effect requests.
  • Separate decoration dirty state from blur state and manage protocol object lifetimes across surface creation and destruction.
src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp
src/plugins/platform/treeland/dtreelandplatformwindowinterface.h
Implement Treeland background-effect blur regions for rectangular areas and painter paths.
  • Convert blur inputs to QRegion and submit Wayland regions through ext-background-effect surface objects.
  • Route DPlatformHandle blur-area APIs to the Treeland window interface.
src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp
src/plugins/platform/treeland/dtreelandplatformwindowinterface.h
src/kernel/dplatformhandle.cpp
Update protocol generation, configuration detection, and package requirements for protocol version 0.6.0.
  • Generate clients from the appearance, decoration, and staging background-effect XML files for Qt 5 and Qt 6.
  • Update the Treeland compile test to instantiate the new decoration context and API enums.
  • Require Treeland protocols 0.6.0 or newer.
src/plugins/plugins.cmake
src/plugins/platform/config.tests/treeland_test/CMakeLists.txt
src/plugins/platform/config.tests/treeland_test/main.cpp
debian/control
Align generated-protocol callback signatures and enum qualification with the new API.
  • Handle accent colors with RGBA components and consume font size as point values.
  • Qualify titlebar mode and related protocol enum references for generated bindings.
src/plugins/platform/treeland/treelandappearanceclientextension.cpp
src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp
src/plugins/platform/config.tests/treeland_test/main.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

@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 2 issues

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

## Individual Comments

### Comment 1
<location path="src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp" line_range="161-166" />
<code_context>
             return ret;
         }

-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
-        QPointF delta = me->globalPosition() - self->m_pressPoint;
-#else
-        QPointF delta = me->globalPos() - self->m_pressPoint;
-#endif
-        if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {
-            return ret;
-        }
</code_context>
<issue_to_address>
**issue (bug_risk):** The drag-distance guard was removed, so the first unaccepted left-button mouse move after a press starts a system window move regardless of how far the pointer moved. A click followed by a tiny pointer movement therefore initiates a window drag instead of preserving normal application mouse handling.

**Triggers:** When system move is enabled and a window receives a small mouse movement after a left-button press.

**Suggested fix:** Retain the `startDragDistance()` check using `m_pressPoint` before entering the system-move branch.
</issue_to_address>

### Comment 2
<location path="src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp" line_range="433-437" />
<code_context>
         }
     }
+
+    if (m_blurDirty) {
+        m_blurDirty = false;
+        if (m_blurEnabled && BackgroundEffectManager::instance()->isSupported()
+            && BackgroundEffectManager::instance()->hasBlurCapability()) {
+            if (!m_effectSurface) {
+                auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window()->handle());
+                if (waylandWindow && waylandWindow->waylandSurface()) {
</code_context>
<issue_to_address>
**issue (bug_risk):** `applyPending()` clears `m_blurDirty` before checking whether the background-effect capability is available, while `blurCapabilityChanged()` only emits the window-manager-helper signal and never reschedules existing window helpers. If blur is enabled before the capability event arrives, the blur request is discarded and is never applied when the capability becomes available.

**Triggers:** When a window enables blur before the background-effect manager delivers its capabilities event.

**Suggested fix:** Keep the blur state dirty until it is applied, or connect the capability change to each helper and call `scheduleApply()` when blur becomes supported.
</issue_to_address>

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

Comment on lines -161 to -166
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QPointF delta = me->globalPosition() - self->m_pressPoint;
#else
QPointF delta = me->globalPos() - self->m_pressPoint;
#endif
if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The drag-distance guard was removed, so the first unaccepted left-button mouse move after a press starts a system window move regardless of how far the pointer moved. A click followed by a tiny pointer movement therefore initiates a window drag instead of preserving normal application mouse handling.

Triggers: When system move is enabled and a window receives a small mouse movement after a left-button press.

Suggested fix: Retain the startDragDistance() check using m_pressPoint before entering the system-move branch.

Comment on lines +433 to +437
if (m_blurDirty) {
m_blurDirty = false;
if (m_blurEnabled && BackgroundEffectManager::instance()->isSupported()
&& BackgroundEffectManager::instance()->hasBlurCapability()) {
if (!m_effectSurface) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): applyPending() clears m_blurDirty before checking whether the background-effect capability is available, while blurCapabilityChanged() only emits the window-manager-helper signal and never reschedules existing window helpers. If blur is enabled before the capability event arrives, the blur request is discarded and is never applied when the capability becomes available.

Triggers: When a window enables blur before the background-effect manager delivers its capabilities event.

Suggested fix: Keep the blur state dirty until it is applied, or connect the capability change to each helper and call scheduleApply() when blur becomes supported.

This branch has not been deployed

No deployments
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.

2 participants