Skip to content

refactor: split personalization-manager-v1 protocol - #97

Merged
Groveer merged 1 commit into
linuxdeepin:masterfrom
wineee:split-personalization-manager
Sep 7, 2026
Merged

refactor: split personalization-manager-v1 protocol#97
Groveer merged 1 commit into
linuxdeepin:masterfrom
wineee:split-personalization-manager

Conversation

@wineee

@wineee wineee commented Sep 3, 2026

Copy link
Copy Markdown
Member

Split the personalization protocol into dedicated system-appearance and per-window-personalization protocols while preserving the legacy definition as deprecated.

New Features:

  • Add separate unstable protocols for system-wide appearance settings and per-window visual personalization.

Bug Fixes:

  • Correct the cursor verification event naming and replace it with a committed result event.
  • Correct the misspelled verification terminology and normalize theme type enum values.

Enhancements:

  • Remove the legacy personalization protocol from the active protocol set and reorganize its interface members by lifecycle, enums, requests, and events.
  • Remove redundant initial-state requests in favor of compositor-pushed context state.

Build:

  • Update CMake protocol installation lists to include the new protocols and install the legacy protocol as deprecated.

Documentation:

  • Update the DDE protocol registry and document the breaking changes and migration to the two replacement protocols.

Chores:

  • Move the original personalization-manager-v1 protocol into the deprecated protocol set.

Summary by Sourcery

Split personalization into role-specific appearance and decoration protocols while retaining the original protocol for deprecated compatibility.

New Features:

  • Add unstable protocols for read-only global appearance observation, privileged appearance management, and per-window server-side decoration customization.

Bug Fixes:

  • Correct cursor verification semantics and standardize appearance terminology and color-scheme enum values.

Enhancements:

  • Replace synchronous appearance queries and cursor commits with compositor-pushed initial state and immediate updates.
  • Retire the legacy personalization protocol from the active set while preserving it as a deprecated compatibility definition.

Build:

  • Install the new public and DDE protocols and retain the legacy personalization protocol in the deprecated installation set.

Documentation:

  • Document the protocol split, breaking changes, migration paths, and use of the upstream background-effect protocol in English and Chinese registries.

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

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 Sep 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

Replaces the active personalization-manager-v1 protocol with dedicated experimental protocols for observable and privileged system appearance, per-window background blending, and SSD decoration customization, while retaining the original XML as deprecated and documenting migration, push-based state synchronization, and normalized protocol semantics.

Sequence diagram for push-based system appearance synchronization

sequenceDiagram
    participant Client
    participant Appearance as SystemAppearance
    participant Manager as AppearanceManager
    participant Compositor

    Client->>Appearance: bind
    Appearance-->>Client: cursor_theme
    Appearance-->>Client: color_scheme
    Appearance-->>Client: window_opacity
    Client->>Manager: set_color_scheme
    Manager->>Compositor: apply setting
    Compositor-->>Appearance: color_scheme
    Appearance-->>Client: color_scheme
Loading

Sequence diagram for per-window decoration and blending setup

sequenceDiagram
    participant App
    participant XDG as XDGDecoration
    participant Decoration as WindowDecoration
    participant Blend as WindowBlend
    participant Compositor

    App->>XDG: set_mode(server_side)
    App->>Decoration: get_window_context
    App->>Decoration: set_titlebar(disable)
    Decoration->>Compositor: apply SSD customization
    App->>Blend: get_window_context
    Blend-->>App: supported_modes
    App->>Blend: set_blend_mode(blur)
    Blend->>Compositor: apply background compositing
Loading

File-Level Changes

Change Details Files
Split monolithic personalization functionality into focused appearance, window blending, and window decoration protocols.
  • Added public observer protocol for compositor-pushed system appearance state.
  • Added privileged DDE manager protocol for changing system appearance settings.
  • Added per-window protocols for background blending and server-side decoration customization, including capability discovery and SSD prerequisites.
