Skip to content

feat(personalization): implement new protocol split for treeland-protocols 0.6.0 - #1384

Draft
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/8caa5a57575b
Draft

feat(personalization): implement new protocol split for treeland-protocols 0.6.0#1384
deepin-wm wants to merge 2 commits into
linuxdeepin:masterfrom
deepin-wm:agent/git-commit/8caa5a57575b

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adapt the personalization module to treeland-protocols 0.6.0 breaking changes by implementing 3 new protocol server implementations while keeping the old personalization-manager-v1 for backward compatibility during the transition period.

New protocol implementations

  1. treeland_decoration_unstable_v1decorationmanagerinterfacev1.{h,cpp}

    • Per-surface SSD decoration context (corner radius, shadow, border, titlebar mode)
    • Surface ownership validation on get_decoration_context
  2. treeland_appearance_unstable_v1appearanceinterfacev1.{h,cpp}

    • Read-only push model: all current values sent on bind, broadcasts on change
    • Handles TreelandUserConfig object replacement (reconnect signals, re-push)
  3. treeland_appearance_manager_unstable_v1appearancemanagerinterfacev1.{h,cpp}

    • Privileged set_* requests writing to DConfig
    • Calls Helper::syncPaletteTypeWithWindowThemeType() for color scheme changes

Shared types

  • Shadow and Border structs extracted to src/common/windowdecorations.h, shared by old and new protocol implementations.

Key design decisions

  • Old + new coexistence: Old PersonalizationManagerInterfaceV1 kept alongside new protocols; old code has zero changes (only struct extraction).
  • Push model: All get_* requests removed; values pushed on bind and on change.
  • Data conversions: activeColor string↔RGBA; windowOpacity int↔wl_fixed_t; windowThemeType↔color_scheme.

Files changed

Type File
New src/common/windowdecorations.h
New src/modules/personalization/decorationmanagerinterfacev1.{h,cpp}
New src/modules/personalization/appearanceinterfacev1.{h,cpp}
New src/modules/personalization/appearancemanagerinterfacev1.{h,cpp}
Modified src/modules/personalization/CMakeLists.txt
Modified src/modules/personalization/personalizationmanagerinterfacev1.h
Modified src/seat/helper.{h,cpp}
Modified src/CMakeLists.txt
Modified tests/test_protocol_personalization/main.cpp

Multica issue: WM-444

Summary by Sourcery

Implement the treeland-protocols 0.6.0 personalization split while maintaining backward compatibility with the existing protocol.

New Features:

  • Add server implementations for the decoration, appearance, and privileged appearance-manager protocols introduced in treeland-protocols 0.6.0.
  • Expose per-surface decoration settings and synchronize user appearance configuration through read-only push updates and privileged setters.

Enhancements:

  • Share window decoration data types between the legacy and new personalization protocols.
  • Validate surface ownership and prevent duplicate decoration contexts while retaining the legacy personalization protocol for compatibility.

Build:

  • Generate and include the three treeland-protocols 0.6.0 server interfaces in the build.

Tests:

  • Extend personalization protocol tests to cover creation and registration of all new interfaces while preserving legacy coverage.

Add decoration, appearance, and appearance-manager protocol
implementations for treeland-protocols 0.6.0. Extract Shadow/Border
structs to a shared header. Old personalization-manager-v1 is kept
for backward compatibility during the transition period.

为 treeland-protocols 0.6.0 新增 decoration、appearance 和
appearance-manager 三个协议实现,提取 Shadow/Border 结构体到共享
头文件,旧 personalization-manager-v1 协议保留以支持过渡期兼容。

Log: 实现新协议拆分,适配 treeland-protocols 0.6.0
Influence: 新增 3 个协议实现与旧协议共存,不影响现有功能。
@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: 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 commented Sep 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR adapts personalization to treeland-protocols 0.6.0 by adding decoration, appearance, and privileged appearance-manager Wayland globals, wiring them into Helper, and preserving the legacy manager. Appearance values are pushed from the current user configuration and mutations flow back through DConfig, while decoration contexts validate surface ownership and apply supported per-window overrides.

Sequence diagram for pushed appearance settings

sequenceDiagram
    participant Client
    participant AppearanceInterfaceV1
    participant Helper
    participant Config as TreelandUserConfig

    Client->>AppearanceInterfaceV1: bind_resource
    AppearanceInterfaceV1->>Helper: config()
    Helper-->>AppearanceInterfaceV1: current configuration
    AppearanceInterfaceV1->>Client: send_cursor_theme
    AppearanceInterfaceV1->>Client: send_font
    AppearanceInterfaceV1->>Client: send_accent_color
    AppearanceInterfaceV1->>Client: send_window_opacity
    AppearanceInterfaceV1->>Client: send_color_scheme
    AppearanceInterfaceV1->>Client: send_corner_radius
    Config-->>AppearanceInterfaceV1: windowThemeTypeChanged
    AppearanceInterfaceV1->>Client: send_color_scheme
    Config-->>AppearanceInterfaceV1: activeColorChanged
    AppearanceInterfaceV1->>Client: send_accent_color
Loading

Sequence diagram for privileged appearance updates

