fordon_greeman / moosicpalyer

Branch: 279a9c7
Switch branches/tags
main
theidioticdev now you can build for x11 and build for wayland 279a9c7 8d ago
398 lines · 14.2 KB Raw Blame History
1 /* Generated by wayland-scanner 1.26.0 */
2
3 #ifndef VIEWPORTER_CLIENT_PROTOCOL_H
4 #define VIEWPORTER_CLIENT_PROTOCOL_H
5
6 #include <stdint.h>
7 #include <stddef.h>
8 #include "wayland-client.h"
9
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13
14 /**
15 * @page page_viewporter The viewporter protocol
16 * @section page_ifaces_viewporter Interfaces
17 * - @subpage page_iface_wp_viewporter - surface cropping and scaling
18 * - @subpage page_iface_wp_viewport - crop and scale interface to a wl_surface
19 * @section page_copyright_viewporter Copyright
20 * <pre>
21 *
22 * Copyright © 2013-2016 Collabora, Ltd.
23 *
24 * Permission is hereby granted, free of charge, to any person obtaining a
25 * copy of this software and associated documentation files (the "Software"),
26 * to deal in the Software without restriction, including without limitation
27 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
28 * and/or sell copies of the Software, and to permit persons to whom the
29 * Software is furnished to do so, subject to the following conditions:
30 *
31 * The above copyright notice and this permission notice (including the next
32 * paragraph) shall be included in all copies or substantial portions of the
33 * Software.
34 *
35 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
41 * DEALINGS IN THE SOFTWARE.
42 * </pre>
43 */
44 struct wl_surface;
45 struct wp_viewport;
46 struct wp_viewporter;
47
48 #ifndef WP_VIEWPORTER_INTERFACE
49 #define WP_VIEWPORTER_INTERFACE
50 /**
51 * @page page_iface_wp_viewporter wp_viewporter
52 * @section page_iface_wp_viewporter_desc Description
53 *
54 * The global interface exposing surface cropping and scaling
55 * capabilities is used to instantiate an interface extension for a
56 * wl_surface object. This extended interface will then allow
57 * cropping and scaling the surface contents, effectively
58 * disconnecting the direct relationship between the buffer and the
59 * surface size.
60 * @section page_iface_wp_viewporter_api API
61 * See @ref iface_wp_viewporter.
62 */
63 /**
64 * @defgroup iface_wp_viewporter The wp_viewporter interface
65 *
66 * The global interface exposing surface cropping and scaling
67 * capabilities is used to instantiate an interface extension for a
68 * wl_surface object. This extended interface will then allow
69 * cropping and scaling the surface contents, effectively
70 * disconnecting the direct relationship between the buffer and the
71 * surface size.
72 */
73 extern const struct wl_interface wp_viewporter_interface;
74 #endif
75 #ifndef WP_VIEWPORT_INTERFACE
76 #define WP_VIEWPORT_INTERFACE
77 /**
78 * @page page_iface_wp_viewport wp_viewport
79 * @section page_iface_wp_viewport_desc Description
80 *
81 * An additional interface to a wl_surface object, which allows the
82 * client to specify the cropping and scaling of the surface
83 * contents.
84 *
85 * This interface works with two concepts: the source rectangle (src_x,
86 * src_y, src_width, src_height), and the destination size (dst_width,
87 * dst_height). The contents of the source rectangle are scaled to the
88 * destination size, and content outside the source rectangle is ignored.
89 * This state is double-buffered, and is applied on the next
90 * wl_surface.commit.
91 *
92 * The two parts of crop and scale state are independent: the source
93 * rectangle, and the destination size. Initially both are unset, that
94 * is, no scaling is applied. The whole of the current wl_buffer is
95 * used as the source, and the surface size is as defined in
96 * wl_surface.attach.
97 *
98 * If the destination size is set, it causes the surface size to become
99 * dst_width, dst_height. The source (rectangle) is scaled to exactly
100 * this size. This overrides whatever the attached wl_buffer size is,
101 * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
102 * has no content and therefore no size. Otherwise, the size is always
103 * at least 1x1 in surface local coordinates.
104 *
105 * If the source rectangle is set, it defines what area of the wl_buffer is
106 * taken as the source. If the source rectangle is set and the destination
107 * size is not set, then src_width and src_height must be integers, and the
108 * surface size becomes the source rectangle size. This results in cropping
109 * without scaling. If src_width or src_height are not integers and
110 * destination size is not set, the bad_size protocol error is raised when
111 * the surface state is applied.
112 *
113 * The coordinate transformations from buffer pixel coordinates up to
114 * the surface-local coordinates happen in the following order:
115 * 1. buffer_transform (wl_surface.set_buffer_transform)
116 * 2. buffer_scale (wl_surface.set_buffer_scale)
117 * 3. crop and scale (wp_viewport.set*)
118 * This means, that the source rectangle coordinates of crop and scale
119 * are given in the coordinates after the buffer transform and scale,
120 * i.e. in the coordinates that would be the surface-local coordinates
121 * if the crop and scale was not applied.
122 *
123 * If src_x or src_y are negative, the bad_value protocol error is raised.
124 * Otherwise, if the source rectangle is partially or completely outside of
125 * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
126 * when the surface state is applied. A NULL wl_buffer does not raise the
127 * out_of_buffer error.
128 *
129 * If the wl_surface associated with the wp_viewport is destroyed,
130 * all wp_viewport requests except 'destroy' raise the protocol error
131 * no_surface.
132 *
133 * If the wp_viewport object is destroyed, the crop and scale
134 * state is removed from the wl_surface. The change will be applied
135 * on the next wl_surface.commit.
136 * @section page_iface_wp_viewport_api API
137 * See @ref iface_wp_viewport.
138 */
139 /**
140 * @defgroup iface_wp_viewport The wp_viewport interface
141 *
142 * An additional interface to a wl_surface object, which allows the
143 * client to specify the cropping and scaling of the surface
144 * contents.
145 *
146 * This interface works with two concepts: the source rectangle (src_x,
147 * src_y, src_width, src_height), and the destination size (dst_width,
148 * dst_height). The contents of the source rectangle are scaled to the
149 * destination size, and content outside the source rectangle is ignored.
150 * This state is double-buffered, and is applied on the next
151 * wl_surface.commit.
152 *
153 * The two parts of crop and scale state are independent: the source
154 * rectangle, and the destination size. Initially both are unset, that
155 * is, no scaling is applied. The whole of the current wl_buffer is
156 * used as the source, and the surface size is as defined in
157 * wl_surface.attach.
158 *
159 * If the destination size is set, it causes the surface size to become
160 * dst_width, dst_height. The source (rectangle) is scaled to exactly
161 * this size. This overrides whatever the attached wl_buffer size is,
162 * unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface
163 * has no content and therefore no size. Otherwise, the size is always
164 * at least 1x1 in surface local coordinates.
165 *
166 * If the source rectangle is set, it defines what area of the wl_buffer is
167 * taken as the source. If the source rectangle is set and the destination
168 * size is not set, then src_width and src_height must be integers, and the
169 * surface size becomes the source rectangle size. This results in cropping
170 * without scaling. If src_width or src_height are not integers and
171 * destination size is not set, the bad_size protocol error is raised when
172 * the surface state is applied.
173 *
174 * The coordinate transformations from buffer pixel coordinates up to
175 * the surface-local coordinates happen in the following order:
176 * 1. buffer_transform (wl_surface.set_buffer_transform)
177 * 2. buffer_scale (wl_surface.set_buffer_scale)
178 * 3. crop and scale (wp_viewport.set*)
179 * This means, that the source rectangle coordinates of crop and scale
180 * are given in the coordinates after the buffer transform and scale,
181 * i.e. in the coordinates that would be the surface-local coordinates
182 * if the crop and scale was not applied.
183 *
184 * If src_x or src_y are negative, the bad_value protocol error is raised.
185 * Otherwise, if the source rectangle is partially or completely outside of
186 * the non-NULL wl_buffer, then the out_of_buffer protocol error is raised
187 * when the surface state is applied. A NULL wl_buffer does not raise the
188 * out_of_buffer error.
189 *
190 * If the wl_surface associated with the wp_viewport is destroyed,
191 * all wp_viewport requests except 'destroy' raise the protocol error
192 * no_surface.
193 *
194 * If the wp_viewport object is destroyed, the crop and scale
195 * state is removed from the wl_surface. The change will be applied
196 * on the next wl_surface.commit.
197 */
198 extern const struct wl_interface wp_viewport_interface;
199 #endif
200
201 #ifndef WP_VIEWPORTER_ERROR_ENUM
202 #define WP_VIEWPORTER_ERROR_ENUM
203 enum wp_viewporter_error {
204 /**
205 * the surface already has a viewport object associated
206 */
207 WP_VIEWPORTER_ERROR_VIEWPORT_EXISTS = 0,
208 };
209 #endif /* WP_VIEWPORTER_ERROR_ENUM */
210
211 #define WP_VIEWPORTER_DESTROY 0
212 #define WP_VIEWPORTER_GET_VIEWPORT 1
213
214
215 /**
216 * @ingroup iface_wp_viewporter
217 */
218 #define WP_VIEWPORTER_DESTROY_SINCE_VERSION 1
219 /**
220 * @ingroup iface_wp_viewporter
221 */
222 #define WP_VIEWPORTER_GET_VIEWPORT_SINCE_VERSION 1
223
224 /** @ingroup iface_wp_viewporter */
225 static inline void
226 wp_viewporter_set_user_data(struct wp_viewporter *wp_viewporter, void *user_data)
227 {
228 wl_proxy_set_user_data((struct wl_proxy *) wp_viewporter, user_data);
229 }
230
231 /** @ingroup iface_wp_viewporter */
232 static inline void *
233 wp_viewporter_get_user_data(struct wp_viewporter *wp_viewporter)
234 {
235 return wl_proxy_get_user_data((struct wl_proxy *) wp_viewporter);
236 }
237
238 static inline uint32_t
239 wp_viewporter_get_version(struct wp_viewporter *wp_viewporter)
240 {
241 return wl_proxy_get_version((struct wl_proxy *) wp_viewporter);
242 }
243
244 /**
245 * @ingroup iface_wp_viewporter
246 *
247 * Informs the server that the client will not be using this
248 * protocol object anymore. This does not affect any other objects,
249 * wp_viewport objects included.
250 */
251 static inline void
252 wp_viewporter_destroy(struct wp_viewporter *wp_viewporter)
253 {
254 wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
255 WP_VIEWPORTER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), WL_MARSHAL_FLAG_DESTROY);
256 }
257
258 /**
259 * @ingroup iface_wp_viewporter
260 *
261 * Instantiate an interface extension for the given wl_surface to
262 * crop and scale its content. If the given wl_surface already has
263 * a wp_viewport object associated, the viewport_exists
264 * protocol error is raised.
265 */
266 static inline struct wp_viewport *
267 wp_viewporter_get_viewport(struct wp_viewporter *wp_viewporter, struct wl_surface *surface)
268 {
269 struct wl_proxy *id;
270
271 id = wl_proxy_marshal_flags((struct wl_proxy *) wp_viewporter,
272 WP_VIEWPORTER_GET_VIEWPORT, &wp_viewport_interface, wl_proxy_get_version((struct wl_proxy *) wp_viewporter), 0, NULL, surface);
273
274 return (struct wp_viewport *) id;
275 }
276
277 #ifndef WP_VIEWPORT_ERROR_ENUM
278 #define WP_VIEWPORT_ERROR_ENUM
279 enum wp_viewport_error {
280 /**
281 * negative or zero values in width or height
282 */
283 WP_VIEWPORT_ERROR_BAD_VALUE = 0,
284 /**
285 * destination size is not integer
286 */
287 WP_VIEWPORT_ERROR_BAD_SIZE = 1,
288 /**
289 * source rectangle extends outside of the content area
290 */
291 WP_VIEWPORT_ERROR_OUT_OF_BUFFER = 2,
292 /**
293 * the wl_surface was destroyed
294 */
295 WP_VIEWPORT_ERROR_NO_SURFACE = 3,
296 };
297 #endif /* WP_VIEWPORT_ERROR_ENUM */
298
299 #define WP_VIEWPORT_DESTROY 0
300 #define WP_VIEWPORT_SET_SOURCE 1
301 #define WP_VIEWPORT_SET_DESTINATION 2
302
303
304 /**
305 * @ingroup iface_wp_viewport
306 */
307 #define WP_VIEWPORT_DESTROY_SINCE_VERSION 1
308 /**
309 * @ingroup iface_wp_viewport
310 */
311 #define WP_VIEWPORT_SET_SOURCE_SINCE_VERSION 1
312 /**
313 * @ingroup iface_wp_viewport
314 */
315 #define WP_VIEWPORT_SET_DESTINATION_SINCE_VERSION 1
316
317 /** @ingroup iface_wp_viewport */
318 static inline void
319 wp_viewport_set_user_data(struct wp_viewport *wp_viewport, void *user_data)
320 {
321 wl_proxy_set_user_data((struct wl_proxy *) wp_viewport, user_data);
322 }
323
324 /** @ingroup iface_wp_viewport */
325 static inline void *
326 wp_viewport_get_user_data(struct wp_viewport *wp_viewport)
327 {
328 return wl_proxy_get_user_data((struct wl_proxy *) wp_viewport);
329 }
330
331 static inline uint32_t
332 wp_viewport_get_version(struct wp_viewport *wp_viewport)
333 {
334 return wl_proxy_get_version((struct wl_proxy *) wp_viewport);
335 }
336
337 /**
338 * @ingroup iface_wp_viewport
339 *
340 * The associated wl_surface's crop and scale state is removed.
341 * The change is applied on the next wl_surface.commit.
342 */
343 static inline void
344 wp_viewport_destroy(struct wp_viewport *wp_viewport)
345 {
346 wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
347 WP_VIEWPORT_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), WL_MARSHAL_FLAG_DESTROY);
348 }
349
350 /**
351 * @ingroup iface_wp_viewport
352 *
353 * Set the source rectangle of the associated wl_surface. See
354 * wp_viewport for the description, and relation to the wl_buffer
355 * size.
356 *
357 * If all of x, y, width and height are -1.0, the source rectangle is
358 * unset instead. Any other set of values where width or height are zero
359 * or negative, or x or y are negative, raise the bad_value protocol
360 * error.
361 *
362 * The crop and scale state is double-buffered state, and will be
363 * applied on the next wl_surface.commit.
364 */
365 static inline void
366 wp_viewport_set_source(struct wp_viewport *wp_viewport, wl_fixed_t x, wl_fixed_t y, wl_fixed_t width, wl_fixed_t height)
367 {
368 wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
369 WP_VIEWPORT_SET_SOURCE, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, x, y, width, height);
370 }
371
372 /**
373 * @ingroup iface_wp_viewport
374 *
375 * Set the destination size of the associated wl_surface. See
376 * wp_viewport for the description, and relation to the wl_buffer
377 * size.
378 *
379 * If width is -1 and height is -1, the destination size is unset
380 * instead. Any other pair of values for width and height that
381 * contains zero or negative values raises the bad_value protocol
382 * error.
383 *
384 * The crop and scale state is double-buffered state, and will be
385 * applied on the next wl_surface.commit.
386 */
387 static inline void
388 wp_viewport_set_destination(struct wp_viewport *wp_viewport, int32_t width, int32_t height)
389 {
390 wl_proxy_marshal_flags((struct wl_proxy *) wp_viewport,
391 WP_VIEWPORT_SET_DESTINATION, NULL, wl_proxy_get_version((struct wl_proxy *) wp_viewport), 0, width, height);
392 }
393
394 #ifdef __cplusplus
395 }
396 #endif
397
398 #endif