From b124a7355bee24c402b7639d60dc3904dc51c484 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Fri, 13 Dec 2024 17:40:47 +0100 Subject: [PATCH] add fractional-scale-v2 protocol Fractional scaling is a way of scaling user interfaces that allows for non-integer scaling factors. In order to support multiple displays with different fractional scaling factors properly and prevent size mismatches in all relevant situations, multiple coordinate spaces need to be used. This commit adds a protocol that adds the ability for compositor and client to change the coordinate space of their communication for that purpose. Signed-off-by: Xaver Hugl --- meson.build | 2 +- staging/fractional-scale/README | 5 +- .../fractional-scale/fractional-scale-v2.xml | 129 ++++++++++++++++++ 3 files changed, 134 insertions(+), 2 deletions(-) create mode 100644 staging/fractional-scale/fractional-scale-v2.xml diff --git a/meson.build b/meson.build index cb9792b..c72a5ea 100644 --- a/meson.build +++ b/meson.build @@ -62,7 +62,7 @@ staging_protocols = { 'ext-transient-seat': ['v1'], 'ext-workspace': ['v1'], 'fifo': ['v1'], - 'fractional-scale': ['v1'], + 'fractional-scale': ['v1', 'v2'], 'linux-drm-syncobj': ['v1'], 'pointer-warp': ['v1'], 'security-context': ['v1'], diff --git a/staging/fractional-scale/README b/staging/fractional-scale/README index 3b8500c..eb9cc7f 100644 --- a/staging/fractional-scale/README +++ b/staging/fractional-scale/README @@ -1,4 +1,7 @@ wp fractional scale protocol -Maintainers: +Maintainers v1: Kenny Levinsen (@kennylevinsen) + +Maintainers v2: +Xaver Hugl (@Zamundaaa) diff --git a/staging/fractional-scale/fractional-scale-v2.xml b/staging/fractional-scale/fractional-scale-v2.xml new file mode 100644 index 0000000..f77cebe --- /dev/null +++ b/staging/fractional-scale/fractional-scale-v2.xml @@ -0,0 +1,129 @@ + + + + Copyright © 2022 Xaver Hugl + + 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 allows compositors and clients to communicate the + coordinate space their surfaces act in. + + + + + A global interface to create wp_fractional_scale_v2 interfaces. + + + + + Informs the server that the client will not be using this protocol + object anymore. This does not affect any other objects. + + + + + + + + + + Create an interface object for a wl_surface to communicate scale. + If the given wl_surface already has a wp_fractional_scale_v2 object + associated, the fractional_scale_exists protocol error is raised. + + + + + + + + + An additional interface for a wl_surface object that allows compositor and + client to communicate in a different coordinate space, in order to enable + them to accurately describe coordinates and sizes in pixels. + The two coordinate spaces in consideration are logical and pixels, where + logical coordinates describe the size content should have and pixels + describe the size of buffers. + + A scale of one equals a lack of scaling, where the communicated values + define both logical coordinates and pixels. + A scale greater than one describes that for every logical coordinate, + more than one pixel is used, and a scale less than one describes that + multiple logical coordinates make up one pixel. + In mathematical terms, logical coordinates can be obtained by dividing + the provided values by the currently active scale. + + The initial compositor and client coordinate scale factors are 1. + + + + + This event sets a scale factor for the associated wl_surface that + describes the coordinate system the compositor will use for events + following wp_fractional_scale_v2.scale_factor. + + The scale factor is encoded in a 8.24 fixed point format. + + The compositor must not send a scale of zero. + + The client should re-render and commit a new buffer with the new scale + as soon as possible, in order to avoid artifacts caused by the mismatch + in compositor and client scales. + + + + + + + This request sets a scale factor for the associated wl_surface that + describes the coordinate system the client uses for requests following + wp_fractional_scale_v2.set_scale_factor. + + The scale factor is encoded in a 8.24 fixed point format. + + If this scale factor does not match the scale factor provided by the + compositor with wp_fractional_scale_v2.scale_factor, the compositor may + apply transformations to the wl_surface that can result in blurriness + or other artifacts. + + If scale_8_24 is zero, the error invalid_scale will be raised. + + + + + + + The wl_surface's wp_fractional_scale_v2 object is destroyed, and the + associated scale is reset to 1. + + + + + + + + +