From 2a52f1eee0c11901ad949b2063ae4e8582a4a6cc Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Thu, 9 Oct 2025 14:11:47 +0200 Subject: [PATCH 1/2] staging: add xdg-surface-shape-v1 This protocol provides a way for clients to communicate the shape of their surface, for example the radii of rounded corners. This hint can then be used by the compositor to draw fitting outlines or prevent overdrawing of other server-side drawn interfaces. Signed-off-by: Victoria Brekenfeld --- meson.build | 1 + staging/xdg-surface-shape/README | 4 + .../xdg-surface-shape-v1.xml | 120 ++++++++++++++++++ 3 files changed, 125 insertions(+) create mode 100644 staging/xdg-surface-shape/README create mode 100644 staging/xdg-surface-shape/xdg-surface-shape-v1.xml diff --git a/meson.build b/meson.build index cb9792b..e1596be 100644 --- a/meson.build +++ b/meson.build @@ -70,6 +70,7 @@ staging_protocols = { 'tearing-control': ['v1'], 'xdg-activation': ['v1'], 'xdg-dialog': ['v1'], + 'xdg-surface-shape': ['v1'], 'xdg-system-bell': ['v1'], 'xdg-toplevel-drag': ['v1'], 'xdg-toplevel-icon': ['v1'], diff --git a/staging/xdg-surface-shape/README b/staging/xdg-surface-shape/README new file mode 100644 index 0000000..d537d7e --- /dev/null +++ b/staging/xdg-surface-shape/README @@ -0,0 +1,4 @@ +Surface shape + +Maintainers: +Victoria Brekenfeld (@drakulix) diff --git a/staging/xdg-surface-shape/xdg-surface-shape-v1.xml b/staging/xdg-surface-shape/xdg-surface-shape-v1.xml new file mode 100644 index 0000000..c07a26d --- /dev/null +++ b/staging/xdg-surface-shape/xdg-surface-shape-v1.xml @@ -0,0 +1,120 @@ + + + + Copyright © 2025 Victoria Brekenfeld + + 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. + + + + This protocol provides a way for clients to communicate the + shape of their surface, for example the radii of rounded corners. + + This hint can then be used by the compositor to draw fitting outlines + or prevent overdrawing of other server-side drawn interfaces. + + + + + Manager for creating surface shape objects for existing xdg-surfaces + + + + + Informs the server, that the client will no longer use this global. + Any previously created surface-shape objects remain valid until destroyed. + + + + + + Instantiate an interface extension for the given xdg_surface to specify their corner radius. + + If the given xdg_surface already has a xdg_surface_shape_v1 object associated, + the surface_shape_exists protocol error will be raised. + + + + + + + + + + + + + The surface-shape object provides a way to specify the shape of + it's associated xdg_surface to the compositor. + + If the xdg_surface associated with the xdg_surface_shape_v1 + object has been destroyed, this object becomes inert. Any further requests + other than destroy will raise the surface_destroyed protocol error. + + + + + Informs the server that the client will no longer be using this protocol + object. The surface-shape state will be unset on the next commit. + + + + + + This request sets the hinted corner radii values for rectangular windows. + + The corner radii hint is double-buffered and will be applied on + the next wl_surface.commit. + + The value is given in logical space relative to the window geometry of the + associated xdg_surface. If any value exceeds a quarter of either dimension + of the window geometry the radius_too_large protocol error is raised. + + + + + + + + + + Unsets any previously hinted corner radii values without invalidating the object for later use. + Can be used by clients that possibly have temporary irregular shapes. + + The corner radii hint is double-buffered, meaning the previous state + will still apply until the next wl_surface.commit. + + Compositors should treat a surface with an unset-radii the same as surface + with a freshly created xdg_surface_shape_v1 that has no radii set yet or + any surface without an xdg_surface_shape_v1 object for that matter. + + + + + + + + + From 46322e9bc6169032ad6f5068f689136cf3bf7e18 Mon Sep 17 00:00:00 2001 From: Victoria Brekenfeld Date: Fri, 10 Oct 2025 14:39:57 +0200 Subject: [PATCH 2/2] surface-shape: address review feedback Signed-off-by: Victoria Brekenfeld --- .../xdg-surface-shape-v1.xml | 100 +++++++++++++----- 1 file changed, 74 insertions(+), 26 deletions(-) diff --git a/staging/xdg-surface-shape/xdg-surface-shape-v1.xml b/staging/xdg-surface-shape/xdg-surface-shape-v1.xml index c07a26d..479991b 100644 --- a/staging/xdg-surface-shape/xdg-surface-shape-v1.xml +++ b/staging/xdg-surface-shape/xdg-surface-shape-v1.xml @@ -1,4 +1,4 @@ - + Copyright © 2025 Victoria Brekenfeld @@ -38,37 +38,50 @@ - Informs the server, that the client will no longer use this global. + Informs the server that the client will no longer use this global. Any previously created surface-shape objects remain valid until destroyed. - - Instantiate an interface extension for the given xdg_surface to specify their corner radius. + + Instantiate an interface extension for the given xdg_surface to specify its shape. If the given xdg_surface already has a xdg_surface_shape_v1 object associated, the surface_shape_exists protocol error will be raised. - - + + - + The surface-shape object provides a way to specify the shape of - it's associated xdg_surface to the compositor. + its associated xdg_surface to the compositor. If the xdg_surface associated with the xdg_surface_shape_v1 - object has been destroyed, this object becomes inert. Any further requests + object has been destroyed, any further requests to this object other than destroy will raise the surface_destroyed protocol error. @@ -81,25 +94,54 @@ - This request sets the hinted corner radii values for rectangular windows. + This request sets the hinted corner radii values for windows + whose geometry is shaped as a rounded rectangle. The corner radii hint is double-buffered and will be applied on the next wl_surface.commit. - The value is given in logical space relative to the window geometry of the - associated xdg_surface. If any value exceeds a quarter of either dimension - of the window geometry the radius_too_large protocol error is raised. + The values are in logical pixels and define the corner radii of the window + geometry of associated xdg_surface (see xdg_surface.set_window_geometry). + If any value exceeds half of either dimension of the window geometry + the radius_too_large protocol error is raised. + + If your surface's visual geometry shape isn't a rounded rectangle, + then you shouldn't use this request to set the corner radii, + as the shape won't match what the compositor expects. + + For example, do not use this request if your surface: + - is freeform or has a custom shape + - is a rounded rectangle, but this rectangle doesn't exactly match + your xdg_surface window geometry + + If your surface's geometry is a rounded rectangle, but not for every corner + (e.g. only one of the corners is a free-form shape), then you can set that + corner's value to 0 (implying a square corner) or to some reasonable + approximation of a circle corner. + + If your surface's geometry is a rectangle with square corners, it is still + useful to explicitly set the radii to 0, since that lets the compositor + differentiate known-square windows from freeform windows. + + For known-square windows the compositor can draw a border around the window, + whereas for freeform windows the compositor may need to draw a solid + background, since the window shape is unknown. - - - - + + + + - Unsets any previously hinted corner radii values without invalidating the object for later use. - Can be used by clients that possibly have temporary irregular shapes. + Unsets any previously hinted corner radii values without invalidating + the object for later use. Can be used by clients that have temporary + irregular shapes. The corner radii hint is double-buffered, meaning the previous state will still apply until the next wl_surface.commit. @@ -111,10 +153,16 @@ - - + +