Merge branch 'icon' into 'main'

ext-foreign-toplevel-list: add icon event for toplevel

See merge request wayland/wayland-protocols!451
This commit is contained in:
YaoBing Xiao 2025-12-17 10:08:22 +08:00
commit f7d0ae9683
2 changed files with 65 additions and 1 deletions

View file

@ -120,7 +120,7 @@
</request>
</interface>
<interface name="ext_foreign_toplevel_handle_v1" version="1">
<interface name="ext_foreign_toplevel_handle_v1" version="2">
<description summary="a mapped toplevel">
A ext_foreign_toplevel_handle_v1 object represents a mapped toplevel
window. A single app may have multiple mapped toplevels.
@ -215,5 +215,27 @@
</description>
<arg name="identifier" type="string"/>
</event>
<!-- Version 2 additions -->
<event name="icon" since="2">
<description summary="icon information">
This event provides the icon name for the toplevel. The icon name
follows the freedesktop.org icon naming specification, allowing
clients to load the appropriate icon from the current icon theme.
This event is only sent when the toplevel has set an icon name via
xdg_toplevel_icon_v1.set_name. If the toplevel has not set an icon
name through this mechanism, this event will not be sent. In such
cases, clients should use
ext_foreign_toplevel_icon_image_capture_source_manager_v1 from
the ext-image-capture-source-v1 protocol to capture the toplevel's
icon if it was set via xdg_toplevel_icon_v1.add_buffer.
The configured state must not be applied immediately. See
ext_foreign_toplevel_handle_v1.done for details.
</description>
<arg name="icon_name" type="string"
summary="icon name following freedesktop.org icon naming specification"/>
</event>
</interface>
</protocol>

View file

@ -106,4 +106,46 @@
</description>
</request>
</interface>
<interface name="ext_foreign_toplevel_icon_image_capture_source_manager_v1" version="1">
<description summary="image capture source manager for foreign toplevel icons">
A manager for creating image capture source objects for capturing the
icon of ext_foreign_toplevel_handle_v1 objects.
This is intended as a fallback mechanism when the compositor does not
provide icon information via the ext_foreign_toplevel_handle_v1.icon
event. Clients should prefer using the icon event when available, and
only use this capture mechanism when the icon event is not sent.
</description>
<request name="create_source">
<description summary="create source object for foreign toplevel icon">
Creates a source object for capturing a foreign toplevel's icon.
Images captured from this source will show the icon of the toplevel.
This capture source is valid in two cases:
1. The toplevel has not used xdg_toplevel_icon_v1 at all
2. The toplevel has set an icon using xdg_toplevel_icon_v1.add_buffer
(capturing the explicitly set icon buffer)
If the toplevel has only used xdg_toplevel_icon_v1.set_name without
add_buffer, the capture source may fail or produce empty/invalid
results, as there is no pixel data to capture.
Clients should check if the toplevel provides icon information via
the ext_foreign_toplevel_handle_v1.icon event before attempting to
use this capture mechanism.
</description>
<arg name="source" type="new_id" interface="ext_image_capture_source_v1"/>
<arg name="toplevel_handle" type="object" interface="ext_foreign_toplevel_handle_v1"/>
</request>
<request name="destroy" type="destructor">
<description summary="delete this object">
Destroys the manager. This request may be sent at any time by the client
and objects created by the manager will remain valid after its
destruction.
</description>
</request>
</interface>
</protocol>