v / thirdparty / sokol / fractional-scale-v1-client-protocol.h
264 lines · 237 sloc · 9.39 KB · 5d6de17f708abcf79877f70e677d60a4e23bb727
Raw
1/* Generated by wayland-scanner 1.24.0 */
2
3#ifndef FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
4#define FRACTIONAL_SCALE_V1_CLIENT_PROTOCOL_H
5
6#include <stdint.h>
7#include <stddef.h>
8#include "wayland-client.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14/**
15 * @page page_fractional_scale_v1 The fractional_scale_v1 protocol
16 * Protocol for requesting fractional surface scales
17 *
18 * @section page_desc_fractional_scale_v1 Description
19 *
20 * This protocol allows a compositor to suggest for surfaces to render at
21 * fractional scales.
22 *
23 * A client can submit scaled content by utilizing wp_viewport. This is done by
24 * creating a wp_viewport object for the surface and setting the destination
25 * rectangle to the surface size before the scale factor is applied.
26 *
27 * The buffer size is calculated by multiplying the surface size by the
28 * intended scale.
29 *
30 * The wl_surface buffer scale should remain set to 1.
31 *
32 * If a surface has a surface-local size of 100 px by 50 px and wishes to
33 * submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should
34 * be used and the wp_viewport destination rectangle should be 100 px by 50 px.
35 *
36 * For toplevel surfaces, the size is rounded halfway away from zero. The
37 * rounding algorithm for subsurface position and size is not defined.
38 *
39 * @section page_ifaces_fractional_scale_v1 Interfaces
40 * - @subpage page_iface_wp_fractional_scale_manager_v1 - fractional surface scale information
41 * - @subpage page_iface_wp_fractional_scale_v1 - fractional scale interface to a wl_surface
42 * @section page_copyright_fractional_scale_v1 Copyright
43 * <pre>
44 *
45 * Copyright © 2022 Kenny Levinsen
46 *
47 * Permission is hereby granted, free of charge, to any person obtaining a
48 * copy of this software and associated documentation files (the "Software"),
49 * to deal in the Software without restriction, including without limitation
50 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
51 * and/or sell copies of the Software, and to permit persons to whom the
52 * Software is furnished to do so, subject to the following conditions:
53 *
54 * The above copyright notice and this permission notice (including the next
55 * paragraph) shall be included in all copies or substantial portions of the
56 * Software.
57 *
58 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
59 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
60 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
61 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
62 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
63 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
64 * DEALINGS IN THE SOFTWARE.
65 * </pre>
66 */
67struct wl_surface;
68struct wp_fractional_scale_manager_v1;
69struct wp_fractional_scale_v1;
70
71#ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
72#define WP_FRACTIONAL_SCALE_MANAGER_V1_INTERFACE
73/**
74 * @page page_iface_wp_fractional_scale_manager_v1 wp_fractional_scale_manager_v1
75 * @section page_iface_wp_fractional_scale_manager_v1_desc Description
76 *
77 * A global interface for requesting surfaces to use fractional scales.
78 * @section page_iface_wp_fractional_scale_manager_v1_api API
79 * See @ref iface_wp_fractional_scale_manager_v1.
80 */
81/**
82 * @defgroup iface_wp_fractional_scale_manager_v1 The wp_fractional_scale_manager_v1 interface
83 *
84 * A global interface for requesting surfaces to use fractional scales.
85 */
86extern const struct wl_interface wp_fractional_scale_manager_v1_interface;
87#endif
88#ifndef WP_FRACTIONAL_SCALE_V1_INTERFACE
89#define WP_FRACTIONAL_SCALE_V1_INTERFACE
90/**
91 * @page page_iface_wp_fractional_scale_v1 wp_fractional_scale_v1
92 * @section page_iface_wp_fractional_scale_v1_desc Description
93 *
94 * An additional interface to a wl_surface object which allows the compositor
95 * to inform the client of the preferred scale.
96 * @section page_iface_wp_fractional_scale_v1_api API
97 * See @ref iface_wp_fractional_scale_v1.
98 */
99/**
100 * @defgroup iface_wp_fractional_scale_v1 The wp_fractional_scale_v1 interface
101 *
102 * An additional interface to a wl_surface object which allows the compositor
103 * to inform the client of the preferred scale.
104 */
105extern const struct wl_interface wp_fractional_scale_v1_interface;
106#endif
107
108#ifndef WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
109#define WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM
110enum wp_fractional_scale_manager_v1_error {
111 /**
112 * the surface already has a fractional_scale object associated
113 */
114 WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS = 0,
115};
116#endif /* WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_ENUM */
117
118#define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY 0
119#define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE 1
120
121
122/**
123 * @ingroup iface_wp_fractional_scale_manager_v1
124 */
125#define WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY_SINCE_VERSION 1
126/**
127 * @ingroup iface_wp_fractional_scale_manager_v1
128 */
129#define WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE_SINCE_VERSION 1
130
131/** @ingroup iface_wp_fractional_scale_manager_v1 */
132static inline void
133wp_fractional_scale_manager_v1_set_user_data(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1, void *user_data)
134{
135 wl_proxy_set_user_data((struct wl_proxy *) wp_fractional_scale_manager_v1, user_data);
136}
137
138/** @ingroup iface_wp_fractional_scale_manager_v1 */
139static inline void *
140wp_fractional_scale_manager_v1_get_user_data(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
141{
142 return wl_proxy_get_user_data((struct wl_proxy *) wp_fractional_scale_manager_v1);
143}
144
145static inline uint32_t
146wp_fractional_scale_manager_v1_get_version(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
147{
148 return wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1);
149}
150
151/**
152 * @ingroup iface_wp_fractional_scale_manager_v1
153 *
154 * Informs the server that the client will not be using this protocol
155 * object anymore. This does not affect any other objects,
156 * wp_fractional_scale_v1 objects included.
157 */
158static inline void
159wp_fractional_scale_manager_v1_destroy(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1)
160{
161 wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_manager_v1,
162 WP_FRACTIONAL_SCALE_MANAGER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1), WL_MARSHAL_FLAG_DESTROY);
163}
164
165/**
166 * @ingroup iface_wp_fractional_scale_manager_v1
167 *
168 * Create an add-on object for the the wl_surface to let the compositor
169 * request fractional scales. If the given wl_surface already has a
170 * wp_fractional_scale_v1 object associated, the fractional_scale_exists
171 * protocol error is raised.
172 */
173static inline struct wp_fractional_scale_v1 *
174wp_fractional_scale_manager_v1_get_fractional_scale(struct wp_fractional_scale_manager_v1 *wp_fractional_scale_manager_v1, struct wl_surface *surface)
175{
176 struct wl_proxy *id;
177
178 id = wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_manager_v1,
179 WP_FRACTIONAL_SCALE_MANAGER_V1_GET_FRACTIONAL_SCALE, &wp_fractional_scale_v1_interface, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_manager_v1), 0, NULL, surface);
180
181 return (struct wp_fractional_scale_v1 *) id;
182}
183
184/**
185 * @ingroup iface_wp_fractional_scale_v1
186 * @struct wp_fractional_scale_v1_listener
187 */
188struct wp_fractional_scale_v1_listener {
189 /**
190 * notify of new preferred scale
191 *
192 * Notification of a new preferred scale for this surface that
193 * the compositor suggests that the client should use.
194 *
195 * The sent scale is the numerator of a fraction with a denominator
196 * of 120.
197 * @param scale the new preferred scale
198 */
199 void (*preferred_scale)(void *data,
200 struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
201 uint32_t scale);
202};
203
204/**
205 * @ingroup iface_wp_fractional_scale_v1
206 */
207static inline int
208wp_fractional_scale_v1_add_listener(struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
209 const struct wp_fractional_scale_v1_listener *listener, void *data)
210{
211 return wl_proxy_add_listener((struct wl_proxy *) wp_fractional_scale_v1,
212 (void (**)(void)) listener, data);
213}
214
215#define WP_FRACTIONAL_SCALE_V1_DESTROY 0
216
217/**
218 * @ingroup iface_wp_fractional_scale_v1
219 */
220#define WP_FRACTIONAL_SCALE_V1_PREFERRED_SCALE_SINCE_VERSION 1
221
222/**
223 * @ingroup iface_wp_fractional_scale_v1
224 */
225#define WP_FRACTIONAL_SCALE_V1_DESTROY_SINCE_VERSION 1
226
227/** @ingroup iface_wp_fractional_scale_v1 */
228static inline void
229wp_fractional_scale_v1_set_user_data(struct wp_fractional_scale_v1 *wp_fractional_scale_v1, void *user_data)
230{
231 wl_proxy_set_user_data((struct wl_proxy *) wp_fractional_scale_v1, user_data);
232}
233
234/** @ingroup iface_wp_fractional_scale_v1 */
235static inline void *
236wp_fractional_scale_v1_get_user_data(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
237{
238 return wl_proxy_get_user_data((struct wl_proxy *) wp_fractional_scale_v1);
239}
240
241static inline uint32_t
242wp_fractional_scale_v1_get_version(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
243{
244 return wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_v1);
245}
246
247/**
248 * @ingroup iface_wp_fractional_scale_v1
249 *
250 * Destroy the fractional scale object. When this object is destroyed,
251 * preferred_scale events will no longer be sent.
252 */
253static inline void
254wp_fractional_scale_v1_destroy(struct wp_fractional_scale_v1 *wp_fractional_scale_v1)
255{
256 wl_proxy_marshal_flags((struct wl_proxy *) wp_fractional_scale_v1,
257 WP_FRACTIONAL_SCALE_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_fractional_scale_v1), WL_MARSHAL_FLAG_DESTROY);
258}
259
260#ifdef __cplusplus
261}
262#endif
263
264#endif
265