Merge branch 'pick' into 'main'

staging: add ext-pick-color protocol

See merge request wayland/wayland-protocols!430
This commit is contained in:
YaoBing Xiao 2025-12-18 11:46:53 +08:00
commit dc06f1d986
2 changed files with 154 additions and 0 deletions

View file

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

View file

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="ext_pick_color_v1">
<copyright>
Copyright © 2024 UnionTech Software Technology Co., Ltd.
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>
<description summary="pick colors from the screen">
This protocol allows a privileged client to pick colors from the screen.
In particular, the client will be able to sample color values at specific
coordinates or through interactive user selection.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension.
</description>
<interface name="ext_pick_color_manager_v1" version="1">
<description summary="manager to control color picking devices">
This interface is a manager that allows creating color picker objects.
Clients can use it to initiate color picking operations with high precision,
including color space information.
</description>
<request name="create_pick_color">
<description summary="create a new color picker">
Create a new color picker object. The compositor may start capturing
input or displaying relevant UI when the picker is activated.
The picker will be created in an inactive state and must be explicitly
activated using the activate request.
</description>
<arg name="id" type="new_id" interface="ext_pick_color_v1"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the manager">
All objects created by the manager will still remain valid, until their
appropriate destroy request has been called.
</description>
</request>
</interface>
<interface name="ext_pick_color_v1" version="1">
<description summary="manage a color picker">
A color picker object allows the client to receive color values selected
from the screen. When active, the compositor may listen for user input,
such as mouse clicks, and respond by sending the corresponding color.
The picker operates in different states and can provide detailed color
information including color space data and pixel coordinates.
When the seat is destroyed, this object becomes inert.
</description>
<enum name="error">
<description summary="picker errors">
These errors can be emitted in response to requests.
</description>
<entry name="invalid_coordinates" value="0" summary="coordinates out of bounds"/>
<entry name="compositor_error" value="1" summary="compositor-side error"/>
</enum>
<enum name="colorspace">
<description summary="color space types">
Supported color spaces for color data.
</description>
<entry name="srgb" value="0" summary="sRGB color space"/>
<entry name="display_p3" value="1" summary="Display P3 color space"/>
<entry name="rec2020" value="2" summary="Rec. 2020 color space"/>
<entry name="adobe_rgb" value="3" summary="Adobe RGB color space"/>
<entry name="bt709" value="4" summary="BT.709 color space"/>
<entry name="unknown" value="5" summary="unknown or custom color space"/>
</enum>
<event name="color">
<description summary="a color was picked">
Sent when the user picks a color. Typically triggered when the user
clicks on a point on the screen while the picker is active.
Each channel is represented as a 32-bit unsigned integer in the range
0 to 4294967295 (inclusive), allowing for high-precision color data.
The values are unpremultiplied.
The coordinates indicate the exact pixel location where the color
was sampled, in surface-local coordinates of the output.
</description>
<arg name="x" type="int" summary="x coordinate of picked pixel"/>
<arg name="y" type="int" summary="y coordinate of picked pixel"/>
<arg name="a" type="uint" summary="alpha channel (04294967295)"/>
<arg name="r" type="uint" summary="red channel (04294967295)"/>
<arg name="g" type="uint" summary="green channel (04294967295)"/>
<arg name="b" type="uint" summary="blue channel (04294967295)"/>
<arg name="colorspace" type="uint" enum="colorspace" summary="color space of the sampled color"/>
</event>
<event name="error">
<description summary="picker error occurred">
Sent when an error occurs during color picking operation.
The picker may become inactive as a result.
</description>
<arg name="error_code" type="uint" enum="error" summary="error type"/>
<arg name="message" type="string" summary="human-readable error description"/>
</event>
<request name="activate">
<description summary="activate the color picker">
Activate the color picker to start capturing user input.
The compositor should show appropriate UI and start monitoring
for user interactions.
</description>
</request>
<request name="pick_at">
<description summary="pick color at specific coordinates">
Request to pick a color at specific coordinates without waiting
for user input. The coordinates are in global compositor space.
This is useful for programmatic color sampling.
</description>
<arg name="x" type="int" summary="x coordinate to sample"/>
<arg name="y" type="int" summary="y coordinate to sample"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the picker object">
Destroys the color picker object.
</description>
</request>
</interface>
</protocol>