public/treeland-system-appearance-unstable-v1.xml
dde/treeland-system-appearance-manager-unstable-v1.xml
public/treeland-window-blend-unstable-v1.xml
public/treeland-window-decoration-unstable-v1.xml
Preserved the original personalization protocol as a deprecated compatibility reference and clarified its replacement path.
  • Moved the legacy protocol out of the active DDE installation set into the deprecated set.
  • Documented the protocol split, migration targets, and breaking changes in the DDE registry.
  • Reorganized legacy interface definitions by lifecycle, enums, requests, and events.
CMakeLists.txt
dde/README.md
Standardized state synchronization and protocol semantics across the replacement definitions.
  • Replaced initial-state queries and commit/verification flow with compositor-pushed initial and update events and immediate-setting requests.
  • Corrected cursor verification terminology and event semantics.
  • Removed the auto theme value in favor of light and dark color-scheme enums.
  • Moved destructor requests first and normalized enum/request/event ordering.
dde/treeland-system-appearance-manager-unstable-v1.xml
public/treeland-system-appearance-unstable-v1.xml
public/treeland-window-blend-unstable-v1.xml
public/treeland-window-decoration-unstable-v1.xml
deprecated/treeland-personalization-manager-v1.xml
Updated build installation and protocol registries for the new public, DDE, and deprecated protocol sets.
  • Installed the three new public protocols and privileged system-appearance manager.
  • Registered the new interfaces and their intended audiences and responsibilities.
  • Marked the original personalization protocol as deprecated for installation.
CMakeLists.txt
public/README.md
dde/README.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

@wineee
wineee force-pushed the split-personalization-manager branch 5 times, most recently from a163453 to e31071e Compare September 4, 2026 06:40
@wineee
wineee marked this pull request as ready for review September 4, 2026 06:51

@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="dde/README.md" line_range="12" />
<code_context>
+| `treeland-system-appearance-manager-unstable-v1.xml` | `treeland_system_appearance_manager_unstable_v1` | `treeland_system_appearance_manager_v1` | Privileged system-wide appearance configuration: cursor theme/size, global font, icon theme, active color, window opacity, theme type, titlebar height, global corner radius |
</code_context>
<issue_to_address>
**nitpick:** The English DDE registry adds `treeland-system-appearance-manager-unstable-v1.xml`, but the repository's parallel `dde/README.zh_CN.md` still lists the removed active `treeland-personalization-manager-v1.xml` and omits the new manager protocol. The Chinese registry therefore tells readers to use a file that is no longer installed in the active DDE set and does not document the replacement.

**Triggers:** When users consult the Chinese DDE protocol registry after upgrading to 0.6.0.

**Suggested fix:** Update `dde/README.zh_CN.md` to remove the deprecated personalization entry, add the system-appearance manager entry, and document the migration.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread dde/README.md Outdated
@wineee
wineee force-pushed the split-personalization-manager branch 5 times, most recently from 00fd979 to f898974 Compare September 4, 2026 10:13
1. Split personalization-manager-v1 into three role-scoped protocols.
2. window-decoration (public): per-window SSD customization, needs xdg-decoration.
3. system-appearance (public): read-only system appearance query/observation.
4. system-appearance-manager (dde): privileged appearance configuration.
5. Per-window background blur now uses upstream ext-background-effect-v1.
6. Old wallpaper blend mode is deprecated without replacement.
7. Move original file to deprecated/ unchanged.
8. Standardize lifecycle: destroy first, enums before requests, events after.
9. Drop redundant get_* requests (push model).
10. Cursor: verfity event -> committed event + commit_result enum.
11. theme_type: drop auto; standardize light=0, dark=1.

Log: Split personalization-manager-v1 into three role-scoped protocols by audience; background blur is replaced by upstream ext-background-effect-v1; wallpaper blend mode is deprecated without replacement.

Influence:
1. Verify the three new XMLs parse with wayland-scanner and install via cmake.
2. Confirm window-decoration raises not_server_side_decorated without xdg-decoration SSD.
3. Confirm window-blend is fully removed; no stale references in build or READMEs.
4. Confirm deprecated personalization-manager-v1.xml still installs when INSTALL_DEPRECATED=ON.
5. Confirm dde/README.md and CMakeLists.txt file lists stay consistent.

refactor: 将 personalization-manager-v1 拆分为三个协议

