Merge branch 'theme' into 'main'

xdg-decoration-theme: Add new protocol

See merge request wayland/wayland-protocols!461
This commit is contained in:
YaoBing Xiao 2025-12-16 18:05:54 +08:00
commit d9a4e57f8d
3 changed files with 87 additions and 0 deletions

View file

@ -42,6 +42,7 @@ unstable_protocols = {
'xdg-output': ['v1'],
'xdg-shell': ['v5', 'v6'],
'xwayland-keyboard-grab': ['v1'],
'xdg-decoration-theme': ['v1'],
}
staging_protocols = {

View file

@ -0,0 +1,5 @@
xdg_decoration_theme protocol
Maintainers:
YaoBing Xiao <xiaoyaobing@uniontech.com> (@zzxyb)

View file

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="xdg_decoration_theme_v1">
<copyright>
Copyright © 2025 YaoBing Xiao
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="zxdg_decoration_theme_manager_v1" version="1">
<description summary="manager for window theme synchronization">
This global interface allows clients to inform the compositor of their
current light or dark theme preference.
The compositor may use this information to render matching decorations
consistent with the client's theme.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the theme manager object"/>
</request>
<request name="get_toplevel_theme">
<description summary="create a theme object associated with an xdg_toplevel">
Create a new decoration theme object associated with a given
xdg_toplevel. The theme object is used to notify the compositor when the
client changes between light and dark modes.
</description>
<arg name="id" type="new_id" interface="zxdg_toplevel_theme_v1"/>
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
</request>
</interface>
<interface name="zxdg_toplevel_theme_v1" version="1">
<description summary="theme object for a toplevel surface">
The toplevel theme object allows a client to notify the compositor of its
active color theme.
The compositor should not enforce the client's theme, but may adjust
decoration colors to match the client's preference.
</description>
<enum name="theme">
<entry name="light" value="1" summary="client currently uses light theme"/>
<entry name="dark" value="2" summary="client currently uses dark theme"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the theme object"/>
</request>
<request name="set_theme">
<description summary="notify compositor of current theme">
Notify the compositor that the client is currently using the specified
theme mode. The compositor may use this information to adjust the color
of decorations for this toplevel.
This request can be sent any time, such as when the user toggles between
light and dark modes.
</description>
<arg name="theme" type="uint" enum="theme" summary="current theme mode"/>
</request>
</interface>
</protocol>