1b877906bSopenharmony_ci<?xml version="1.0" encoding="UTF-8"?>
2b877906bSopenharmony_ci<protocol name="fractional_scale_v1">
3b877906bSopenharmony_ci  <copyright>
4b877906bSopenharmony_ci    Copyright © 2022 Kenny Levinsen
5b877906bSopenharmony_ci
6b877906bSopenharmony_ci    Permission is hereby granted, free of charge, to any person obtaining a
7b877906bSopenharmony_ci    copy of this software and associated documentation files (the "Software"),
8b877906bSopenharmony_ci    to deal in the Software without restriction, including without limitation
9b877906bSopenharmony_ci    the rights to use, copy, modify, merge, publish, distribute, sublicense,
10b877906bSopenharmony_ci    and/or sell copies of the Software, and to permit persons to whom the
11b877906bSopenharmony_ci    Software is furnished to do so, subject to the following conditions:
12b877906bSopenharmony_ci
13b877906bSopenharmony_ci    The above copyright notice and this permission notice (including the next
14b877906bSopenharmony_ci    paragraph) shall be included in all copies or substantial portions of the
15b877906bSopenharmony_ci    Software.
16b877906bSopenharmony_ci
17b877906bSopenharmony_ci    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18b877906bSopenharmony_ci    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19b877906bSopenharmony_ci    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20b877906bSopenharmony_ci    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21b877906bSopenharmony_ci    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22b877906bSopenharmony_ci    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23b877906bSopenharmony_ci    DEALINGS IN THE SOFTWARE.
24b877906bSopenharmony_ci  </copyright>
25b877906bSopenharmony_ci
26b877906bSopenharmony_ci  <description summary="Protocol for requesting fractional surface scales">
27b877906bSopenharmony_ci    This protocol allows a compositor to suggest for surfaces to render at
28b877906bSopenharmony_ci    fractional scales.
29b877906bSopenharmony_ci
30b877906bSopenharmony_ci    A client can submit scaled content by utilizing wp_viewport. This is done by
31b877906bSopenharmony_ci    creating a wp_viewport object for the surface and setting the destination
32b877906bSopenharmony_ci    rectangle to the surface size before the scale factor is applied.
33b877906bSopenharmony_ci
34b877906bSopenharmony_ci    The buffer size is calculated by multiplying the surface size by the
35b877906bSopenharmony_ci    intended scale.
36b877906bSopenharmony_ci
37b877906bSopenharmony_ci    The wl_surface buffer scale should remain set to 1.
38b877906bSopenharmony_ci
39b877906bSopenharmony_ci    If a surface has a surface-local size of 100 px by 50 px and wishes to
40b877906bSopenharmony_ci    submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
41b877906bSopenharmony_ci    be used and the wp_viewport destination rectangle should be 100 px by 50 px.
42b877906bSopenharmony_ci
43b877906bSopenharmony_ci    For toplevel surfaces, the size is rounded halfway away from zero. The
44b877906bSopenharmony_ci    rounding algorithm for subsurface position and size is not defined.
45b877906bSopenharmony_ci  </description>
46b877906bSopenharmony_ci
47b877906bSopenharmony_ci  <interface name="wp_fractional_scale_manager_v1" version="1">
48b877906bSopenharmony_ci    <description summary="fractional surface scale information">
49b877906bSopenharmony_ci      A global interface for requesting surfaces to use fractional scales.
50b877906bSopenharmony_ci    </description>
51b877906bSopenharmony_ci
52b877906bSopenharmony_ci    <request name="destroy" type="destructor">
53b877906bSopenharmony_ci      <description summary="unbind the fractional surface scale interface">
54b877906bSopenharmony_ci        Informs the server that the client will not be using this protocol
55b877906bSopenharmony_ci        object anymore. This does not affect any other objects,
56b877906bSopenharmony_ci        wp_fractional_scale_v1 objects included.
57b877906bSopenharmony_ci      </description>
58b877906bSopenharmony_ci    </request>
59b877906bSopenharmony_ci
60b877906bSopenharmony_ci    <enum name="error">
61b877906bSopenharmony_ci      <entry name="fractional_scale_exists" value="0"
62b877906bSopenharmony_ci        summary="the surface already has a fractional_scale object associated"/>
63b877906bSopenharmony_ci    </enum>
64b877906bSopenharmony_ci
65b877906bSopenharmony_ci    <request name="get_fractional_scale">
66b877906bSopenharmony_ci      <description summary="extend surface interface for scale information">
67b877906bSopenharmony_ci        Create an add-on object for the the wl_surface to let the compositor
68b877906bSopenharmony_ci        request fractional scales. If the given wl_surface already has a
69b877906bSopenharmony_ci        wp_fractional_scale_v1 object associated, the fractional_scale_exists
70b877906bSopenharmony_ci        protocol error is raised.
71b877906bSopenharmony_ci      </description>
72b877906bSopenharmony_ci      <arg name="id" type="new_id" interface="wp_fractional_scale_v1"
73b877906bSopenharmony_ci           summary="the new surface scale info interface id"/>
74b877906bSopenharmony_ci      <arg name="surface" type="object" interface="wl_surface"
75b877906bSopenharmony_ci           summary="the surface"/>
76b877906bSopenharmony_ci    </request>
77b877906bSopenharmony_ci  </interface>
78b877906bSopenharmony_ci
79b877906bSopenharmony_ci  <interface name="wp_fractional_scale_v1" version="1">
80b877906bSopenharmony_ci    <description summary="fractional scale interface to a wl_surface">
81b877906bSopenharmony_ci      An additional interface to a wl_surface object which allows the compositor
82b877906bSopenharmony_ci      to inform the client of the preferred scale.
83b877906bSopenharmony_ci    </description>
84b877906bSopenharmony_ci
85b877906bSopenharmony_ci    <request name="destroy" type="destructor">
86b877906bSopenharmony_ci      <description summary="remove surface scale information for surface">
87b877906bSopenharmony_ci        Destroy the fractional scale object. When this object is destroyed,
88b877906bSopenharmony_ci        preferred_scale events will no longer be sent.
89b877906bSopenharmony_ci      </description>
90b877906bSopenharmony_ci    </request>
91b877906bSopenharmony_ci
92b877906bSopenharmony_ci    <event name="preferred_scale">
93b877906bSopenharmony_ci      <description summary="notify of new preferred scale">
94b877906bSopenharmony_ci        Notification of a new preferred scale for this surface that the
95b877906bSopenharmony_ci        compositor suggests that the client should use.
96b877906bSopenharmony_ci
97b877906bSopenharmony_ci        The sent scale is the numerator of a fraction with a denominator of 120.
98b877906bSopenharmony_ci      </description>
99b877906bSopenharmony_ci      <arg name="scale" type="uint" summary="the new preferred scale"/>
100b877906bSopenharmony_ci    </event>
101b877906bSopenharmony_ci  </interface>
102b877906bSopenharmony_ci</protocol>
103