1. 将 personalization-manager-v1 按受众拆分为三个职责清晰的协议。
2. window-decoration(public):逐窗口 SSD 装饰定制,需先经 xdg-decoration 申请 SSD。
3. system-appearance(public):系统外观只读查询与订阅。
4. system-appearance-manager(dde):特权系统外观配置。
5. 逐窗口背景模糊改用上游 ext-background-effect-v1 协议。
6. 旧 wallpaper 混合模式废弃且无替代。
7. 原文件原样移至 deprecated/。
8. 规范生命周期:destroy 置首、enum 前置、event 后置。
9. 移除冗余 get_* 请求(push 模型)。
10. 光标:verfity 事件改为 committed 事件并新增 commit_result 枚举。
11. theme_type:移除 auto,规范化为 light=0、dark=1。

Log: 将 personalization-manager-v1 按受众拆分为三个协议,背景模糊改由上游 ext-background-effect-v1 承接,wallpaper 模式废弃且无替代。

Influence:
1. 用 wayland-scanner 校验三个新 XML 可正常解析,且 cmake 可正确安装。
2. 确认未协商 xdg-decoration SSD 时 window-decoration 报 not_server_side_decorated。
3. 确认 window-blend 已彻底移除,构建与 README 无残留引用。
4. 确认 INSTALL_DEPRECATED=ON 时旧 personalization-manager-v1.xml 仍安装。
5. 确认 dde/README.md 与 CMakeLists.txt 文件列表保持一致。
@wineee
wineee force-pushed the split-personalization-manager branch from f898974 to 77d40d2 Compare September 7, 2026 02:26
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

AI 代码审查报告

项目: linuxdeepin/treeland-protocols
PR: #97 - refactor: split personalization-manager-v1 protocol
作者: wineee
分支: split-personalization-manager → master
提交: 77d40d2 - refactor: split personalization-manager-v1 into 3 protocols
变更文件: 9 个(新增 3 个 XML 协议文件,移动 1 个文件至 deprecated,修改 5 个文档/配置文件)
审查时间: 2026-09-07


总体评价

总分: 95 分 | 等级: 优秀
代码审查通过。本次提交为 Wayland 协议定义的重构,将旧的 personalization-manager-v1 协议按职责拆分为三个独立协议,代码质量高,文档完整,无安全漏洞。


漏洞统计

指标 数量
当前漏洞总数 0
新增漏洞 0
减少漏洞 0
持平 0

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个


四维度评分

1. 语法逻辑 ✓ — 25/25 分

语法正确,逻辑清晰

  • XML 协议文件格式正确,遵循 Wayland 协议 XML 规范
  • CMake set() 语法正确,文件路径合理
  • Markdown 文档语法正确
  • 协议结构规范:interface → enum → destructor → requests/events 的标准布局
  • 新协议的 type="destructor" 标注正确
  • enum 引用(如 enum="color_scheme"enum="titlebar_mode")指向已定义的枚举
  • 无编译/解析错误风险

2. 代码质量 ✓ — 24/25 分

代码结构清晰,注释完整

  • 每个 request、event、enum 均有详细的 <description> 注释,说明用途、参数范围和行为语义
  • 新增的三个协议文件结构一致,按 enum → destructor → 分组 requests/events 的标准布局组织
  • 中英文 README 文档同步更新,内容一致
  • Breaking changes 文档详细,包含迁移指南和关键变更说明
  • CMake 列表中文件按字母顺序排列,整洁有序
  • 旧协议文件原样移动至 deprecated 目录,保持兼容性
  • 轻微扣分:treeland_appearance_v1treeland_appearance_manager_v1 两个协议中的 color_scheme 枚举定义重复,虽然注释中已说明"must stay in sync",但缺乏自动化同步机制保障,存在未来维护中遗漏同步的风险(-1 分)

3. 代码性能 ✓ — 20/20 分

性能良好,资源使用合理

  • 协议定义文件,无运行时性能影响
  • Push 模型设计(合成器主动推送状态变更)比旧的同步 get_* 查询模型更高效,减少了不必要的往返请求
  • set_* 请求立即生效,无需 commit 确认,简化了交互流程
  • 无不必要的计算或资源消耗

4. 代码安全 ✓ — 30/30 分