sequenceDiagram
    participant SettingsClient
    participant AppearanceManagerInterfaceV1
    participant Config as TreelandUserConfig
    participant Helper
    participant AppearanceInterfaceV1
    participant BoundClients

    SettingsClient->>AppearanceManagerInterfaceV1: set_color_scheme
    AppearanceManagerInterfaceV1->>Config: setWindowThemeType
    AppearanceManagerInterfaceV1->>Helper: syncPaletteTypeWithWindowThemeType
    Config-->>AppearanceInterfaceV1: windowThemeTypeChanged
    AppearanceInterfaceV1->>BoundClients: send_color_scheme
    SettingsClient->>AppearanceManagerInterfaceV1: set_accent_color
    AppearanceManagerInterfaceV1->>Config: setActiveColor
    Config-->>AppearanceInterfaceV1: activeColorChanged
    AppearanceInterfaceV1->>BoundClients: send_accent_color
Loading

Sequence diagram for per-surface decoration context creation

sequenceDiagram
    participant Client
    participant DecorationManagerInterfaceV1
    participant DecorationContextV1
    participant Helper
    participant SurfaceWrapper

    Client->>DecorationManagerInterfaceV1: get_decoration_context
    DecorationManagerInterfaceV1->>DecorationManagerInterfaceV1: validate surface ownership
    DecorationManagerInterfaceV1->>DecorationContextV1: create context
    DecorationManagerInterfaceV1-->>Helper: contextCreated
    Helper->>SurfaceWrapper: setRadius
    Helper->>SurfaceWrapper: setNoTitleBar
    Client->>DecorationContextV1: set_corner_radius
    DecorationContextV1-->>Helper: cornerRadiusChanged
    Helper->>SurfaceWrapper: setRadius
Loading

File-Level Changes

Change Details Files
Added the three treeland-protocols 0.6.0 server globals and registered them alongside the deprecated personalization manager.
  • Generate server bindings for decoration, read-only appearance, and privileged appearance-manager protocols.
  • Expose each implementation as a QML singleton and attach it during Helper initialization.
  • Retain the old protocol unchanged for transition compatibility.
src/modules/personalization/CMakeLists.txt
src/modules/personalization/decorationmanagerinterfacev1.h
src/modules/personalization/decorationmanagerinterfacev1.cpp
src/modules/personalization/appearanceinterfacev1.h
src/modules/personalization/appearanceinterfacev1.cpp
src/modules/personalization/appearancemanagerinterfacev1.h
src/modules/personalization/appearancemanagerinterfacev1.cpp
src/seat/helper.h
src/seat/helper.cpp
Implemented per-surface decoration contexts with client ownership and duplicate-use validation.
  • Create one decoration context per wl_surface and expose corner radius, shadow, border, and titlebar mode state.
  • Reject null, foreign-client, duplicate, and allocation-failure cases through protocol errors.
  • Apply corner-radius and titlebar overrides to SurfaceWrapper; retain shadow and border values for future rendering integration.
src/modules/personalization/decorationmanagerinterfacev1.h
src/modules/personalization/decorationmanagerinterfacev1.cpp
src/seat/helper.cpp
Implemented appearance synchronization as a bind-time and change-time push model backed by TreelandUserConfig.
  • Push all current appearance values when a client binds and broadcast corresponding events on DConfig changes.
  • Reconnect change notifications and republish all values when the user configuration object is replaced.
  • Convert colors, opacity, and theme values between DConfig representations and protocol wire types.
src/modules/personalization/appearanceinterfacev1.h
src/modules/personalization/appearanceinterfacev1.cpp
src/seat/helper.cpp
Implemented privileged appearance mutation requests that persist settings to DConfig.
  • Handle all protocol set_* requests through TreelandUserConfig setters.
  • Map protocol color schemes to window theme types and synchronize the palette after theme changes.
  • Convert RGBA colors and wl_fixed opacity values before persistence.
src/modules/personalization/appearancemanagerinterfacev1.h
src/modules/personalization/appearancemanagerinterfacev1.cpp
Centralized decoration value types and expanded protocol construction tests.
  • Move Shadow and Border definitions into a shared header used by old and new implementations.
  • Add build-source registration for the shared header.
  • Add creation and lookup coverage for all old and new protocol interfaces.
src/common/windowdecorations.h
src/modules/personalization/personalizationmanagerinterfacev1.h
src/CMakeLists.txt
tests/test_protocol_personalization/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

…tructor

test_protocol_personalization attaches AppearanceInterfaceV1 to a bare
WServer with no Helper singleton, so Helper::instance() is nullptr in the
constructor. The constructor passed that nullptr to QObject::connect
(triggering 'invalid nullptr parameter') and then dereferenced it via
setupConfigConnections()->Helper::instance()->config(), causing a SIGSEGV
at address 0x28 (nullptr offset).

Guard the constructor body: only wire up the configChanged connection and
the initial setupConfigConnections() when Helper::instance() is valid. In
production Helper is always constructed before the interface is attached in
Helper::init(), so behavior is unchanged; unit tests no longer crash.

Log: 修复 AppearanceInterfaceV1 构造函数未判空 Helper 导致测试 SIGSEGV
Influence: 仅影响单元测试构造路径,生产环境行为不变
@deepin-bot

deepin-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.10.0
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1392

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