Skip to content

Commit 52ea28a

Browse files
committed
Replace generated protocol code with xml.
I now understand how this was supposed to be done.
1 parent 254e96f commit 52ea28a

8 files changed

+495
-1101
lines changed

meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ common_sources = files(
112112
'src/string_vec.c',
113113
'src/surface.c',
114114
'src/unicode.c',
115-
'src/wlr-layer-shell-unstable-v1.c',
116-
'src/wp-fractional-scale-v1.c',
117115
'src/xmalloc.c',
118116
)
119117

@@ -180,6 +178,8 @@ wl_proto_src = []
180178
wl_proto_xml = [
181179
wayland_protocols_dir + '/stable/xdg-shell/xdg-shell.xml',
182180
wayland_protocols_dir + '/stable/viewporter/viewporter.xml',
181+
'protocols/wlr-layer-shell-unstable-v1.xml',
182+
'protocols/fractional-scale-v1.xml'
183183
]
184184

185185
foreach proto : wl_proto_xml

protocols/fractional-scale-v1.xml

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

0 commit comments

Comments
 (0)