存在 0 个安全漏洞

  • treeland-appearance-manager-unstable-v1.xml 明确声明为特权协议,绑定需合成器级授权,未授权时请求被静默忽略或连接被终止
  • treeland-decoration-unstable-v1.xml 包含 error 枚举定义(already_usedinvalid_surface),防止跨客户端操作和重复创建
  • 所有 set_* 请求的参数范围均有明确定义(如颜色分量 [0, 255]、不透明度 [0.0, 1.0]),合成器可对越界值进行 clamp 处理
  • 协议声明为 EXPERIMENTAL,明确不提供兼容性保证,防止误用
  • 无硬编码密钥、无敏感信息泄露、无注入风险
  • SPDX 许可证标识正确(MIT)

详细文件分析

CMakeLists.txt

  • TREELAND_PROTOCOL_XML_FILES 中添加 treeland-appearance-unstable-v1.xmltreeland-decoration-unstable-v1.xml
  • TREELAND_PROTOCOL_DDE_XML_FILES 中将 treeland-personalization-manager-v1.xml 替换为 treeland-appearance-manager-unstable-v1.xml
  • TREELAND_PROTOCOL_DEPRECATED_XML_FILES 中添加 treeland-personalization-manager-v1.xml
  • 变更合理,与文件移动操作一致

dde/treeland-appearance-manager-unstable-v1.xml(新增,225 行)

  • 特权外观配置管理协议,面向桌面控制中心
  • 包含 color_scheme 枚举(light=0, dark=1)
  • 10 个 set_* 请求:cursor_theme、cursor_size、font、monospace_font、font_size、icon_theme、accent_color、window_opacity、color_scheme、titlebar_height、corner_radius
  • 每个 request 描述清晰,参数类型和范围明确
  • 特权声明和授权说明完整

public/treeland-appearance-unstable-v1.xml(新增,187 行)

  • 只读外观订阅协议,面向所有常规应用
  • 包含与 appearance-manager 相同的 color_scheme 枚举
  • 11 个 event:cursor_theme、cursor_size、font、monospace_font、font_size、icon_theme、accent_color、window_opacity、color_scheme、titlebar_height、corner_radius
  • Push 模型:合成器在客户端绑定时推送当前值,变更时广播
  • 只读协议,无安全风险

public/treeland-decoration-unstable-v1.xml(新增,199 行)

  • 逐窗口服务端装饰定制协议
  • 两个接口:treeland_decoration_manager_v1(工厂)和 treeland_decoration_context_v1(上下文)
  • 包含 error 枚举(already_used, invalid_surface)和 titlebar_mode 枚举(show, hide)
  • 支持 set_corner_radius、set_shadow、set_border、set_titlebar_mode
  • "half-CSD, half-SSD" 配置说明清晰
  • 安全检查完善:防止重复创建、验证 surface 所有权

文档文件(README.md / README.zh_CN.md)

  • 中英文文档同步更新
  • Breaking changes 说明详细,包含 6 项关键变更:
    1. 协议拆分与职责分离
    2. Push 模型状态同步
    3. 光标设置简化
    4. 配色方案枚举重命名与规范化
    5. 标准化生命周期与结构
    6. 数值表示规范化(线缆不兼容)

改进建议

  1. 枚举同步机制color_scheme 枚举在两个协议中重复定义,建议在协议描述中增加更强的约束说明,或考虑通过协议引用机制避免重复定义
  2. 版本协商:新协议均为 version="1",建议在协议描述中说明未来版本升级的兼容性策略

审查结论

本次提交是一个高质量的重构,将单一的 personalization-manager-v1 协议按职责拆分为三个独立的协议。代码结构清晰,文档注释完整,遵循 Wayland 协议规范。Push 模型的采用和特权协议的安全声明体现了良好的设计实践。无安全漏洞,无语法逻辑错误,代码质量优秀。建议合并。

@Groveer
Groveer added this pull request to the merge queue Sep 7, 2026
Merged via the queue into linuxdeepin:master with commit 90f1e70 Sep 7, 2026
5 checks passed
@wineee
wineee deleted the split-personalization-manager branch September 7, 2026 02:49
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