feat: add destructor methods and reorganize protocol#49
feat: add destructor methods and reorganize protocol#49wineee merged 1 commit intolinuxdeepin:masterfrom
Conversation
6130332 to
78435e3
Compare
There was a problem hiding this comment.
Pull request overview
This PR reorganizes multiple Wayland protocol XML definitions to address protocol/XML validation issues, primarily by moving/adding destroy destructors and reordering enums/requests/events.
Changes:
- Adds and/or relocates
destroydestructor requests across many interfaces. - Reorders protocol elements (requests/events/enums) and annotates some args with
enum=...(e.g., error codes, directions). - Performs structural cleanup in several protocol files (moving blocks to different positions).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 15 comments.
Show a summary per file
| File | Description |
|---|---|
| xml/treeland-window-management-v1.xml | Moves destroy request earlier in the interface. |
| xml/treeland-wallpaper-color-v1.xml | Moves destroy request to the top of the manager interface. |
| xml/treeland-virtual-output-manager-v1.xml | Adds manager destroy, reorders event placement, adds enum reference for error code. |
| xml/treeland-shortcut-manager-v1.xml | Adds manager destroy and reorders elements in the context interface. |
| xml/treeland-screensaver-v1.xml | Reorders requests and introduces destroy plus an error enum. |
| xml/treeland-personalization-manager-v1.xml | Adds manager/context destroy requests and reorders multiple interfaces’ request blocks and enums. |
| xml/treeland-output-manager-v1.xml | Moves error enum and destroy for the color-control interface earlier. |
| xml/treeland-foreign-toplevel-manager-v1.xml | Adds manager/handle/context destructors and significantly reorders requests/enums/events. |
| xml/treeland-ddm-v1.xml | Adds a destroy request and adjusts spacing/structure. |
| xml/treeland-dde-shell-v1.xml | Adds manager and overlap-checker destructors and reorders events/enum blocks. |
| xml/treeland-capture-unstable-v1.xml | Reorders requests/enums and relocates destroy; moves copy request before events. |
| xml/treeland-app-id-resolver-v1.xml | Reorders resolver requests/events and adjusts blank lines. |
Comments suppressed due to low confidence (5)
xml/treeland-dde-shell-v1.xml:26
- Placing
destroyfirst intreeland_dde_shell_manager_v1changes request opcode numbering for existing requests likeget_window_overlap_checker/get_shell_surface.
To avoid breaking clients, append destroy after existing requests (and bump the interface version / add since), or introduce a new major protocol version instead of inserting a new request before the existing ones.
<request name="destroy" type="destructor">
<description summary="destroy the dde shell manager">
Destroy the treeland_dde_shell_manager_v1 object.
</description>
</request>
<request name="get_window_overlap_checker">
<arg name="id" type="new_id" interface="treeland_window_overlap_checker" />
</request>
xml/treeland-wallpaper-color-v1.xml:20
destroyis now the first request intreeland_wallpaper_color_manager_v1, which changes the opcode numbers forwatch/unwatch. In Wayland, reordering requests in the XML is a wire-protocol breaking change.
If the goal is just to satisfy protocol XML constraints/style, keep the existing request order (e.g., put destroy after watch/unwatch and before events). If destroy is a new request, it should be appended at the end and gated behind a version bump (since) / new major protocol version.
<interface name="treeland_wallpaper_color_manager_v1" version="1">
<request name="destroy" type="destructor">
<description summary="destroy the context object">
The client no longer cares about wallpaper_color.
</description>
</request>
<request name="watch">
<description summary="watch wallpaper color">
Monitor the wallpaper color of a given screen.
</description>
<arg name="output" type="string" summary="system output name" />
</request>
xml/treeland-shortcut-manager-v1.xml:30
destroywas added ahead ofregister_shortcut_context, which changes the request opcode numbering fortreeland_shortcut_manager_v1. This is a protocol-breaking change for any existing v1 clients.
If a destroy request is needed, it should be appended after existing requests and protected by a version bump (since) or introduced in a new major protocol (there is already a treeland_shortcut_manager_v2.xml for evolution).
<request name="destroy" type="destructor">
<description summary="destroy treeland_shortcut_manager_v1 object" />
</request>
<request name="register_shortcut_context">
<description summary="register shortcut key">
The format of the shortcut key is 'Modify+Key', such as 'Ctrl+Alt+T'.
If the format is wrong, the synthesizer will give a "format error". If the shortcut
key is already registered,
the compositor will give a "register error" and issue a destruction to the context.
</description>
<arg name="key" type="string" />
<arg name="id" type="new_id" interface="treeland_shortcut_context_v1" />
</request>
xml/treeland-window-management-v1.xml:33
- Moving the existing
destroyrequest beforeset_desktopchanges the request opcode numbering fortreeland_window_management_v1(Wayland request opcodes are assigned by XML order). That is a wire-protocol breaking change for any existing clients.
To fix the XML ordering issue without breaking compatibility, keep the original request order by placing destroy after set_desktop (but still before the first <event>), or bump the protocol/iface version and append new requests only at the end with proper versioning (since).
<request name="destroy" type="destructor">
<description summary="destroy the window manager object" />
</request>
<request name="set_desktop">
<description summary="show/hide the desktop">
Tell the compositor to show/hide the desktop.
</description>
<arg name="state" type="uint" summary="requested state" />
</request>
xml/treeland-output-manager-v1.xml:59
- In
treeland_output_color_control_v1, movingdestroyahead ofset_color_temperaturechanges request opcode numbering. Wayland request order is part of the wire protocol, so this is a breaking change.
If you need requests before events for validation, keep the original request order (e.g., set_color_temperature, set_brightness, commit, destroy) and move the whole request block above the events, or bump the interface version and append new requests only at the end with since.
<request name="destroy" type="destructor">
<description summary="Destroy the color control interface." />
</request>
<request name="set_color_temperature">
<description summary="Set color temperature for output">
Color temperature settings are applied only after a commit request is made.
Setting a value outside the range [1000, 20000] is a protocol error.
</description>
<arg name="temperature" type="uint" summary="color temperature in Kelvin"/>
</request>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
break 应该改名字 |
Log: Influence: 1. Test destruction and verify proper cleanup
deepin pr auto review这段代码 diff 显示了对多个 Wayland 协议 XML 文件的修改,主要是为全局管理器接口添加了 以下是对这些修改的审查意见,涵盖语法逻辑、代码质量、代码性能和代码安全方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结建议
修改后的代码片段示例(以 treeland-screensaver-v1.xml 为例): <interface name="treeland_screensaver_v1" version="2">
<description summary="Simple idle inhibit protocol">
This object implements a simple idle inhibit protocol used
to implement org.freedesktop.ScreenSaver D-Bus interface.
<!-- ... -->
</description>
<!-- 建议将 destroy 移到这里 -->
<request name="destroy" type="destructor" since="2">
<description summary="destroy the screensaver object">
Destroy the treeland_screensaver_v1 object.
Objects created through this interface (if any) remain valid.
</description>
</request>
<request name="inhibit">
<!-- ... -->
</request>
<!-- ... -->
</interface> |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wineee, zzxyb The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
No description provided.