1/* Generated by wayland-scanner 1.22.0 */
2
3#ifndef WAYLAND_CLIENT_PROTOCOL_H
4#define WAYLAND_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_wayland The wayland protocol
16 * @section page_ifaces_wayland Interfaces
17 * - @subpage page_iface_wl_display - core global object
18 * - @subpage page_iface_wl_registry - global registry object
19 * - @subpage page_iface_wl_callback - callback object
20 * - @subpage page_iface_wl_compositor - the compositor singleton
21 * - @subpage page_iface_wl_shm_pool - a shared memory pool
22 * - @subpage page_iface_wl_shm - shared memory support
23 * - @subpage page_iface_wl_buffer - content for a wl_surface
24 * - @subpage page_iface_wl_data_offer - offer to transfer data
25 * - @subpage page_iface_wl_data_source - offer to transfer data
26 * - @subpage page_iface_wl_data_device - data transfer device
27 * - @subpage page_iface_wl_data_device_manager - data transfer interface
28 * - @subpage page_iface_wl_shell - create desktop-style surfaces
29 * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
30 * - @subpage page_iface_wl_surface - an onscreen surface
31 * - @subpage page_iface_wl_seat - group of input devices
32 * - @subpage page_iface_wl_pointer - pointer input device
33 * - @subpage page_iface_wl_keyboard - keyboard input device
34 * - @subpage page_iface_wl_touch - touchscreen input device
35 * - @subpage page_iface_wl_output - compositor output region
36 * - @subpage page_iface_wl_region - region interface
37 * - @subpage page_iface_wl_subcompositor - sub-surface compositing
38 * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
39 * @section page_copyright_wayland Copyright
40 * <pre>
41 *
42 * Copyright © 2008-2011 Kristian Høgsberg
43 * Copyright © 2010-2011 Intel Corporation
44 * Copyright © 2012-2013 Collabora, Ltd.
45 *
46 * Permission is hereby granted, free of charge, to any person
47 * obtaining a copy of this software and associated documentation files
48 * (the "Software"), to deal in the Software without restriction,
49 * including without limitation the rights to use, copy, modify, merge,
50 * publish, distribute, sublicense, and/or sell copies of the Software,
51 * and to permit persons to whom the Software is furnished to do so,
52 * subject to the following conditions:
53 *
54 * The above copyright notice and this permission notice (including the
55 * next paragraph) shall be included in all copies or substantial
56 * portions of the Software.
57 *
58 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
59 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
60 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
61 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
62 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
63 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
64 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65 * SOFTWARE.
66 * </pre>
67 */
68struct wl_buffer;
69struct wl_callback;
70struct wl_compositor;
71struct wl_data_device;
72struct wl_data_device_manager;
73struct wl_data_offer;
74struct wl_data_source;
75struct wl_display;
76struct wl_keyboard;
77struct wl_output;
78struct wl_pointer;
79struct wl_region;
80struct wl_registry;
81struct wl_seat;
82struct wl_shell;
83struct wl_shell_surface;
84struct wl_shm;
85struct wl_shm_pool;
86struct wl_subcompositor;
87struct wl_subsurface;
88struct wl_surface;
89struct wl_touch;
90
91#ifndef WL_DISPLAY_INTERFACE
92#define WL_DISPLAY_INTERFACE
93/**
94 * @page page_iface_wl_display wl_display
95 * @section page_iface_wl_display_desc Description
96 *
97 * The core global object. This is a special singleton object. It
98 * is used for internal Wayland protocol features.
99 * @section page_iface_wl_display_api API
100 * See @ref iface_wl_display.
101 */
102/**
103 * @defgroup iface_wl_display The wl_display interface
104 *
105 * The core global object. This is a special singleton object. It
106 * is used for internal Wayland protocol features.
107 */
108extern const struct wl_interface wl_display_interface;
109#endif
110#ifndef WL_REGISTRY_INTERFACE
111#define WL_REGISTRY_INTERFACE
112/**
113 * @page page_iface_wl_registry wl_registry
114 * @section page_iface_wl_registry_desc Description
115 *
116 * The singleton global registry object. The server has a number of
117 * global objects that are available to all clients. These objects
118 * typically represent an actual object in the server (for example,
119 * an input device) or they are singleton objects that provide
120 * extension functionality.
121 *
122 * When a client creates a registry object, the registry object
123 * will emit a global event for each global currently in the
124 * registry. Globals come and go as a result of device or
125 * monitor hotplugs, reconfiguration or other events, and the
126 * registry will send out global and global_remove events to
127 * keep the client up to date with the changes. To mark the end
128 * of the initial burst of events, the client can use the
129 * wl_display.sync request immediately after calling
130 * wl_display.get_registry.
131 *
132 * A client can bind to a global object by using the bind
133 * request. This creates a client-side handle that lets the object
134 * emit events to the client and lets the client invoke requests on
135 * the object.
136 * @section page_iface_wl_registry_api API
137 * See @ref iface_wl_registry.
138 */
139/**
140 * @defgroup iface_wl_registry The wl_registry interface
141 *
142 * The singleton global registry object. The server has a number of
143 * global objects that are available to all clients. These objects
144 * typically represent an actual object in the server (for example,
145 * an input device) or they are singleton objects that provide
146 * extension functionality.
147 *
148 * When a client creates a registry object, the registry object
149 * will emit a global event for each global currently in the
150 * registry. Globals come and go as a result of device or
151 * monitor hotplugs, reconfiguration or other events, and the
152 * registry will send out global and global_remove events to
153 * keep the client up to date with the changes. To mark the end
154 * of the initial burst of events, the client can use the
155 * wl_display.sync request immediately after calling
156 * wl_display.get_registry.
157 *
158 * A client can bind to a global object by using the bind
159 * request. This creates a client-side handle that lets the object
160 * emit events to the client and lets the client invoke requests on
161 * the object.
162 */
163extern const struct wl_interface wl_registry_interface;
164#endif
165#ifndef WL_CALLBACK_INTERFACE
166#define WL_CALLBACK_INTERFACE
167/**
168 * @page page_iface_wl_callback wl_callback
169 * @section page_iface_wl_callback_desc Description
170 *
171 * Clients can handle the 'done' event to get notified when
172 * the related request is done.
173 *
174 * Note, because wl_callback objects are created from multiple independent
175 * factory interfaces, the wl_callback interface is frozen at version 1.
176 * @section page_iface_wl_callback_api API
177 * See @ref iface_wl_callback.
178 */
179/**
180 * @defgroup iface_wl_callback The wl_callback interface
181 *
182 * Clients can handle the 'done' event to get notified when
183 * the related request is done.
184 *
185 * Note, because wl_callback objects are created from multiple independent
186 * factory interfaces, the wl_callback interface is frozen at version 1.
187 */
188extern const struct wl_interface wl_callback_interface;
189#endif
190#ifndef WL_COMPOSITOR_INTERFACE
191#define WL_COMPOSITOR_INTERFACE
192/**
193 * @page page_iface_wl_compositor wl_compositor
194 * @section page_iface_wl_compositor_desc Description
195 *
196 * A compositor. This object is a singleton global. The
197 * compositor is in charge of combining the contents of multiple
198 * surfaces into one displayable output.
199 * @section page_iface_wl_compositor_api API
200 * See @ref iface_wl_compositor.
201 */
202/**
203 * @defgroup iface_wl_compositor The wl_compositor interface
204 *
205 * A compositor. This object is a singleton global. The
206 * compositor is in charge of combining the contents of multiple
207 * surfaces into one displayable output.
208 */
209extern const struct wl_interface wl_compositor_interface;
210#endif
211#ifndef WL_SHM_POOL_INTERFACE
212#define WL_SHM_POOL_INTERFACE
213/**
214 * @page page_iface_wl_shm_pool wl_shm_pool
215 * @section page_iface_wl_shm_pool_desc Description
216 *
217 * The wl_shm_pool object encapsulates a piece of memory shared
218 * between the compositor and client. Through the wl_shm_pool
219 * object, the client can allocate shared memory wl_buffer objects.
220 * All objects created through the same pool share the same
221 * underlying mapped memory. Reusing the mapped memory avoids the
222 * setup/teardown overhead and is useful when interactively resizing
223 * a surface or for many small buffers.
224 * @section page_iface_wl_shm_pool_api API
225 * See @ref iface_wl_shm_pool.
226 */
227/**
228 * @defgroup iface_wl_shm_pool The wl_shm_pool interface
229 *
230 * The wl_shm_pool object encapsulates a piece of memory shared
231 * between the compositor and client. Through the wl_shm_pool
232 * object, the client can allocate shared memory wl_buffer objects.
233 * All objects created through the same pool share the same
234 * underlying mapped memory. Reusing the mapped memory avoids the
235 * setup/teardown overhead and is useful when interactively resizing
236 * a surface or for many small buffers.
237 */
238extern const struct wl_interface wl_shm_pool_interface;
239#endif
240#ifndef WL_SHM_INTERFACE
241#define WL_SHM_INTERFACE
242/**
243 * @page page_iface_wl_shm wl_shm
244 * @section page_iface_wl_shm_desc Description
245 *
246 * A singleton global object that provides support for shared
247 * memory.
248 *
249 * Clients can create wl_shm_pool objects using the create_pool
250 * request.
251 *
252 * On binding the wl_shm object one or more format events
253 * are emitted to inform clients about the valid pixel formats
254 * that can be used for buffers.
255 * @section page_iface_wl_shm_api API
256 * See @ref iface_wl_shm.
257 */
258/**
259 * @defgroup iface_wl_shm The wl_shm interface
260 *
261 * A singleton global object that provides support for shared
262 * memory.
263 *
264 * Clients can create wl_shm_pool objects using the create_pool
265 * request.
266 *
267 * On binding the wl_shm object one or more format events
268 * are emitted to inform clients about the valid pixel formats
269 * that can be used for buffers.
270 */
271extern const struct wl_interface wl_shm_interface;
272#endif
273#ifndef WL_BUFFER_INTERFACE
274#define WL_BUFFER_INTERFACE
275/**
276 * @page page_iface_wl_buffer wl_buffer
277 * @section page_iface_wl_buffer_desc Description
278 *
279 * A buffer provides the content for a wl_surface. Buffers are
280 * created through factory interfaces such as wl_shm, wp_linux_buffer_params
281 * (from the linux-dmabuf protocol extension) or similar. It has a width and
282 * a height and can be attached to a wl_surface, but the mechanism by which a
283 * client provides and updates the contents is defined by the buffer factory
284 * interface.
285 *
286 * If the buffer uses a format that has an alpha channel, the alpha channel
287 * is assumed to be premultiplied in the color channels unless otherwise
288 * specified.
289 *
290 * Note, because wl_buffer objects are created from multiple independent
291 * factory interfaces, the wl_buffer interface is frozen at version 1.
292 * @section page_iface_wl_buffer_api API
293 * See @ref iface_wl_buffer.
294 */
295/**
296 * @defgroup iface_wl_buffer The wl_buffer interface
297 *
298 * A buffer provides the content for a wl_surface. Buffers are
299 * created through factory interfaces such as wl_shm, wp_linux_buffer_params
300 * (from the linux-dmabuf protocol extension) or similar. It has a width and
301 * a height and can be attached to a wl_surface, but the mechanism by which a
302 * client provides and updates the contents is defined by the buffer factory
303 * interface.
304 *
305 * If the buffer uses a format that has an alpha channel, the alpha channel
306 * is assumed to be premultiplied in the color channels unless otherwise
307 * specified.
308 *
309 * Note, because wl_buffer objects are created from multiple independent
310 * factory interfaces, the wl_buffer interface is frozen at version 1.
311 */
312extern const struct wl_interface wl_buffer_interface;
313#endif
314#ifndef WL_DATA_OFFER_INTERFACE
315#define WL_DATA_OFFER_INTERFACE
316/**
317 * @page page_iface_wl_data_offer wl_data_offer
318 * @section page_iface_wl_data_offer_desc Description
319 *
320 * A wl_data_offer represents a piece of data offered for transfer
321 * by another client (the source client). It is used by the
322 * copy-and-paste and drag-and-drop mechanisms. The offer
323 * describes the different mime types that the data can be
324 * converted to and provides the mechanism for transferring the
325 * data directly from the source client.
326 * @section page_iface_wl_data_offer_api API
327 * See @ref iface_wl_data_offer.
328 */
329/**
330 * @defgroup iface_wl_data_offer The wl_data_offer interface
331 *
332 * A wl_data_offer represents a piece of data offered for transfer
333 * by another client (the source client). It is used by the
334 * copy-and-paste and drag-and-drop mechanisms. The offer
335 * describes the different mime types that the data can be
336 * converted to and provides the mechanism for transferring the
337 * data directly from the source client.
338 */
339extern const struct wl_interface wl_data_offer_interface;
340#endif
341#ifndef WL_DATA_SOURCE_INTERFACE
342#define WL_DATA_SOURCE_INTERFACE
343/**
344 * @page page_iface_wl_data_source wl_data_source
345 * @section page_iface_wl_data_source_desc Description
346 *
347 * The wl_data_source object is the source side of a wl_data_offer.
348 * It is created by the source client in a data transfer and
349 * provides a way to describe the offered data and a way to respond
350 * to requests to transfer the data.
351 * @section page_iface_wl_data_source_api API
352 * See @ref iface_wl_data_source.
353 */
354/**
355 * @defgroup iface_wl_data_source The wl_data_source interface
356 *
357 * The wl_data_source object is the source side of a wl_data_offer.
358 * It is created by the source client in a data transfer and
359 * provides a way to describe the offered data and a way to respond
360 * to requests to transfer the data.
361 */
362extern const struct wl_interface wl_data_source_interface;
363#endif
364#ifndef WL_DATA_DEVICE_INTERFACE
365#define WL_DATA_DEVICE_INTERFACE
366/**
367 * @page page_iface_wl_data_device wl_data_device
368 * @section page_iface_wl_data_device_desc Description
369 *
370 * There is one wl_data_device per seat which can be obtained
371 * from the global wl_data_device_manager singleton.
372 *
373 * A wl_data_device provides access to inter-client data transfer
374 * mechanisms such as copy-and-paste and drag-and-drop.
375 * @section page_iface_wl_data_device_api API
376 * See @ref iface_wl_data_device.
377 */
378/**
379 * @defgroup iface_wl_data_device The wl_data_device interface
380 *
381 * There is one wl_data_device per seat which can be obtained
382 * from the global wl_data_device_manager singleton.
383 *
384 * A wl_data_device provides access to inter-client data transfer
385 * mechanisms such as copy-and-paste and drag-and-drop.
386 */
387extern const struct wl_interface wl_data_device_interface;
388#endif
389#ifndef WL_DATA_DEVICE_MANAGER_INTERFACE
390#define WL_DATA_DEVICE_MANAGER_INTERFACE
391/**
392 * @page page_iface_wl_data_device_manager wl_data_device_manager
393 * @section page_iface_wl_data_device_manager_desc Description
394 *
395 * The wl_data_device_manager is a singleton global object that
396 * provides access to inter-client data transfer mechanisms such as
397 * copy-and-paste and drag-and-drop. These mechanisms are tied to
398 * a wl_seat and this interface lets a client get a wl_data_device
399 * corresponding to a wl_seat.
400 *
401 * Depending on the version bound, the objects created from the bound
402 * wl_data_device_manager object will have different requirements for
403 * functioning properly. See wl_data_source.set_actions,
404 * wl_data_offer.accept and wl_data_offer.finish for details.
405 * @section page_iface_wl_data_device_manager_api API
406 * See @ref iface_wl_data_device_manager.
407 */
408/**
409 * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
410 *
411 * The wl_data_device_manager is a singleton global object that
412 * provides access to inter-client data transfer mechanisms such as
413 * copy-and-paste and drag-and-drop. These mechanisms are tied to
414 * a wl_seat and this interface lets a client get a wl_data_device
415 * corresponding to a wl_seat.
416 *
417 * Depending on the version bound, the objects created from the bound
418 * wl_data_device_manager object will have different requirements for
419 * functioning properly. See wl_data_source.set_actions,
420 * wl_data_offer.accept and wl_data_offer.finish for details.
421 */
422extern const struct wl_interface wl_data_device_manager_interface;
423#endif
424#ifndef WL_SHELL_INTERFACE
425#define WL_SHELL_INTERFACE
426/**
427 * @page page_iface_wl_shell wl_shell
428 * @section page_iface_wl_shell_desc Description
429 *
430 * This interface is implemented by servers that provide
431 * desktop-style user interfaces.
432 *
433 * It allows clients to associate a wl_shell_surface with
434 * a basic surface.
435 *
436 * Note! This protocol is deprecated and not intended for production use.
437 * For desktop-style user interfaces, use xdg_shell. Compositors and clients
438 * should not implement this interface.
439 * @section page_iface_wl_shell_api API
440 * See @ref iface_wl_shell.
441 */
442/**
443 * @defgroup iface_wl_shell The wl_shell interface
444 *
445 * This interface is implemented by servers that provide
446 * desktop-style user interfaces.
447 *
448 * It allows clients to associate a wl_shell_surface with
449 * a basic surface.
450 *
451 * Note! This protocol is deprecated and not intended for production use.
452 * For desktop-style user interfaces, use xdg_shell. Compositors and clients
453 * should not implement this interface.
454 */
455extern const struct wl_interface wl_shell_interface;
456#endif
457#ifndef WL_SHELL_SURFACE_INTERFACE
458#define WL_SHELL_SURFACE_INTERFACE
459/**
460 * @page page_iface_wl_shell_surface wl_shell_surface
461 * @section page_iface_wl_shell_surface_desc Description
462 *
463 * An interface that may be implemented by a wl_surface, for
464 * implementations that provide a desktop-style user interface.
465 *
466 * It provides requests to treat surfaces like toplevel, fullscreen
467 * or popup windows, move, resize or maximize them, associate
468 * metadata like title and class, etc.
469 *
470 * On the server side the object is automatically destroyed when
471 * the related wl_surface is destroyed. On the client side,
472 * wl_shell_surface_destroy() must be called before destroying
473 * the wl_surface object.
474 * @section page_iface_wl_shell_surface_api API
475 * See @ref iface_wl_shell_surface.
476 */
477/**
478 * @defgroup iface_wl_shell_surface The wl_shell_surface interface
479 *
480 * An interface that may be implemented by a wl_surface, for
481 * implementations that provide a desktop-style user interface.
482 *
483 * It provides requests to treat surfaces like toplevel, fullscreen
484 * or popup windows, move, resize or maximize them, associate
485 * metadata like title and class, etc.
486 *
487 * On the server side the object is automatically destroyed when
488 * the related wl_surface is destroyed. On the client side,
489 * wl_shell_surface_destroy() must be called before destroying
490 * the wl_surface object.
491 */
492extern const struct wl_interface wl_shell_surface_interface;
493#endif
494#ifndef WL_SURFACE_INTERFACE
495#define WL_SURFACE_INTERFACE
496/**
497 * @page page_iface_wl_surface wl_surface
498 * @section page_iface_wl_surface_desc Description
499 *
500 * A surface is a rectangular area that may be displayed on zero
501 * or more outputs, and shown any number of times at the compositor's
502 * discretion. They can present wl_buffers, receive user input, and
503 * define a local coordinate system.
504 *
505 * The size of a surface (and relative positions on it) is described
506 * in surface-local coordinates, which may differ from the buffer
507 * coordinates of the pixel content, in case a buffer_transform
508 * or a buffer_scale is used.
509 *
510 * A surface without a "role" is fairly useless: a compositor does
511 * not know where, when or how to present it. The role is the
512 * purpose of a wl_surface. Examples of roles are a cursor for a
513 * pointer (as set by wl_pointer.set_cursor), a drag icon
514 * (wl_data_device.start_drag), a sub-surface
515 * (wl_subcompositor.get_subsurface), and a window as defined by a
516 * shell protocol (e.g. wl_shell.get_shell_surface).
517 *
518 * A surface can have only one role at a time. Initially a
519 * wl_surface does not have a role. Once a wl_surface is given a
520 * role, it is set permanently for the whole lifetime of the
521 * wl_surface object. Giving the current role again is allowed,
522 * unless explicitly forbidden by the relevant interface
523 * specification.
524 *
525 * Surface roles are given by requests in other interfaces such as
526 * wl_pointer.set_cursor. The request should explicitly mention
527 * that this request gives a role to a wl_surface. Often, this
528 * request also creates a new protocol object that represents the
529 * role and adds additional functionality to wl_surface. When a
530 * client wants to destroy a wl_surface, they must destroy this role
531 * object before the wl_surface, otherwise a defunct_role_object error is
532 * sent.
533 *
534 * Destroying the role object does not remove the role from the
535 * wl_surface, but it may stop the wl_surface from "playing the role".
536 * For instance, if a wl_subsurface object is destroyed, the wl_surface
537 * it was created for will be unmapped and forget its position and
538 * z-order. It is allowed to create a wl_subsurface for the same
539 * wl_surface again, but it is not allowed to use the wl_surface as
540 * a cursor (cursor is a different role than sub-surface, and role
541 * switching is not allowed).
542 * @section page_iface_wl_surface_api API
543 * See @ref iface_wl_surface.
544 */
545/**
546 * @defgroup iface_wl_surface The wl_surface interface
547 *
548 * A surface is a rectangular area that may be displayed on zero
549 * or more outputs, and shown any number of times at the compositor's
550 * discretion. They can present wl_buffers, receive user input, and
551 * define a local coordinate system.
552 *
553 * The size of a surface (and relative positions on it) is described
554 * in surface-local coordinates, which may differ from the buffer
555 * coordinates of the pixel content, in case a buffer_transform
556 * or a buffer_scale is used.
557 *
558 * A surface without a "role" is fairly useless: a compositor does
559 * not know where, when or how to present it. The role is the
560 * purpose of a wl_surface. Examples of roles are a cursor for a
561 * pointer (as set by wl_pointer.set_cursor), a drag icon
562 * (wl_data_device.start_drag), a sub-surface
563 * (wl_subcompositor.get_subsurface), and a window as defined by a
564 * shell protocol (e.g. wl_shell.get_shell_surface).
565 *
566 * A surface can have only one role at a time. Initially a
567 * wl_surface does not have a role. Once a wl_surface is given a
568 * role, it is set permanently for the whole lifetime of the
569 * wl_surface object. Giving the current role again is allowed,
570 * unless explicitly forbidden by the relevant interface
571 * specification.
572 *
573 * Surface roles are given by requests in other interfaces such as
574 * wl_pointer.set_cursor. The request should explicitly mention
575 * that this request gives a role to a wl_surface. Often, this
576 * request also creates a new protocol object that represents the
577 * role and adds additional functionality to wl_surface. When a
578 * client wants to destroy a wl_surface, they must destroy this role
579 * object before the wl_surface, otherwise a defunct_role_object error is
580 * sent.
581 *
582 * Destroying the role object does not remove the role from the
583 * wl_surface, but it may stop the wl_surface from "playing the role".
584 * For instance, if a wl_subsurface object is destroyed, the wl_surface
585 * it was created for will be unmapped and forget its position and
586 * z-order. It is allowed to create a wl_subsurface for the same
587 * wl_surface again, but it is not allowed to use the wl_surface as
588 * a cursor (cursor is a different role than sub-surface, and role
589 * switching is not allowed).
590 */
591extern const struct wl_interface wl_surface_interface;
592#endif
593#ifndef WL_SEAT_INTERFACE
594#define WL_SEAT_INTERFACE
595/**
596 * @page page_iface_wl_seat wl_seat
597 * @section page_iface_wl_seat_desc Description
598 *
599 * A seat is a group of keyboards, pointer and touch devices. This
600 * object is published as a global during start up, or when such a
601 * device is hot plugged. A seat typically has a pointer and
602 * maintains a keyboard focus and a pointer focus.
603 * @section page_iface_wl_seat_api API
604 * See @ref iface_wl_seat.
605 */
606/**
607 * @defgroup iface_wl_seat The wl_seat interface
608 *
609 * A seat is a group of keyboards, pointer and touch devices. This
610 * object is published as a global during start up, or when such a
611 * device is hot plugged. A seat typically has a pointer and
612 * maintains a keyboard focus and a pointer focus.
613 */
614extern const struct wl_interface wl_seat_interface;
615#endif
616#ifndef WL_POINTER_INTERFACE
617#define WL_POINTER_INTERFACE
618/**
619 * @page page_iface_wl_pointer wl_pointer
620 * @section page_iface_wl_pointer_desc Description
621 *
622 * The wl_pointer interface represents one or more input devices,
623 * such as mice, which control the pointer location and pointer_focus
624 * of a seat.
625 *
626 * The wl_pointer interface generates motion, enter and leave
627 * events for the surfaces that the pointer is located over,
628 * and button and axis events for button presses, button releases
629 * and scrolling.
630 * @section page_iface_wl_pointer_api API
631 * See @ref iface_wl_pointer.
632 */
633/**
634 * @defgroup iface_wl_pointer The wl_pointer interface
635 *
636 * The wl_pointer interface represents one or more input devices,
637 * such as mice, which control the pointer location and pointer_focus
638 * of a seat.
639 *
640 * The wl_pointer interface generates motion, enter and leave
641 * events for the surfaces that the pointer is located over,
642 * and button and axis events for button presses, button releases
643 * and scrolling.
644 */
645extern const struct wl_interface wl_pointer_interface;
646#endif
647#ifndef WL_KEYBOARD_INTERFACE
648#define WL_KEYBOARD_INTERFACE
649/**
650 * @page page_iface_wl_keyboard wl_keyboard
651 * @section page_iface_wl_keyboard_desc Description
652 *
653 * The wl_keyboard interface represents one or more keyboards
654 * associated with a seat.
655 * @section page_iface_wl_keyboard_api API
656 * See @ref iface_wl_keyboard.
657 */
658/**
659 * @defgroup iface_wl_keyboard The wl_keyboard interface
660 *
661 * The wl_keyboard interface represents one or more keyboards
662 * associated with a seat.
663 */
664extern const struct wl_interface wl_keyboard_interface;
665#endif
666#ifndef WL_TOUCH_INTERFACE
667#define WL_TOUCH_INTERFACE
668/**
669 * @page page_iface_wl_touch wl_touch
670 * @section page_iface_wl_touch_desc Description
671 *
672 * The wl_touch interface represents a touchscreen
673 * associated with a seat.
674 *
675 * Touch interactions can consist of one or more contacts.
676 * For each contact, a series of events is generated, starting
677 * with a down event, followed by zero or more motion events,
678 * and ending with an up event. Events relating to the same
679 * contact point can be identified by the ID of the sequence.
680 * @section page_iface_wl_touch_api API
681 * See @ref iface_wl_touch.
682 */
683/**
684 * @defgroup iface_wl_touch The wl_touch interface
685 *
686 * The wl_touch interface represents a touchscreen
687 * associated with a seat.
688 *
689 * Touch interactions can consist of one or more contacts.
690 * For each contact, a series of events is generated, starting
691 * with a down event, followed by zero or more motion events,
692 * and ending with an up event. Events relating to the same
693 * contact point can be identified by the ID of the sequence.
694 */
695extern const struct wl_interface wl_touch_interface;
696#endif
697#ifndef WL_OUTPUT_INTERFACE
698#define WL_OUTPUT_INTERFACE
699/**
700 * @page page_iface_wl_output wl_output
701 * @section page_iface_wl_output_desc Description
702 *
703 * An output describes part of the compositor geometry. The
704 * compositor works in the 'compositor coordinate system' and an
705 * output corresponds to a rectangular area in that space that is
706 * actually visible. This typically corresponds to a monitor that
707 * displays part of the compositor space. This object is published
708 * as global during start up, or when a monitor is hotplugged.
709 * @section page_iface_wl_output_api API
710 * See @ref iface_wl_output.
711 */
712/**
713 * @defgroup iface_wl_output The wl_output interface
714 *
715 * An output describes part of the compositor geometry. The
716 * compositor works in the 'compositor coordinate system' and an
717 * output corresponds to a rectangular area in that space that is
718 * actually visible. This typically corresponds to a monitor that
719 * displays part of the compositor space. This object is published
720 * as global during start up, or when a monitor is hotplugged.
721 */
722extern const struct wl_interface wl_output_interface;
723#endif
724#ifndef WL_REGION_INTERFACE
725#define WL_REGION_INTERFACE
726/**
727 * @page page_iface_wl_region wl_region
728 * @section page_iface_wl_region_desc Description
729 *
730 * A region object describes an area.
731 *
732 * Region objects are used to describe the opaque and input
733 * regions of a surface.
734 * @section page_iface_wl_region_api API
735 * See @ref iface_wl_region.
736 */
737/**
738 * @defgroup iface_wl_region The wl_region interface
739 *
740 * A region object describes an area.
741 *
742 * Region objects are used to describe the opaque and input
743 * regions of a surface.
744 */
745extern const struct wl_interface wl_region_interface;
746#endif
747#ifndef WL_SUBCOMPOSITOR_INTERFACE
748#define WL_SUBCOMPOSITOR_INTERFACE
749/**
750 * @page page_iface_wl_subcompositor wl_subcompositor
751 * @section page_iface_wl_subcompositor_desc Description
752 *
753 * The global interface exposing sub-surface compositing capabilities.
754 * A wl_surface, that has sub-surfaces associated, is called the
755 * parent surface. Sub-surfaces can be arbitrarily nested and create
756 * a tree of sub-surfaces.
757 *
758 * The root surface in a tree of sub-surfaces is the main
759 * surface. The main surface cannot be a sub-surface, because
760 * sub-surfaces must always have a parent.
761 *
762 * A main surface with its sub-surfaces forms a (compound) window.
763 * For window management purposes, this set of wl_surface objects is
764 * to be considered as a single window, and it should also behave as
765 * such.
766 *
767 * The aim of sub-surfaces is to offload some of the compositing work
768 * within a window from clients to the compositor. A prime example is
769 * a video player with decorations and video in separate wl_surface
770 * objects. This should allow the compositor to pass YUV video buffer
771 * processing to dedicated overlay hardware when possible.
772 * @section page_iface_wl_subcompositor_api API
773 * See @ref iface_wl_subcompositor.
774 */
775/**
776 * @defgroup iface_wl_subcompositor The wl_subcompositor interface
777 *
778 * The global interface exposing sub-surface compositing capabilities.
779 * A wl_surface, that has sub-surfaces associated, is called the
780 * parent surface. Sub-surfaces can be arbitrarily nested and create
781 * a tree of sub-surfaces.
782 *
783 * The root surface in a tree of sub-surfaces is the main
784 * surface. The main surface cannot be a sub-surface, because
785 * sub-surfaces must always have a parent.
786 *
787 * A main surface with its sub-surfaces forms a (compound) window.
788 * For window management purposes, this set of wl_surface objects is
789 * to be considered as a single window, and it should also behave as
790 * such.
791 *
792 * The aim of sub-surfaces is to offload some of the compositing work
793 * within a window from clients to the compositor. A prime example is
794 * a video player with decorations and video in separate wl_surface
795 * objects. This should allow the compositor to pass YUV video buffer
796 * processing to dedicated overlay hardware when possible.
797 */
798extern const struct wl_interface wl_subcompositor_interface;
799#endif
800#ifndef WL_SUBSURFACE_INTERFACE
801#define WL_SUBSURFACE_INTERFACE
802/**
803 * @page page_iface_wl_subsurface wl_subsurface
804 * @section page_iface_wl_subsurface_desc Description
805 *
806 * An additional interface to a wl_surface object, which has been
807 * made a sub-surface. A sub-surface has one parent surface. A
808 * sub-surface's size and position are not limited to that of the parent.
809 * Particularly, a sub-surface is not automatically clipped to its
810 * parent's area.
811 *
812 * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
813 * and the parent surface is mapped. The order of which one happens
814 * first is irrelevant. A sub-surface is hidden if the parent becomes
815 * hidden, or if a NULL wl_buffer is applied. These rules apply
816 * recursively through the tree of surfaces.
817 *
818 * The behaviour of a wl_surface.commit request on a sub-surface
819 * depends on the sub-surface's mode. The possible modes are
820 * synchronized and desynchronized, see methods
821 * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
822 * mode caches the wl_surface state to be applied when the parent's
823 * state gets applied, and desynchronized mode applies the pending
824 * wl_surface state directly. A sub-surface is initially in the
825 * synchronized mode.
826 *
827 * Sub-surfaces also have another kind of state, which is managed by
828 * wl_subsurface requests, as opposed to wl_surface requests. This
829 * state includes the sub-surface position relative to the parent
830 * surface (wl_subsurface.set_position), and the stacking order of
831 * the parent and its sub-surfaces (wl_subsurface.place_above and
832 * .place_below). This state is applied when the parent surface's
833 * wl_surface state is applied, regardless of the sub-surface's mode.
834 * As the exception, set_sync and set_desync are effective immediately.
835 *
836 * The main surface can be thought to be always in desynchronized mode,
837 * since it does not have a parent in the sub-surfaces sense.
838 *
839 * Even if a sub-surface is in desynchronized mode, it will behave as
840 * in synchronized mode, if its parent surface behaves as in
841 * synchronized mode. This rule is applied recursively throughout the
842 * tree of surfaces. This means, that one can set a sub-surface into
843 * synchronized mode, and then assume that all its child and grand-child
844 * sub-surfaces are synchronized, too, without explicitly setting them.
845 *
846 * Destroying a sub-surface takes effect immediately. If you need to
847 * synchronize the removal of a sub-surface to the parent surface update,
848 * unmap the sub-surface first by attaching a NULL wl_buffer, update parent,
849 * and then destroy the sub-surface.
850 *
851 * If the parent wl_surface object is destroyed, the sub-surface is
852 * unmapped.
853 * @section page_iface_wl_subsurface_api API
854 * See @ref iface_wl_subsurface.
855 */
856/**
857 * @defgroup iface_wl_subsurface The wl_subsurface interface
858 *
859 * An additional interface to a wl_surface object, which has been
860 * made a sub-surface. A sub-surface has one parent surface. A
861 * sub-surface's size and position are not limited to that of the parent.
862 * Particularly, a sub-surface is not automatically clipped to its
863 * parent's area.
864 *
865 * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
866 * and the parent surface is mapped. The order of which one happens
867 * first is irrelevant. A sub-surface is hidden if the parent becomes
868 * hidden, or if a NULL wl_buffer is applied. These rules apply
869 * recursively through the tree of surfaces.
870 *
871 * The behaviour of a wl_surface.commit request on a sub-surface
872 * depends on the sub-surface's mode. The possible modes are
873 * synchronized and desynchronized, see methods
874 * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
875 * mode caches the wl_surface state to be applied when the parent's
876 * state gets applied, and desynchronized mode applies the pending
877 * wl_surface state directly. A sub-surface is initially in the
878 * synchronized mode.
879 *
880 * Sub-surfaces also have another kind of state, which is managed by
881 * wl_subsurface requests, as opposed to wl_surface requests. This
882 * state includes the sub-surface position relative to the parent
883 * surface (wl_subsurface.set_position), and the stacking order of
884 * the parent and its sub-surfaces (wl_subsurface.place_above and
885 * .place_below). This state is applied when the parent surface's
886 * wl_surface state is applied, regardless of the sub-surface's mode.
887 * As the exception, set_sync and set_desync are effective immediately.
888 *
889 * The main surface can be thought to be always in desynchronized mode,
890 * since it does not have a parent in the sub-surfaces sense.
891 *
892 * Even if a sub-surface is in desynchronized mode, it will behave as
893 * in synchronized mode, if its parent surface behaves as in
894 * synchronized mode. This rule is applied recursively throughout the
895 * tree of surfaces. This means, that one can set a sub-surface into
896 * synchronized mode, and then assume that all its child and grand-child
897 * sub-surfaces are synchronized, too, without explicitly setting them.
898 *
899 * Destroying a sub-surface takes effect immediately. If you need to
900 * synchronize the removal of a sub-surface to the parent surface update,
901 * unmap the sub-surface first by attaching a NULL wl_buffer, update parent,
902 * and then destroy the sub-surface.
903 *
904 * If the parent wl_surface object is destroyed, the sub-surface is
905 * unmapped.
906 */
907extern const struct wl_interface wl_subsurface_interface;
908#endif
909
910#ifndef WL_DISPLAY_ERROR_ENUM
911#define WL_DISPLAY_ERROR_ENUM
912/**
913 * @ingroup iface_wl_display
914 * global error values
915 *
916 * These errors are global and can be emitted in response to any
917 * server request.
918 */
919enum wl_display_error {
920 /**
921 * server couldn't find object
922 */
923 WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
924 /**
925 * method doesn't exist on the specified interface or malformed request
926 */
927 WL_DISPLAY_ERROR_INVALID_METHOD = 1,
928 /**
929 * server is out of memory
930 */
931 WL_DISPLAY_ERROR_NO_MEMORY = 2,
932 /**
933 * implementation error in compositor
934 */
935 WL_DISPLAY_ERROR_IMPLEMENTATION = 3,
936};
937#endif /* WL_DISPLAY_ERROR_ENUM */
938
939/**
940 * @ingroup iface_wl_display
941 * @struct wl_display_listener
942 */
943struct wl_display_listener {
944 /**
945 * fatal error event
946 *
947 * The error event is sent out when a fatal (non-recoverable)
948 * error has occurred. The object_id argument is the object where
949 * the error occurred, most often in response to a request to that
950 * object. The code identifies the error and is defined by the
951 * object interface. As such, each interface defines its own set of
952 * error codes. The message is a brief description of the error,
953 * for (debugging) convenience.
954 * @param object_id object where the error occurred
955 * @param code error code
956 * @param message error description
957 */
958 void (*error)(void *data,
959 struct wl_display *wl_display,
960 void *object_id,
961 uint32_t code,
962 const char *message);
963 /**
964 * acknowledge object ID deletion
965 *
966 * This event is used internally by the object ID management
967 * logic. When a client deletes an object that it had created, the
968 * server will send this event to acknowledge that it has seen the
969 * delete request. When the client receives this event, it will
970 * know that it can safely reuse the object ID.
971 * @param id deleted object ID
972 */
973 void (*delete_id)(void *data,
974 struct wl_display *wl_display,
975 uint32_t id);
976};
977
978/**
979 * @ingroup iface_wl_display
980 */
981static inline int
982wl_display_add_listener(struct wl_display *wl_display,
983 const struct wl_display_listener *listener, void *data)
984{
985 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_display,
986 implementation: (void (**)(void)) listener, data);
987}
988
989#define WL_DISPLAY_SYNC 0
990#define WL_DISPLAY_GET_REGISTRY 1
991
992/**
993 * @ingroup iface_wl_display
994 */
995#define WL_DISPLAY_ERROR_SINCE_VERSION 1
996/**
997 * @ingroup iface_wl_display
998 */
999#define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1
1000
1001/**
1002 * @ingroup iface_wl_display
1003 */
1004#define WL_DISPLAY_SYNC_SINCE_VERSION 1
1005/**
1006 * @ingroup iface_wl_display
1007 */
1008#define WL_DISPLAY_GET_REGISTRY_SINCE_VERSION 1
1009
1010/** @ingroup iface_wl_display */
1011static inline void
1012wl_display_set_user_data(struct wl_display *wl_display, void *user_data)
1013{
1014 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_display, user_data);
1015}
1016
1017/** @ingroup iface_wl_display */
1018static inline void *
1019wl_display_get_user_data(struct wl_display *wl_display)
1020{
1021 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_display);
1022}
1023
1024static inline uint32_t
1025wl_display_get_version(struct wl_display *wl_display)
1026{
1027 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_display);
1028}
1029
1030/**
1031 * @ingroup iface_wl_display
1032 *
1033 * The sync request asks the server to emit the 'done' event
1034 * on the returned wl_callback object. Since requests are
1035 * handled in-order and events are delivered in-order, this can
1036 * be used as a barrier to ensure all previous requests and the
1037 * resulting events have been handled.
1038 *
1039 * The object returned by this request will be destroyed by the
1040 * compositor after the callback is fired and as such the client must not
1041 * attempt to use it after that point.
1042 *
1043 * The callback_data passed in the callback is the event serial.
1044 */
1045static inline struct wl_callback *
1046wl_display_sync(struct wl_display *wl_display)
1047{
1048 struct wl_proxy *callback;
1049
1050 callback = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_display,
1051 WL_DISPLAY_SYNC, interface: &wl_callback_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_display), flags: 0, NULL);
1052
1053 return (struct wl_callback *) callback;
1054}
1055
1056/**
1057 * @ingroup iface_wl_display
1058 *
1059 * This request creates a registry object that allows the client
1060 * to list and bind the global objects available from the
1061 * compositor.
1062 *
1063 * It should be noted that the server side resources consumed in
1064 * response to a get_registry request can only be released when the
1065 * client disconnects, not when the client side proxy is destroyed.
1066 * Therefore, clients should invoke get_registry as infrequently as
1067 * possible to avoid wasting memory.
1068 */
1069static inline struct wl_registry *
1070wl_display_get_registry(struct wl_display *wl_display)
1071{
1072 struct wl_proxy *registry;
1073
1074 registry = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_display,
1075 WL_DISPLAY_GET_REGISTRY, interface: &wl_registry_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_display), flags: 0, NULL);
1076
1077 return (struct wl_registry *) registry;
1078}
1079
1080/**
1081 * @ingroup iface_wl_registry
1082 * @struct wl_registry_listener
1083 */
1084struct wl_registry_listener {
1085 /**
1086 * announce global object
1087 *
1088 * Notify the client of global objects.
1089 *
1090 * The event notifies the client that a global object with the
1091 * given name is now available, and it implements the given version
1092 * of the given interface.
1093 * @param name numeric name of the global object
1094 * @param interface interface implemented by the object
1095 * @param version interface version
1096 */
1097 void (*global)(void *data,
1098 struct wl_registry *wl_registry,
1099 uint32_t name,
1100 const char *interface,
1101 uint32_t version);
1102 /**
1103 * announce removal of global object
1104 *
1105 * Notify the client of removed global objects.
1106 *
1107 * This event notifies the client that the global identified by
1108 * name is no longer available. If the client bound to the global
1109 * using the bind request, the client should now destroy that
1110 * object.
1111 *
1112 * The object remains valid and requests to the object will be
1113 * ignored until the client destroys it, to avoid races between the
1114 * global going away and a client sending a request to it.
1115 * @param name numeric name of the global object
1116 */
1117 void (*global_remove)(void *data,
1118 struct wl_registry *wl_registry,
1119 uint32_t name);
1120};
1121
1122/**
1123 * @ingroup iface_wl_registry
1124 */
1125static inline int
1126wl_registry_add_listener(struct wl_registry *wl_registry,
1127 const struct wl_registry_listener *listener, void *data)
1128{
1129 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_registry,
1130 implementation: (void (**)(void)) listener, data);
1131}
1132
1133#define WL_REGISTRY_BIND 0
1134
1135/**
1136 * @ingroup iface_wl_registry
1137 */
1138#define WL_REGISTRY_GLOBAL_SINCE_VERSION 1
1139/**
1140 * @ingroup iface_wl_registry
1141 */
1142#define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1
1143
1144/**
1145 * @ingroup iface_wl_registry
1146 */
1147#define WL_REGISTRY_BIND_SINCE_VERSION 1
1148
1149/** @ingroup iface_wl_registry */
1150static inline void
1151wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data)
1152{
1153 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_registry, user_data);
1154}
1155
1156/** @ingroup iface_wl_registry */
1157static inline void *
1158wl_registry_get_user_data(struct wl_registry *wl_registry)
1159{
1160 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_registry);
1161}
1162
1163static inline uint32_t
1164wl_registry_get_version(struct wl_registry *wl_registry)
1165{
1166 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_registry);
1167}
1168
1169/** @ingroup iface_wl_registry */
1170static inline void
1171wl_registry_destroy(struct wl_registry *wl_registry)
1172{
1173 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_registry);
1174}
1175
1176/**
1177 * @ingroup iface_wl_registry
1178 *
1179 * Binds a new, client-created object to the server using the
1180 * specified name as the identifier.
1181 */
1182static inline void *
1183wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
1184{
1185 struct wl_proxy *id;
1186
1187 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_registry,
1188 WL_REGISTRY_BIND, interface, version, flags: 0, name, interface->name, version, NULL);
1189
1190 return (void *) id;
1191}
1192
1193/**
1194 * @ingroup iface_wl_callback
1195 * @struct wl_callback_listener
1196 */
1197struct wl_callback_listener {
1198 /**
1199 * done event
1200 *
1201 * Notify the client when the related request is done.
1202 * @param callback_data request-specific data for the callback
1203 */
1204 void (*done)(void *data,
1205 struct wl_callback *wl_callback,
1206 uint32_t callback_data);
1207};
1208
1209/**
1210 * @ingroup iface_wl_callback
1211 */
1212static inline int
1213wl_callback_add_listener(struct wl_callback *wl_callback,
1214 const struct wl_callback_listener *listener, void *data)
1215{
1216 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_callback,
1217 implementation: (void (**)(void)) listener, data);
1218}
1219
1220/**
1221 * @ingroup iface_wl_callback
1222 */
1223#define WL_CALLBACK_DONE_SINCE_VERSION 1
1224
1225
1226/** @ingroup iface_wl_callback */
1227static inline void
1228wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data)
1229{
1230 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_callback, user_data);
1231}
1232
1233/** @ingroup iface_wl_callback */
1234static inline void *
1235wl_callback_get_user_data(struct wl_callback *wl_callback)
1236{
1237 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_callback);
1238}
1239
1240static inline uint32_t
1241wl_callback_get_version(struct wl_callback *wl_callback)
1242{
1243 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_callback);
1244}
1245
1246/** @ingroup iface_wl_callback */
1247static inline void
1248wl_callback_destroy(struct wl_callback *wl_callback)
1249{
1250 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_callback);
1251}
1252
1253#define WL_COMPOSITOR_CREATE_SURFACE 0
1254#define WL_COMPOSITOR_CREATE_REGION 1
1255
1256
1257/**
1258 * @ingroup iface_wl_compositor
1259 */
1260#define WL_COMPOSITOR_CREATE_SURFACE_SINCE_VERSION 1
1261/**
1262 * @ingroup iface_wl_compositor
1263 */
1264#define WL_COMPOSITOR_CREATE_REGION_SINCE_VERSION 1
1265
1266/** @ingroup iface_wl_compositor */
1267static inline void
1268wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data)
1269{
1270 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_compositor, user_data);
1271}
1272
1273/** @ingroup iface_wl_compositor */
1274static inline void *
1275wl_compositor_get_user_data(struct wl_compositor *wl_compositor)
1276{
1277 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_compositor);
1278}
1279
1280static inline uint32_t
1281wl_compositor_get_version(struct wl_compositor *wl_compositor)
1282{
1283 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_compositor);
1284}
1285
1286/** @ingroup iface_wl_compositor */
1287static inline void
1288wl_compositor_destroy(struct wl_compositor *wl_compositor)
1289{
1290 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_compositor);
1291}
1292
1293/**
1294 * @ingroup iface_wl_compositor
1295 *
1296 * Ask the compositor to create a new surface.
1297 */
1298static inline struct wl_surface *
1299wl_compositor_create_surface(struct wl_compositor *wl_compositor)
1300{
1301 struct wl_proxy *id;
1302
1303 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_compositor,
1304 WL_COMPOSITOR_CREATE_SURFACE, interface: &wl_surface_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_compositor), flags: 0, NULL);
1305
1306 return (struct wl_surface *) id;
1307}
1308
1309/**
1310 * @ingroup iface_wl_compositor
1311 *
1312 * Ask the compositor to create a new region.
1313 */
1314static inline struct wl_region *
1315wl_compositor_create_region(struct wl_compositor *wl_compositor)
1316{
1317 struct wl_proxy *id;
1318
1319 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_compositor,
1320 WL_COMPOSITOR_CREATE_REGION, interface: &wl_region_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_compositor), flags: 0, NULL);
1321
1322 return (struct wl_region *) id;
1323}
1324
1325#define WL_SHM_POOL_CREATE_BUFFER 0
1326#define WL_SHM_POOL_DESTROY 1
1327#define WL_SHM_POOL_RESIZE 2
1328
1329
1330/**
1331 * @ingroup iface_wl_shm_pool
1332 */
1333#define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION 1
1334/**
1335 * @ingroup iface_wl_shm_pool
1336 */
1337#define WL_SHM_POOL_DESTROY_SINCE_VERSION 1
1338/**
1339 * @ingroup iface_wl_shm_pool
1340 */
1341#define WL_SHM_POOL_RESIZE_SINCE_VERSION 1
1342
1343/** @ingroup iface_wl_shm_pool */
1344static inline void
1345wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data)
1346{
1347 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_shm_pool, user_data);
1348}
1349
1350/** @ingroup iface_wl_shm_pool */
1351static inline void *
1352wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool)
1353{
1354 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_shm_pool);
1355}
1356
1357static inline uint32_t
1358wl_shm_pool_get_version(struct wl_shm_pool *wl_shm_pool)
1359{
1360 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm_pool);
1361}
1362
1363/**
1364 * @ingroup iface_wl_shm_pool
1365 *
1366 * Create a wl_buffer object from the pool.
1367 *
1368 * The buffer is created offset bytes into the pool and has
1369 * width and height as specified. The stride argument specifies
1370 * the number of bytes from the beginning of one row to the beginning
1371 * of the next. The format is the pixel format of the buffer and
1372 * must be one of those advertised through the wl_shm.format event.
1373 *
1374 * A buffer will keep a reference to the pool it was created from
1375 * so it is valid to destroy the pool immediately after creating
1376 * a buffer from it.
1377 */
1378static inline struct wl_buffer *
1379wl_shm_pool_create_buffer(struct wl_shm_pool *wl_shm_pool, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
1380{
1381 struct wl_proxy *id;
1382
1383 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shm_pool,
1384 WL_SHM_POOL_CREATE_BUFFER, interface: &wl_buffer_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm_pool), flags: 0, NULL, offset, width, height, stride, format);
1385
1386 return (struct wl_buffer *) id;
1387}
1388
1389/**
1390 * @ingroup iface_wl_shm_pool
1391 *
1392 * Destroy the shared memory pool.
1393 *
1394 * The mmapped memory will be released when all
1395 * buffers that have been created from this pool
1396 * are gone.
1397 */
1398static inline void
1399wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool)
1400{
1401 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shm_pool,
1402 WL_SHM_POOL_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm_pool), WL_MARSHAL_FLAG_DESTROY);
1403}
1404
1405/**
1406 * @ingroup iface_wl_shm_pool
1407 *
1408 * This request will cause the server to remap the backing memory
1409 * for the pool from the file descriptor passed when the pool was
1410 * created, but using the new size. This request can only be
1411 * used to make the pool bigger.
1412 *
1413 * This request only changes the amount of bytes that are mmapped
1414 * by the server and does not touch the file corresponding to the
1415 * file descriptor passed at creation time. It is the client's
1416 * responsibility to ensure that the file is at least as big as
1417 * the new pool size.
1418 */
1419static inline void
1420wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size)
1421{
1422 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shm_pool,
1423 WL_SHM_POOL_RESIZE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm_pool), flags: 0, size);
1424}
1425
1426#ifndef WL_SHM_ERROR_ENUM
1427#define WL_SHM_ERROR_ENUM
1428/**
1429 * @ingroup iface_wl_shm
1430 * wl_shm error values
1431 *
1432 * These errors can be emitted in response to wl_shm requests.
1433 */
1434enum wl_shm_error {
1435 /**
1436 * buffer format is not known
1437 */
1438 WL_SHM_ERROR_INVALID_FORMAT = 0,
1439 /**
1440 * invalid size or stride during pool or buffer creation
1441 */
1442 WL_SHM_ERROR_INVALID_STRIDE = 1,
1443 /**
1444 * mmapping the file descriptor failed
1445 */
1446 WL_SHM_ERROR_INVALID_FD = 2,
1447};
1448#endif /* WL_SHM_ERROR_ENUM */
1449
1450#ifndef WL_SHM_FORMAT_ENUM
1451#define WL_SHM_FORMAT_ENUM
1452/**
1453 * @ingroup iface_wl_shm
1454 * pixel formats
1455 *
1456 * This describes the memory layout of an individual pixel.
1457 *
1458 * All renderers should support argb8888 and xrgb8888 but any other
1459 * formats are optional and may not be supported by the particular
1460 * renderer in use.
1461 *
1462 * The drm format codes match the macros defined in drm_fourcc.h, except
1463 * argb8888 and xrgb8888. The formats actually supported by the compositor
1464 * will be reported by the format event.
1465 *
1466 * For all wl_shm formats and unless specified in another protocol
1467 * extension, pre-multiplied alpha is used for pixel values.
1468 */
1469enum wl_shm_format {
1470 /**
1471 * 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
1472 */
1473 WL_SHM_FORMAT_ARGB8888 = 0,
1474 /**
1475 * 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
1476 */
1477 WL_SHM_FORMAT_XRGB8888 = 1,
1478 /**
1479 * 8-bit color index format, [7:0] C
1480 */
1481 WL_SHM_FORMAT_C8 = 0x20203843,
1482 /**
1483 * 8-bit RGB format, [7:0] R:G:B 3:3:2
1484 */
1485 WL_SHM_FORMAT_RGB332 = 0x38424752,
1486 /**
1487 * 8-bit BGR format, [7:0] B:G:R 2:3:3
1488 */
1489 WL_SHM_FORMAT_BGR233 = 0x38524742,
1490 /**
1491 * 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
1492 */
1493 WL_SHM_FORMAT_XRGB4444 = 0x32315258,
1494 /**
1495 * 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
1496 */
1497 WL_SHM_FORMAT_XBGR4444 = 0x32314258,
1498 /**
1499 * 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
1500 */
1501 WL_SHM_FORMAT_RGBX4444 = 0x32315852,
1502 /**
1503 * 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
1504 */
1505 WL_SHM_FORMAT_BGRX4444 = 0x32315842,
1506 /**
1507 * 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
1508 */
1509 WL_SHM_FORMAT_ARGB4444 = 0x32315241,
1510 /**
1511 * 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
1512 */
1513 WL_SHM_FORMAT_ABGR4444 = 0x32314241,
1514 /**
1515 * 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
1516 */
1517 WL_SHM_FORMAT_RGBA4444 = 0x32314152,
1518 /**
1519 * 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
1520 */
1521 WL_SHM_FORMAT_BGRA4444 = 0x32314142,
1522 /**
1523 * 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
1524 */
1525 WL_SHM_FORMAT_XRGB1555 = 0x35315258,
1526 /**
1527 * 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
1528 */
1529 WL_SHM_FORMAT_XBGR1555 = 0x35314258,
1530 /**
1531 * 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
1532 */
1533 WL_SHM_FORMAT_RGBX5551 = 0x35315852,
1534 /**
1535 * 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
1536 */
1537 WL_SHM_FORMAT_BGRX5551 = 0x35315842,
1538 /**
1539 * 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
1540 */
1541 WL_SHM_FORMAT_ARGB1555 = 0x35315241,
1542 /**
1543 * 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
1544 */
1545 WL_SHM_FORMAT_ABGR1555 = 0x35314241,
1546 /**
1547 * 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
1548 */
1549 WL_SHM_FORMAT_RGBA5551 = 0x35314152,
1550 /**
1551 * 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
1552 */
1553 WL_SHM_FORMAT_BGRA5551 = 0x35314142,
1554 /**
1555 * 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
1556 */
1557 WL_SHM_FORMAT_RGB565 = 0x36314752,
1558 /**
1559 * 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
1560 */
1561 WL_SHM_FORMAT_BGR565 = 0x36314742,
1562 /**
1563 * 24-bit RGB format, [23:0] R:G:B little endian
1564 */
1565 WL_SHM_FORMAT_RGB888 = 0x34324752,
1566 /**
1567 * 24-bit BGR format, [23:0] B:G:R little endian
1568 */
1569 WL_SHM_FORMAT_BGR888 = 0x34324742,
1570 /**
1571 * 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
1572 */
1573 WL_SHM_FORMAT_XBGR8888 = 0x34324258,
1574 /**
1575 * 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
1576 */
1577 WL_SHM_FORMAT_RGBX8888 = 0x34325852,
1578 /**
1579 * 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
1580 */
1581 WL_SHM_FORMAT_BGRX8888 = 0x34325842,
1582 /**
1583 * 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
1584 */
1585 WL_SHM_FORMAT_ABGR8888 = 0x34324241,
1586 /**
1587 * 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
1588 */
1589 WL_SHM_FORMAT_RGBA8888 = 0x34324152,
1590 /**
1591 * 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
1592 */
1593 WL_SHM_FORMAT_BGRA8888 = 0x34324142,
1594 /**
1595 * 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
1596 */
1597 WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
1598 /**
1599 * 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
1600 */
1601 WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
1602 /**
1603 * 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
1604 */
1605 WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
1606 /**
1607 * 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
1608 */
1609 WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
1610 /**
1611 * 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
1612 */
1613 WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
1614 /**
1615 * 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
1616 */
1617 WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
1618 /**
1619 * 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
1620 */
1621 WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
1622 /**
1623 * 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
1624 */
1625 WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
1626 /**
1627 * packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
1628 */
1629 WL_SHM_FORMAT_YUYV = 0x56595559,
1630 /**
1631 * packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
1632 */
1633 WL_SHM_FORMAT_YVYU = 0x55595659,
1634 /**
1635 * packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
1636 */
1637 WL_SHM_FORMAT_UYVY = 0x59565955,
1638 /**
1639 * packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
1640 */
1641 WL_SHM_FORMAT_VYUY = 0x59555956,
1642 /**
1643 * packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
1644 */
1645 WL_SHM_FORMAT_AYUV = 0x56555941,
1646 /**
1647 * 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
1648 */
1649 WL_SHM_FORMAT_NV12 = 0x3231564e,
1650 /**
1651 * 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
1652 */
1653 WL_SHM_FORMAT_NV21 = 0x3132564e,
1654 /**
1655 * 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
1656 */
1657 WL_SHM_FORMAT_NV16 = 0x3631564e,
1658 /**
1659 * 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
1660 */
1661 WL_SHM_FORMAT_NV61 = 0x3136564e,
1662 /**
1663 * 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
1664 */
1665 WL_SHM_FORMAT_YUV410 = 0x39565559,
1666 /**
1667 * 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
1668 */
1669 WL_SHM_FORMAT_YVU410 = 0x39555659,
1670 /**
1671 * 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
1672 */
1673 WL_SHM_FORMAT_YUV411 = 0x31315559,
1674 /**
1675 * 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
1676 */
1677 WL_SHM_FORMAT_YVU411 = 0x31315659,
1678 /**
1679 * 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
1680 */
1681 WL_SHM_FORMAT_YUV420 = 0x32315559,
1682 /**
1683 * 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
1684 */
1685 WL_SHM_FORMAT_YVU420 = 0x32315659,
1686 /**
1687 * 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
1688 */
1689 WL_SHM_FORMAT_YUV422 = 0x36315559,
1690 /**
1691 * 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
1692 */
1693 WL_SHM_FORMAT_YVU422 = 0x36315659,
1694 /**
1695 * 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
1696 */
1697 WL_SHM_FORMAT_YUV444 = 0x34325559,
1698 /**
1699 * 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
1700 */
1701 WL_SHM_FORMAT_YVU444 = 0x34325659,
1702 /**
1703 * [7:0] R
1704 */
1705 WL_SHM_FORMAT_R8 = 0x20203852,
1706 /**
1707 * [15:0] R little endian
1708 */
1709 WL_SHM_FORMAT_R16 = 0x20363152,
1710 /**
1711 * [15:0] R:G 8:8 little endian
1712 */
1713 WL_SHM_FORMAT_RG88 = 0x38384752,
1714 /**
1715 * [15:0] G:R 8:8 little endian
1716 */
1717 WL_SHM_FORMAT_GR88 = 0x38385247,
1718 /**
1719 * [31:0] R:G 16:16 little endian
1720 */
1721 WL_SHM_FORMAT_RG1616 = 0x32334752,
1722 /**
1723 * [31:0] G:R 16:16 little endian
1724 */
1725 WL_SHM_FORMAT_GR1616 = 0x32335247,
1726 /**
1727 * [63:0] x:R:G:B 16:16:16:16 little endian
1728 */
1729 WL_SHM_FORMAT_XRGB16161616F = 0x48345258,
1730 /**
1731 * [63:0] x:B:G:R 16:16:16:16 little endian
1732 */
1733 WL_SHM_FORMAT_XBGR16161616F = 0x48344258,
1734 /**
1735 * [63:0] A:R:G:B 16:16:16:16 little endian
1736 */
1737 WL_SHM_FORMAT_ARGB16161616F = 0x48345241,
1738 /**
1739 * [63:0] A:B:G:R 16:16:16:16 little endian
1740 */
1741 WL_SHM_FORMAT_ABGR16161616F = 0x48344241,
1742 /**
1743 * [31:0] X:Y:Cb:Cr 8:8:8:8 little endian
1744 */
1745 WL_SHM_FORMAT_XYUV8888 = 0x56555958,
1746 /**
1747 * [23:0] Cr:Cb:Y 8:8:8 little endian
1748 */
1749 WL_SHM_FORMAT_VUY888 = 0x34325556,
1750 /**
1751 * Y followed by U then V, 10:10:10. Non-linear modifier only
1752 */
1753 WL_SHM_FORMAT_VUY101010 = 0x30335556,
1754 /**
1755 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels
1756 */
1757 WL_SHM_FORMAT_Y210 = 0x30313259,
1758 /**
1759 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels
1760 */
1761 WL_SHM_FORMAT_Y212 = 0x32313259,
1762 /**
1763 * [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels
1764 */
1765 WL_SHM_FORMAT_Y216 = 0x36313259,
1766 /**
1767 * [31:0] A:Cr:Y:Cb 2:10:10:10 little endian
1768 */
1769 WL_SHM_FORMAT_Y410 = 0x30313459,
1770 /**
1771 * [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
1772 */
1773 WL_SHM_FORMAT_Y412 = 0x32313459,
1774 /**
1775 * [63:0] A:Cr:Y:Cb 16:16:16:16 little endian
1776 */
1777 WL_SHM_FORMAT_Y416 = 0x36313459,
1778 /**
1779 * [31:0] X:Cr:Y:Cb 2:10:10:10 little endian
1780 */
1781 WL_SHM_FORMAT_XVYU2101010 = 0x30335658,
1782 /**
1783 * [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
1784 */
1785 WL_SHM_FORMAT_XVYU12_16161616 = 0x36335658,
1786 /**
1787 * [63:0] X:Cr:Y:Cb 16:16:16:16 little endian
1788 */
1789 WL_SHM_FORMAT_XVYU16161616 = 0x38345658,
1790 /**
1791 * [63:0] A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
1792 */
1793 WL_SHM_FORMAT_Y0L0 = 0x304c3059,
1794 /**
1795 * [63:0] X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0 1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
1796 */
1797 WL_SHM_FORMAT_X0L0 = 0x304c3058,
1798 /**
1799 * [63:0] A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian
1800 */
1801 WL_SHM_FORMAT_Y0L2 = 0x324c3059,
1802 /**
1803 * [63:0] X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0 1:1:10:10:10:1:1:10:10:10 little endian
1804 */
1805 WL_SHM_FORMAT_X0L2 = 0x324c3058,
1806 WL_SHM_FORMAT_YUV420_8BIT = 0x38305559,
1807 WL_SHM_FORMAT_YUV420_10BIT = 0x30315559,
1808 WL_SHM_FORMAT_XRGB8888_A8 = 0x38415258,
1809 WL_SHM_FORMAT_XBGR8888_A8 = 0x38414258,
1810 WL_SHM_FORMAT_RGBX8888_A8 = 0x38415852,
1811 WL_SHM_FORMAT_BGRX8888_A8 = 0x38415842,
1812 WL_SHM_FORMAT_RGB888_A8 = 0x38413852,
1813 WL_SHM_FORMAT_BGR888_A8 = 0x38413842,
1814 WL_SHM_FORMAT_RGB565_A8 = 0x38413552,
1815 WL_SHM_FORMAT_BGR565_A8 = 0x38413542,
1816 /**
1817 * non-subsampled Cr:Cb plane
1818 */
1819 WL_SHM_FORMAT_NV24 = 0x3432564e,
1820 /**
1821 * non-subsampled Cb:Cr plane
1822 */
1823 WL_SHM_FORMAT_NV42 = 0x3234564e,
1824 /**
1825 * 2x1 subsampled Cr:Cb plane, 10 bit per channel
1826 */
1827 WL_SHM_FORMAT_P210 = 0x30313250,
1828 /**
1829 * 2x2 subsampled Cr:Cb plane 10 bits per channel
1830 */
1831 WL_SHM_FORMAT_P010 = 0x30313050,
1832 /**
1833 * 2x2 subsampled Cr:Cb plane 12 bits per channel
1834 */
1835 WL_SHM_FORMAT_P012 = 0x32313050,
1836 /**
1837 * 2x2 subsampled Cr:Cb plane 16 bits per channel
1838 */
1839 WL_SHM_FORMAT_P016 = 0x36313050,
1840 /**
1841 * [63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian
1842 */
1843 WL_SHM_FORMAT_AXBXGXRX106106106106 = 0x30314241,
1844 /**
1845 * 2x2 subsampled Cr:Cb plane
1846 */
1847 WL_SHM_FORMAT_NV15 = 0x3531564e,
1848 WL_SHM_FORMAT_Q410 = 0x30313451,
1849 WL_SHM_FORMAT_Q401 = 0x31303451,
1850 /**
1851 * [63:0] x:R:G:B 16:16:16:16 little endian
1852 */
1853 WL_SHM_FORMAT_XRGB16161616 = 0x38345258,
1854 /**
1855 * [63:0] x:B:G:R 16:16:16:16 little endian
1856 */
1857 WL_SHM_FORMAT_XBGR16161616 = 0x38344258,
1858 /**
1859 * [63:0] A:R:G:B 16:16:16:16 little endian
1860 */
1861 WL_SHM_FORMAT_ARGB16161616 = 0x38345241,
1862 /**
1863 * [63:0] A:B:G:R 16:16:16:16 little endian
1864 */
1865 WL_SHM_FORMAT_ABGR16161616 = 0x38344241,
1866};
1867#endif /* WL_SHM_FORMAT_ENUM */
1868
1869/**
1870 * @ingroup iface_wl_shm
1871 * @struct wl_shm_listener
1872 */
1873struct wl_shm_listener {
1874 /**
1875 * pixel format description
1876 *
1877 * Informs the client about a valid pixel format that can be used
1878 * for buffers. Known formats include argb8888 and xrgb8888.
1879 * @param format buffer pixel format
1880 */
1881 void (*format)(void *data,
1882 struct wl_shm *wl_shm,
1883 uint32_t format);
1884};
1885
1886/**
1887 * @ingroup iface_wl_shm
1888 */
1889static inline int
1890wl_shm_add_listener(struct wl_shm *wl_shm,
1891 const struct wl_shm_listener *listener, void *data)
1892{
1893 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_shm,
1894 implementation: (void (**)(void)) listener, data);
1895}
1896
1897#define WL_SHM_CREATE_POOL 0
1898
1899/**
1900 * @ingroup iface_wl_shm
1901 */
1902#define WL_SHM_FORMAT_SINCE_VERSION 1
1903
1904/**
1905 * @ingroup iface_wl_shm
1906 */
1907#define WL_SHM_CREATE_POOL_SINCE_VERSION 1
1908
1909/** @ingroup iface_wl_shm */
1910static inline void
1911wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data)
1912{
1913 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_shm, user_data);
1914}
1915
1916/** @ingroup iface_wl_shm */
1917static inline void *
1918wl_shm_get_user_data(struct wl_shm *wl_shm)
1919{
1920 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_shm);
1921}
1922
1923static inline uint32_t
1924wl_shm_get_version(struct wl_shm *wl_shm)
1925{
1926 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm);
1927}
1928
1929/** @ingroup iface_wl_shm */
1930static inline void
1931wl_shm_destroy(struct wl_shm *wl_shm)
1932{
1933 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_shm);
1934}
1935
1936/**
1937 * @ingroup iface_wl_shm
1938 *
1939 * Create a new wl_shm_pool object.
1940 *
1941 * The pool can be used to create shared memory based buffer
1942 * objects. The server will mmap size bytes of the passed file
1943 * descriptor, to use as backing memory for the pool.
1944 */
1945static inline struct wl_shm_pool *
1946wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size)
1947{
1948 struct wl_proxy *id;
1949
1950 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shm,
1951 WL_SHM_CREATE_POOL, interface: &wl_shm_pool_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shm), flags: 0, NULL, fd, size);
1952
1953 return (struct wl_shm_pool *) id;
1954}
1955
1956/**
1957 * @ingroup iface_wl_buffer
1958 * @struct wl_buffer_listener
1959 */
1960struct wl_buffer_listener {
1961 /**
1962 * compositor releases buffer
1963 *
1964 * Sent when this wl_buffer is no longer used by the compositor.
1965 * The client is now free to reuse or destroy this buffer and its
1966 * backing storage.
1967 *
1968 * If a client receives a release event before the frame callback
1969 * requested in the same wl_surface.commit that attaches this
1970 * wl_buffer to a surface, then the client is immediately free to
1971 * reuse the buffer and its backing storage, and does not need a
1972 * second buffer for the next surface content update. Typically
1973 * this is possible, when the compositor maintains a copy of the
1974 * wl_surface contents, e.g. as a GL texture. This is an important
1975 * optimization for GL(ES) compositors with wl_shm clients.
1976 */
1977 void (*release)(void *data,
1978 struct wl_buffer *wl_buffer);
1979};
1980
1981/**
1982 * @ingroup iface_wl_buffer
1983 */
1984static inline int
1985wl_buffer_add_listener(struct wl_buffer *wl_buffer,
1986 const struct wl_buffer_listener *listener, void *data)
1987{
1988 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_buffer,
1989 implementation: (void (**)(void)) listener, data);
1990}
1991
1992#define WL_BUFFER_DESTROY 0
1993
1994/**
1995 * @ingroup iface_wl_buffer
1996 */
1997#define WL_BUFFER_RELEASE_SINCE_VERSION 1
1998
1999/**
2000 * @ingroup iface_wl_buffer
2001 */
2002#define WL_BUFFER_DESTROY_SINCE_VERSION 1
2003
2004/** @ingroup iface_wl_buffer */
2005static inline void
2006wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data)
2007{
2008 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_buffer, user_data);
2009}
2010
2011/** @ingroup iface_wl_buffer */
2012static inline void *
2013wl_buffer_get_user_data(struct wl_buffer *wl_buffer)
2014{
2015 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_buffer);
2016}
2017
2018static inline uint32_t
2019wl_buffer_get_version(struct wl_buffer *wl_buffer)
2020{
2021 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_buffer);
2022}
2023
2024/**
2025 * @ingroup iface_wl_buffer
2026 *
2027 * Destroy a buffer. If and how you need to release the backing
2028 * storage is defined by the buffer factory interface.
2029 *
2030 * For possible side-effects to a surface, see wl_surface.attach.
2031 */
2032static inline void
2033wl_buffer_destroy(struct wl_buffer *wl_buffer)
2034{
2035 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_buffer,
2036 WL_BUFFER_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_buffer), WL_MARSHAL_FLAG_DESTROY);
2037}
2038
2039#ifndef WL_DATA_OFFER_ERROR_ENUM
2040#define WL_DATA_OFFER_ERROR_ENUM
2041enum wl_data_offer_error {
2042 /**
2043 * finish request was called untimely
2044 */
2045 WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
2046 /**
2047 * action mask contains invalid values
2048 */
2049 WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
2050 /**
2051 * action argument has an invalid value
2052 */
2053 WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
2054 /**
2055 * offer doesn't accept this request
2056 */
2057 WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
2058};
2059#endif /* WL_DATA_OFFER_ERROR_ENUM */
2060
2061/**
2062 * @ingroup iface_wl_data_offer
2063 * @struct wl_data_offer_listener
2064 */
2065struct wl_data_offer_listener {
2066 /**
2067 * advertise offered mime type
2068 *
2069 * Sent immediately after creating the wl_data_offer object. One
2070 * event per offered mime type.
2071 * @param mime_type offered mime type
2072 */
2073 void (*offer)(void *data,
2074 struct wl_data_offer *wl_data_offer,
2075 const char *mime_type);
2076 /**
2077 * notify the source-side available actions
2078 *
2079 * This event indicates the actions offered by the data source.
2080 * It will be sent immediately after creating the wl_data_offer
2081 * object, or anytime the source side changes its offered actions
2082 * through wl_data_source.set_actions.
2083 * @param source_actions actions offered by the data source
2084 * @since 3
2085 */
2086 void (*source_actions)(void *data,
2087 struct wl_data_offer *wl_data_offer,
2088 uint32_t source_actions);
2089 /**
2090 * notify the selected action
2091 *
2092 * This event indicates the action selected by the compositor
2093 * after matching the source/destination side actions. Only one
2094 * action (or none) will be offered here.
2095 *
2096 * This event can be emitted multiple times during the
2097 * drag-and-drop operation in response to destination side action
2098 * changes through wl_data_offer.set_actions.
2099 *
2100 * This event will no longer be emitted after wl_data_device.drop
2101 * happened on the drag-and-drop destination, the client must honor
2102 * the last action received, or the last preferred one set through
2103 * wl_data_offer.set_actions when handling an "ask" action.
2104 *
2105 * Compositors may also change the selected action on the fly,
2106 * mainly in response to keyboard modifier changes during the
2107 * drag-and-drop operation.
2108 *
2109 * The most recent action received is always the valid one. Prior
2110 * to receiving wl_data_device.drop, the chosen action may change
2111 * (e.g. due to keyboard modifiers being pressed). At the time of
2112 * receiving wl_data_device.drop the drag-and-drop destination must
2113 * honor the last action received.
2114 *
2115 * Action changes may still happen after wl_data_device.drop,
2116 * especially on "ask" actions, where the drag-and-drop destination
2117 * may choose another action afterwards. Action changes happening
2118 * at this stage are always the result of inter-client negotiation,
2119 * the compositor shall no longer be able to induce a different
2120 * action.
2121 *
2122 * Upon "ask" actions, it is expected that the drag-and-drop
2123 * destination may potentially choose a different action and/or
2124 * mime type, based on wl_data_offer.source_actions and finally
2125 * chosen by the user (e.g. popping up a menu with the available
2126 * options). The final wl_data_offer.set_actions and
2127 * wl_data_offer.accept requests must happen before the call to
2128 * wl_data_offer.finish.
2129 * @param dnd_action action selected by the compositor
2130 * @since 3
2131 */
2132 void (*action)(void *data,
2133 struct wl_data_offer *wl_data_offer,
2134 uint32_t dnd_action);
2135};
2136
2137/**
2138 * @ingroup iface_wl_data_offer
2139 */
2140static inline int
2141wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer,
2142 const struct wl_data_offer_listener *listener, void *data)
2143{
2144 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_data_offer,
2145 implementation: (void (**)(void)) listener, data);
2146}
2147
2148#define WL_DATA_OFFER_ACCEPT 0
2149#define WL_DATA_OFFER_RECEIVE 1
2150#define WL_DATA_OFFER_DESTROY 2
2151#define WL_DATA_OFFER_FINISH 3
2152#define WL_DATA_OFFER_SET_ACTIONS 4
2153
2154/**
2155 * @ingroup iface_wl_data_offer
2156 */
2157#define WL_DATA_OFFER_OFFER_SINCE_VERSION 1
2158/**
2159 * @ingroup iface_wl_data_offer
2160 */
2161#define WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION 3
2162/**
2163 * @ingroup iface_wl_data_offer
2164 */
2165#define WL_DATA_OFFER_ACTION_SINCE_VERSION 3
2166
2167/**
2168 * @ingroup iface_wl_data_offer
2169 */
2170#define WL_DATA_OFFER_ACCEPT_SINCE_VERSION 1
2171/**
2172 * @ingroup iface_wl_data_offer
2173 */
2174#define WL_DATA_OFFER_RECEIVE_SINCE_VERSION 1
2175/**
2176 * @ingroup iface_wl_data_offer
2177 */
2178#define WL_DATA_OFFER_DESTROY_SINCE_VERSION 1
2179/**
2180 * @ingroup iface_wl_data_offer
2181 */
2182#define WL_DATA_OFFER_FINISH_SINCE_VERSION 3
2183/**
2184 * @ingroup iface_wl_data_offer
2185 */
2186#define WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION 3
2187
2188/** @ingroup iface_wl_data_offer */
2189static inline void
2190wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data)
2191{
2192 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_data_offer, user_data);
2193}
2194
2195/** @ingroup iface_wl_data_offer */
2196static inline void *
2197wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer)
2198{
2199 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_data_offer);
2200}
2201
2202static inline uint32_t
2203wl_data_offer_get_version(struct wl_data_offer *wl_data_offer)
2204{
2205 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer);
2206}
2207
2208/**
2209 * @ingroup iface_wl_data_offer
2210 *
2211 * Indicate that the client can accept the given mime type, or
2212 * NULL for not accepted.
2213 *
2214 * For objects of version 2 or older, this request is used by the
2215 * client to give feedback whether the client can receive the given
2216 * mime type, or NULL if none is accepted; the feedback does not
2217 * determine whether the drag-and-drop operation succeeds or not.
2218 *
2219 * For objects of version 3 or newer, this request determines the
2220 * final result of the drag-and-drop operation. If the end result
2221 * is that no mime types were accepted, the drag-and-drop operation
2222 * will be cancelled and the corresponding drag source will receive
2223 * wl_data_source.cancelled. Clients may still use this event in
2224 * conjunction with wl_data_source.action for feedback.
2225 */
2226static inline void
2227wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const char *mime_type)
2228{
2229 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_offer,
2230 WL_DATA_OFFER_ACCEPT, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer), flags: 0, serial, mime_type);
2231}
2232
2233/**
2234 * @ingroup iface_wl_data_offer
2235 *
2236 * To transfer the offered data, the client issues this request
2237 * and indicates the mime type it wants to receive. The transfer
2238 * happens through the passed file descriptor (typically created
2239 * with the pipe system call). The source client writes the data
2240 * in the mime type representation requested and then closes the
2241 * file descriptor.
2242 *
2243 * The receiving client reads from the read end of the pipe until
2244 * EOF and then closes its end, at which point the transfer is
2245 * complete.
2246 *
2247 * This request may happen multiple times for different mime types,
2248 * both before and after wl_data_device.drop. Drag-and-drop destination
2249 * clients may preemptively fetch data or examine it more closely to
2250 * determine acceptance.
2251 */
2252static inline void
2253wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type, int32_t fd)
2254{
2255 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_offer,
2256 WL_DATA_OFFER_RECEIVE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer), flags: 0, mime_type, fd);
2257}
2258
2259/**
2260 * @ingroup iface_wl_data_offer
2261 *
2262 * Destroy the data offer.
2263 */
2264static inline void
2265wl_data_offer_destroy(struct wl_data_offer *wl_data_offer)
2266{
2267 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_offer,
2268 WL_DATA_OFFER_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer), WL_MARSHAL_FLAG_DESTROY);
2269}
2270
2271/**
2272 * @ingroup iface_wl_data_offer
2273 *
2274 * Notifies the compositor that the drag destination successfully
2275 * finished the drag-and-drop operation.
2276 *
2277 * Upon receiving this request, the compositor will emit
2278 * wl_data_source.dnd_finished on the drag source client.
2279 *
2280 * It is a client error to perform other requests than
2281 * wl_data_offer.destroy after this one. It is also an error to perform
2282 * this request after a NULL mime type has been set in
2283 * wl_data_offer.accept or no action was received through
2284 * wl_data_offer.action.
2285 *
2286 * If wl_data_offer.finish request is received for a non drag and drop
2287 * operation, the invalid_finish protocol error is raised.
2288 */
2289static inline void
2290wl_data_offer_finish(struct wl_data_offer *wl_data_offer)
2291{
2292 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_offer,
2293 WL_DATA_OFFER_FINISH, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer), flags: 0);
2294}
2295
2296/**
2297 * @ingroup iface_wl_data_offer
2298 *
2299 * Sets the actions that the destination side client supports for
2300 * this operation. This request may trigger the emission of
2301 * wl_data_source.action and wl_data_offer.action events if the compositor
2302 * needs to change the selected action.
2303 *
2304 * This request can be called multiple times throughout the
2305 * drag-and-drop operation, typically in response to wl_data_device.enter
2306 * or wl_data_device.motion events.
2307 *
2308 * This request determines the final result of the drag-and-drop
2309 * operation. If the end result is that no action is accepted,
2310 * the drag source will receive wl_data_source.cancelled.
2311 *
2312 * The dnd_actions argument must contain only values expressed in the
2313 * wl_data_device_manager.dnd_actions enum, and the preferred_action
2314 * argument must only contain one of those values set, otherwise it
2315 * will result in a protocol error.
2316 *
2317 * While managing an "ask" action, the destination drag-and-drop client
2318 * may perform further wl_data_offer.receive requests, and is expected
2319 * to perform one last wl_data_offer.set_actions request with a preferred
2320 * action other than "ask" (and optionally wl_data_offer.accept) before
2321 * requesting wl_data_offer.finish, in order to convey the action selected
2322 * by the user. If the preferred action is not in the
2323 * wl_data_offer.source_actions mask, an error will be raised.
2324 *
2325 * If the "ask" action is dismissed (e.g. user cancellation), the client
2326 * is expected to perform wl_data_offer.destroy right away.
2327 *
2328 * This request can only be made on drag-and-drop offers, a protocol error
2329 * will be raised otherwise.
2330 */
2331static inline void
2332wl_data_offer_set_actions(struct wl_data_offer *wl_data_offer, uint32_t dnd_actions, uint32_t preferred_action)
2333{
2334 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_offer,
2335 WL_DATA_OFFER_SET_ACTIONS, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_offer), flags: 0, dnd_actions, preferred_action);
2336}
2337
2338#ifndef WL_DATA_SOURCE_ERROR_ENUM
2339#define WL_DATA_SOURCE_ERROR_ENUM
2340enum wl_data_source_error {
2341 /**
2342 * action mask contains invalid values
2343 */
2344 WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
2345 /**
2346 * source doesn't accept this request
2347 */
2348 WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
2349};
2350#endif /* WL_DATA_SOURCE_ERROR_ENUM */
2351
2352/**
2353 * @ingroup iface_wl_data_source
2354 * @struct wl_data_source_listener
2355 */
2356struct wl_data_source_listener {
2357 /**
2358 * a target accepts an offered mime type
2359 *
2360 * Sent when a target accepts pointer_focus or motion events. If
2361 * a target does not accept any of the offered types, type is NULL.
2362 *
2363 * Used for feedback during drag-and-drop.
2364 * @param mime_type mime type accepted by the target
2365 */
2366 void (*target)(void *data,
2367 struct wl_data_source *wl_data_source,
2368 const char *mime_type);
2369 /**
2370 * send the data
2371 *
2372 * Request for data from the client. Send the data as the
2373 * specified mime type over the passed file descriptor, then close
2374 * it.
2375 * @param mime_type mime type for the data
2376 * @param fd file descriptor for the data
2377 */
2378 void (*send)(void *data,
2379 struct wl_data_source *wl_data_source,
2380 const char *mime_type,
2381 int32_t fd);
2382 /**
2383 * selection was cancelled
2384 *
2385 * This data source is no longer valid. There are several reasons
2386 * why this could happen:
2387 *
2388 * - The data source has been replaced by another data source. -
2389 * The drag-and-drop operation was performed, but the drop
2390 * destination did not accept any of the mime types offered through
2391 * wl_data_source.target. - The drag-and-drop operation was
2392 * performed, but the drop destination did not select any of the
2393 * actions present in the mask offered through
2394 * wl_data_source.action. - The drag-and-drop operation was
2395 * performed but didn't happen over a surface. - The compositor
2396 * cancelled the drag-and-drop operation (e.g. compositor dependent
2397 * timeouts to avoid stale drag-and-drop transfers).
2398 *
2399 * The client should clean up and destroy this data source.
2400 *
2401 * For objects of version 2 or older, wl_data_source.cancelled will
2402 * only be emitted if the data source was replaced by another data
2403 * source.
2404 */
2405 void (*cancelled)(void *data,
2406 struct wl_data_source *wl_data_source);
2407 /**
2408 * the drag-and-drop operation physically finished
2409 *
2410 * The user performed the drop action. This event does not
2411 * indicate acceptance, wl_data_source.cancelled may still be
2412 * emitted afterwards if the drop destination does not accept any
2413 * mime type.
2414 *
2415 * However, this event might however not be received if the
2416 * compositor cancelled the drag-and-drop operation before this
2417 * event could happen.
2418 *
2419 * Note that the data_source may still be used in the future and
2420 * should not be destroyed here.
2421 * @since 3
2422 */
2423 void (*dnd_drop_performed)(void *data,
2424 struct wl_data_source *wl_data_source);
2425 /**
2426 * the drag-and-drop operation concluded
2427 *
2428 * The drop destination finished interoperating with this data
2429 * source, so the client is now free to destroy this data source
2430 * and free all associated data.
2431 *
2432 * If the action used to perform the operation was "move", the
2433 * source can now delete the transferred data.
2434 * @since 3
2435 */
2436 void (*dnd_finished)(void *data,
2437 struct wl_data_source *wl_data_source);
2438 /**
2439 * notify the selected action
2440 *
2441 * This event indicates the action selected by the compositor
2442 * after matching the source/destination side actions. Only one
2443 * action (or none) will be offered here.
2444 *
2445 * This event can be emitted multiple times during the
2446 * drag-and-drop operation, mainly in response to destination side
2447 * changes through wl_data_offer.set_actions, and as the data
2448 * device enters/leaves surfaces.
2449 *
2450 * It is only possible to receive this event after
2451 * wl_data_source.dnd_drop_performed if the drag-and-drop operation
2452 * ended in an "ask" action, in which case the final
2453 * wl_data_source.action event will happen immediately before
2454 * wl_data_source.dnd_finished.
2455 *
2456 * Compositors may also change the selected action on the fly,
2457 * mainly in response to keyboard modifier changes during the
2458 * drag-and-drop operation.
2459 *
2460 * The most recent action received is always the valid one. The
2461 * chosen action may change alongside negotiation (e.g. an "ask"
2462 * action can turn into a "move" operation), so the effects of the
2463 * final action must always be applied in
2464 * wl_data_offer.dnd_finished.
2465 *
2466 * Clients can trigger cursor surface changes from this point, so
2467 * they reflect the current action.
2468 * @param dnd_action action selected by the compositor
2469 * @since 3
2470 */
2471 void (*action)(void *data,
2472 struct wl_data_source *wl_data_source,
2473 uint32_t dnd_action);
2474};
2475
2476/**
2477 * @ingroup iface_wl_data_source
2478 */
2479static inline int
2480wl_data_source_add_listener(struct wl_data_source *wl_data_source,
2481 const struct wl_data_source_listener *listener, void *data)
2482{
2483 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_data_source,
2484 implementation: (void (**)(void)) listener, data);
2485}
2486
2487#define WL_DATA_SOURCE_OFFER 0
2488#define WL_DATA_SOURCE_DESTROY 1
2489#define WL_DATA_SOURCE_SET_ACTIONS 2
2490
2491/**
2492 * @ingroup iface_wl_data_source
2493 */
2494#define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1
2495/**
2496 * @ingroup iface_wl_data_source
2497 */
2498#define WL_DATA_SOURCE_SEND_SINCE_VERSION 1
2499/**
2500 * @ingroup iface_wl_data_source
2501 */
2502#define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1
2503/**
2504 * @ingroup iface_wl_data_source
2505 */
2506#define WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION 3
2507/**
2508 * @ingroup iface_wl_data_source
2509 */
2510#define WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION 3
2511/**
2512 * @ingroup iface_wl_data_source
2513 */
2514#define WL_DATA_SOURCE_ACTION_SINCE_VERSION 3
2515
2516/**
2517 * @ingroup iface_wl_data_source
2518 */
2519#define WL_DATA_SOURCE_OFFER_SINCE_VERSION 1
2520/**
2521 * @ingroup iface_wl_data_source
2522 */
2523#define WL_DATA_SOURCE_DESTROY_SINCE_VERSION 1
2524/**
2525 * @ingroup iface_wl_data_source
2526 */
2527#define WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION 3
2528
2529/** @ingroup iface_wl_data_source */
2530static inline void
2531wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_data)
2532{
2533 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_data_source, user_data);
2534}
2535
2536/** @ingroup iface_wl_data_source */
2537static inline void *
2538wl_data_source_get_user_data(struct wl_data_source *wl_data_source)
2539{
2540 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_data_source);
2541}
2542
2543static inline uint32_t
2544wl_data_source_get_version(struct wl_data_source *wl_data_source)
2545{
2546 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_source);
2547}
2548
2549/**
2550 * @ingroup iface_wl_data_source
2551 *
2552 * This request adds a mime type to the set of mime types
2553 * advertised to targets. Can be called several times to offer
2554 * multiple types.
2555 */
2556static inline void
2557wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_type)
2558{
2559 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_source,
2560 WL_DATA_SOURCE_OFFER, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_source), flags: 0, mime_type);
2561}
2562
2563/**
2564 * @ingroup iface_wl_data_source
2565 *
2566 * Destroy the data source.
2567 */
2568static inline void
2569wl_data_source_destroy(struct wl_data_source *wl_data_source)
2570{
2571 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_source,
2572 WL_DATA_SOURCE_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_source), WL_MARSHAL_FLAG_DESTROY);
2573}
2574
2575/**
2576 * @ingroup iface_wl_data_source
2577 *
2578 * Sets the actions that the source side client supports for this
2579 * operation. This request may trigger wl_data_source.action and
2580 * wl_data_offer.action events if the compositor needs to change the
2581 * selected action.
2582 *
2583 * The dnd_actions argument must contain only values expressed in the
2584 * wl_data_device_manager.dnd_actions enum, otherwise it will result
2585 * in a protocol error.
2586 *
2587 * This request must be made once only, and can only be made on sources
2588 * used in drag-and-drop, so it must be performed before
2589 * wl_data_device.start_drag. Attempting to use the source other than
2590 * for drag-and-drop will raise a protocol error.
2591 */
2592static inline void
2593wl_data_source_set_actions(struct wl_data_source *wl_data_source, uint32_t dnd_actions)
2594{
2595 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_source,
2596 WL_DATA_SOURCE_SET_ACTIONS, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_source), flags: 0, dnd_actions);
2597}
2598
2599#ifndef WL_DATA_DEVICE_ERROR_ENUM
2600#define WL_DATA_DEVICE_ERROR_ENUM
2601enum wl_data_device_error {
2602 /**
2603 * given wl_surface has another role
2604 */
2605 WL_DATA_DEVICE_ERROR_ROLE = 0,
2606};
2607#endif /* WL_DATA_DEVICE_ERROR_ENUM */
2608
2609/**
2610 * @ingroup iface_wl_data_device
2611 * @struct wl_data_device_listener
2612 */
2613struct wl_data_device_listener {
2614 /**
2615 * introduce a new wl_data_offer
2616 *
2617 * The data_offer event introduces a new wl_data_offer object,
2618 * which will subsequently be used in either the data_device.enter
2619 * event (for drag-and-drop) or the data_device.selection event
2620 * (for selections). Immediately following the
2621 * data_device.data_offer event, the new data_offer object will
2622 * send out data_offer.offer events to describe the mime types it
2623 * offers.
2624 * @param id the new data_offer object
2625 */
2626 void (*data_offer)(void *data,
2627 struct wl_data_device *wl_data_device,
2628 struct wl_data_offer *id);
2629 /**
2630 * initiate drag-and-drop session
2631 *
2632 * This event is sent when an active drag-and-drop pointer enters
2633 * a surface owned by the client. The position of the pointer at
2634 * enter time is provided by the x and y arguments, in
2635 * surface-local coordinates.
2636 * @param serial serial number of the enter event
2637 * @param surface client surface entered
2638 * @param x surface-local x coordinate
2639 * @param y surface-local y coordinate
2640 * @param id source data_offer object
2641 */
2642 void (*enter)(void *data,
2643 struct wl_data_device *wl_data_device,
2644 uint32_t serial,
2645 struct wl_surface *surface,
2646 wl_fixed_t x,
2647 wl_fixed_t y,
2648 struct wl_data_offer *id);
2649 /**
2650 * end drag-and-drop session
2651 *
2652 * This event is sent when the drag-and-drop pointer leaves the
2653 * surface and the session ends. The client must destroy the
2654 * wl_data_offer introduced at enter time at this point.
2655 */
2656 void (*leave)(void *data,
2657 struct wl_data_device *wl_data_device);
2658 /**
2659 * drag-and-drop session motion
2660 *
2661 * This event is sent when the drag-and-drop pointer moves within
2662 * the currently focused surface. The new position of the pointer
2663 * is provided by the x and y arguments, in surface-local
2664 * coordinates.
2665 * @param time timestamp with millisecond granularity
2666 * @param x surface-local x coordinate
2667 * @param y surface-local y coordinate
2668 */
2669 void (*motion)(void *data,
2670 struct wl_data_device *wl_data_device,
2671 uint32_t time,
2672 wl_fixed_t x,
2673 wl_fixed_t y);
2674 /**
2675 * end drag-and-drop session successfully
2676 *
2677 * The event is sent when a drag-and-drop operation is ended
2678 * because the implicit grab is removed.
2679 *
2680 * The drag-and-drop destination is expected to honor the last
2681 * action received through wl_data_offer.action, if the resulting
2682 * action is "copy" or "move", the destination can still perform
2683 * wl_data_offer.receive requests, and is expected to end all
2684 * transfers with a wl_data_offer.finish request.
2685 *
2686 * If the resulting action is "ask", the action will not be
2687 * considered final. The drag-and-drop destination is expected to
2688 * perform one last wl_data_offer.set_actions request, or
2689 * wl_data_offer.destroy in order to cancel the operation.
2690 */
2691 void (*drop)(void *data,
2692 struct wl_data_device *wl_data_device);
2693 /**
2694 * advertise new selection
2695 *
2696 * The selection event is sent out to notify the client of a new
2697 * wl_data_offer for the selection for this device. The
2698 * data_device.data_offer and the data_offer.offer events are sent
2699 * out immediately before this event to introduce the data offer
2700 * object. The selection event is sent to a client immediately
2701 * before receiving keyboard focus and when a new selection is set
2702 * while the client has keyboard focus. The data_offer is valid
2703 * until a new data_offer or NULL is received or until the client
2704 * loses keyboard focus. Switching surface with keyboard focus
2705 * within the same client doesn't mean a new selection will be
2706 * sent. The client must destroy the previous selection data_offer,
2707 * if any, upon receiving this event.
2708 * @param id selection data_offer object
2709 */
2710 void (*selection)(void *data,
2711 struct wl_data_device *wl_data_device,
2712 struct wl_data_offer *id);
2713};
2714
2715/**
2716 * @ingroup iface_wl_data_device
2717 */
2718static inline int
2719wl_data_device_add_listener(struct wl_data_device *wl_data_device,
2720 const struct wl_data_device_listener *listener, void *data)
2721{
2722 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_data_device,
2723 implementation: (void (**)(void)) listener, data);
2724}
2725
2726#define WL_DATA_DEVICE_START_DRAG 0
2727#define WL_DATA_DEVICE_SET_SELECTION 1
2728#define WL_DATA_DEVICE_RELEASE 2
2729
2730/**
2731 * @ingroup iface_wl_data_device
2732 */
2733#define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1
2734/**
2735 * @ingroup iface_wl_data_device
2736 */
2737#define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1
2738/**
2739 * @ingroup iface_wl_data_device
2740 */
2741#define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1
2742/**
2743 * @ingroup iface_wl_data_device
2744 */
2745#define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1
2746/**
2747 * @ingroup iface_wl_data_device
2748 */
2749#define WL_DATA_DEVICE_DROP_SINCE_VERSION 1
2750/**
2751 * @ingroup iface_wl_data_device
2752 */
2753#define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1
2754
2755/**
2756 * @ingroup iface_wl_data_device
2757 */
2758#define WL_DATA_DEVICE_START_DRAG_SINCE_VERSION 1
2759/**
2760 * @ingroup iface_wl_data_device
2761 */
2762#define WL_DATA_DEVICE_SET_SELECTION_SINCE_VERSION 1
2763/**
2764 * @ingroup iface_wl_data_device
2765 */
2766#define WL_DATA_DEVICE_RELEASE_SINCE_VERSION 2
2767
2768/** @ingroup iface_wl_data_device */
2769static inline void
2770wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_data)
2771{
2772 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_data_device, user_data);
2773}
2774
2775/** @ingroup iface_wl_data_device */
2776static inline void *
2777wl_data_device_get_user_data(struct wl_data_device *wl_data_device)
2778{
2779 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_data_device);
2780}
2781
2782static inline uint32_t
2783wl_data_device_get_version(struct wl_data_device *wl_data_device)
2784{
2785 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device);
2786}
2787
2788/** @ingroup iface_wl_data_device */
2789static inline void
2790wl_data_device_destroy(struct wl_data_device *wl_data_device)
2791{
2792 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_data_device);
2793}
2794
2795/**
2796 * @ingroup iface_wl_data_device
2797 *
2798 * This request asks the compositor to start a drag-and-drop
2799 * operation on behalf of the client.
2800 *
2801 * The source argument is the data source that provides the data
2802 * for the eventual data transfer. If source is NULL, enter, leave
2803 * and motion events are sent only to the client that initiated the
2804 * drag and the client is expected to handle the data passing
2805 * internally. If source is destroyed, the drag-and-drop session will be
2806 * cancelled.
2807 *
2808 * The origin surface is the surface where the drag originates and
2809 * the client must have an active implicit grab that matches the
2810 * serial.
2811 *
2812 * The icon surface is an optional (can be NULL) surface that
2813 * provides an icon to be moved around with the cursor. Initially,
2814 * the top-left corner of the icon surface is placed at the cursor
2815 * hotspot, but subsequent wl_surface.attach request can move the
2816 * relative position. Attach requests must be confirmed with
2817 * wl_surface.commit as usual. The icon surface is given the role of
2818 * a drag-and-drop icon. If the icon surface already has another role,
2819 * it raises a protocol error.
2820 *
2821 * The input region is ignored for wl_surfaces with the role of a
2822 * drag-and-drop icon.
2823 */
2824static inline void
2825wl_data_device_start_drag(struct wl_data_device *wl_data_device, struct wl_data_source *source, struct wl_surface *origin, struct wl_surface *icon, uint32_t serial)
2826{
2827 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_device,
2828 WL_DATA_DEVICE_START_DRAG, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device), flags: 0, source, origin, icon, serial);
2829}
2830
2831/**
2832 * @ingroup iface_wl_data_device
2833 *
2834 * This request asks the compositor to set the selection
2835 * to the data from the source on behalf of the client.
2836 *
2837 * To unset the selection, set the source to NULL.
2838 */
2839static inline void
2840wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_data_source *source, uint32_t serial)
2841{
2842 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_device,
2843 WL_DATA_DEVICE_SET_SELECTION, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device), flags: 0, source, serial);
2844}
2845
2846/**
2847 * @ingroup iface_wl_data_device
2848 *
2849 * This request destroys the data device.
2850 */
2851static inline void
2852wl_data_device_release(struct wl_data_device *wl_data_device)
2853{
2854 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_device,
2855 WL_DATA_DEVICE_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device), WL_MARSHAL_FLAG_DESTROY);
2856}
2857
2858#ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2859#define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2860/**
2861 * @ingroup iface_wl_data_device_manager
2862 * drag and drop actions
2863 *
2864 * This is a bitmask of the available/preferred actions in a
2865 * drag-and-drop operation.
2866 *
2867 * In the compositor, the selected action is a result of matching the
2868 * actions offered by the source and destination sides. "action" events
2869 * with a "none" action will be sent to both source and destination if
2870 * there is no match. All further checks will effectively happen on
2871 * (source actions ∩ destination actions).
2872 *
2873 * In addition, compositors may also pick different actions in
2874 * reaction to key modifiers being pressed. One common design that
2875 * is used in major toolkits (and the behavior recommended for
2876 * compositors) is:
2877 *
2878 * - If no modifiers are pressed, the first match (in bit order)
2879 * will be used.
2880 * - Pressing Shift selects "move", if enabled in the mask.
2881 * - Pressing Control selects "copy", if enabled in the mask.
2882 *
2883 * Behavior beyond that is considered implementation-dependent.
2884 * Compositors may for example bind other modifiers (like Alt/Meta)
2885 * or drags initiated with other buttons than BTN_LEFT to specific
2886 * actions (e.g. "ask").
2887 */
2888enum wl_data_device_manager_dnd_action {
2889 /**
2890 * no action
2891 */
2892 WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
2893 /**
2894 * copy action
2895 */
2896 WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
2897 /**
2898 * move action
2899 */
2900 WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
2901 /**
2902 * ask action
2903 */
2904 WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
2905};
2906#endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
2907
2908#define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0
2909#define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1
2910
2911
2912/**
2913 * @ingroup iface_wl_data_device_manager
2914 */
2915#define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE_SINCE_VERSION 1
2916/**
2917 * @ingroup iface_wl_data_device_manager
2918 */
2919#define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE_SINCE_VERSION 1
2920
2921/** @ingroup iface_wl_data_device_manager */
2922static inline void
2923wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_device_manager, void *user_data)
2924{
2925 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_data_device_manager, user_data);
2926}
2927
2928/** @ingroup iface_wl_data_device_manager */
2929static inline void *
2930wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_device_manager)
2931{
2932 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_data_device_manager);
2933}
2934
2935static inline uint32_t
2936wl_data_device_manager_get_version(struct wl_data_device_manager *wl_data_device_manager)
2937{
2938 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device_manager);
2939}
2940
2941/** @ingroup iface_wl_data_device_manager */
2942static inline void
2943wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_manager)
2944{
2945 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_data_device_manager);
2946}
2947
2948/**
2949 * @ingroup iface_wl_data_device_manager
2950 *
2951 * Create a new data source.
2952 */
2953static inline struct wl_data_source *
2954wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data_device_manager)
2955{
2956 struct wl_proxy *id;
2957
2958 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_device_manager,
2959 WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, interface: &wl_data_source_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device_manager), flags: 0, NULL);
2960
2961 return (struct wl_data_source *) id;
2962}
2963
2964/**
2965 * @ingroup iface_wl_data_device_manager
2966 *
2967 * Create a new data device for a given seat.
2968 */
2969static inline struct wl_data_device *
2970wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_device_manager, struct wl_seat *seat)
2971{
2972 struct wl_proxy *id;
2973
2974 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_data_device_manager,
2975 WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, interface: &wl_data_device_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_data_device_manager), flags: 0, NULL, seat);
2976
2977 return (struct wl_data_device *) id;
2978}
2979
2980#ifndef WL_SHELL_ERROR_ENUM
2981#define WL_SHELL_ERROR_ENUM
2982enum wl_shell_error {
2983 /**
2984 * given wl_surface has another role
2985 */
2986 WL_SHELL_ERROR_ROLE = 0,
2987};
2988#endif /* WL_SHELL_ERROR_ENUM */
2989
2990#define WL_SHELL_GET_SHELL_SURFACE 0
2991
2992
2993/**
2994 * @ingroup iface_wl_shell
2995 */
2996#define WL_SHELL_GET_SHELL_SURFACE_SINCE_VERSION 1
2997
2998/** @ingroup iface_wl_shell */
2999static inline void
3000wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data)
3001{
3002 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_shell, user_data);
3003}
3004
3005/** @ingroup iface_wl_shell */
3006static inline void *
3007wl_shell_get_user_data(struct wl_shell *wl_shell)
3008{
3009 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_shell);
3010}
3011
3012static inline uint32_t
3013wl_shell_get_version(struct wl_shell *wl_shell)
3014{
3015 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell);
3016}
3017
3018/** @ingroup iface_wl_shell */
3019static inline void
3020wl_shell_destroy(struct wl_shell *wl_shell)
3021{
3022 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_shell);
3023}
3024
3025/**
3026 * @ingroup iface_wl_shell
3027 *
3028 * Create a shell surface for an existing surface. This gives
3029 * the wl_surface the role of a shell surface. If the wl_surface
3030 * already has another role, it raises a protocol error.
3031 *
3032 * Only one shell surface can be associated with a given surface.
3033 */
3034static inline struct wl_shell_surface *
3035wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
3036{
3037 struct wl_proxy *id;
3038
3039 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell,
3040 WL_SHELL_GET_SHELL_SURFACE, interface: &wl_shell_surface_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell), flags: 0, NULL, surface);
3041
3042 return (struct wl_shell_surface *) id;
3043}
3044
3045#ifndef WL_SHELL_SURFACE_RESIZE_ENUM
3046#define WL_SHELL_SURFACE_RESIZE_ENUM
3047/**
3048 * @ingroup iface_wl_shell_surface
3049 * edge values for resizing
3050 *
3051 * These values are used to indicate which edge of a surface
3052 * is being dragged in a resize operation. The server may
3053 * use this information to adapt its behavior, e.g. choose
3054 * an appropriate cursor image.
3055 */
3056enum wl_shell_surface_resize {
3057 /**
3058 * no edge
3059 */
3060 WL_SHELL_SURFACE_RESIZE_NONE = 0,
3061 /**
3062 * top edge
3063 */
3064 WL_SHELL_SURFACE_RESIZE_TOP = 1,
3065 /**
3066 * bottom edge
3067 */
3068 WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
3069 /**
3070 * left edge
3071 */
3072 WL_SHELL_SURFACE_RESIZE_LEFT = 4,
3073 /**
3074 * top and left edges
3075 */
3076 WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
3077 /**
3078 * bottom and left edges
3079 */
3080 WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
3081 /**
3082 * right edge
3083 */
3084 WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
3085 /**
3086 * top and right edges
3087 */
3088 WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
3089 /**
3090 * bottom and right edges
3091 */
3092 WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
3093};
3094#endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
3095
3096#ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
3097#define WL_SHELL_SURFACE_TRANSIENT_ENUM
3098/**
3099 * @ingroup iface_wl_shell_surface
3100 * details of transient behaviour
3101 *
3102 * These flags specify details of the expected behaviour
3103 * of transient surfaces. Used in the set_transient request.
3104 */
3105enum wl_shell_surface_transient {
3106 /**
3107 * do not set keyboard focus
3108 */
3109 WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
3110};
3111#endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
3112
3113#ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
3114#define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
3115/**
3116 * @ingroup iface_wl_shell_surface
3117 * different method to set the surface fullscreen
3118 *
3119 * Hints to indicate to the compositor how to deal with a conflict
3120 * between the dimensions of the surface and the dimensions of the
3121 * output. The compositor is free to ignore this parameter.
3122 */
3123enum wl_shell_surface_fullscreen_method {
3124 /**
3125 * no preference, apply default policy
3126 */
3127 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
3128 /**
3129 * scale, preserve the surface's aspect ratio and center on output
3130 */
3131 WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
3132 /**
3133 * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
3134 */
3135 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
3136 /**
3137 * no upscaling, center on output and add black borders to compensate size mismatch
3138 */
3139 WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
3140};
3141#endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
3142
3143/**
3144 * @ingroup iface_wl_shell_surface
3145 * @struct wl_shell_surface_listener
3146 */
3147struct wl_shell_surface_listener {
3148 /**
3149 * ping client
3150 *
3151 * Ping a client to check if it is receiving events and sending
3152 * requests. A client is expected to reply with a pong request.
3153 * @param serial serial number of the ping
3154 */
3155 void (*ping)(void *data,
3156 struct wl_shell_surface *wl_shell_surface,
3157 uint32_t serial);
3158 /**
3159 * suggest resize
3160 *
3161 * The configure event asks the client to resize its surface.
3162 *
3163 * The size is a hint, in the sense that the client is free to
3164 * ignore it if it doesn't resize, pick a smaller size (to satisfy
3165 * aspect ratio or resize in steps of NxM pixels).
3166 *
3167 * The edges parameter provides a hint about how the surface was
3168 * resized. The client may use this information to decide how to
3169 * adjust its content to the new size (e.g. a scrolling area might
3170 * adjust its content position to leave the viewable content
3171 * unmoved).
3172 *
3173 * The client is free to dismiss all but the last configure event
3174 * it received.
3175 *
3176 * The width and height arguments specify the size of the window in
3177 * surface-local coordinates.
3178 * @param edges how the surface was resized
3179 * @param width new width of the surface
3180 * @param height new height of the surface
3181 */
3182 void (*configure)(void *data,
3183 struct wl_shell_surface *wl_shell_surface,
3184 uint32_t edges,
3185 int32_t width,
3186 int32_t height);
3187 /**
3188 * popup interaction is done
3189 *
3190 * The popup_done event is sent out when a popup grab is broken,
3191 * that is, when the user clicks a surface that doesn't belong to
3192 * the client owning the popup surface.
3193 */
3194 void (*popup_done)(void *data,
3195 struct wl_shell_surface *wl_shell_surface);
3196};
3197
3198/**
3199 * @ingroup iface_wl_shell_surface
3200 */
3201static inline int
3202wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface,
3203 const struct wl_shell_surface_listener *listener, void *data)
3204{
3205 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_shell_surface,
3206 implementation: (void (**)(void)) listener, data);
3207}
3208
3209#define WL_SHELL_SURFACE_PONG 0
3210#define WL_SHELL_SURFACE_MOVE 1
3211#define WL_SHELL_SURFACE_RESIZE 2
3212#define WL_SHELL_SURFACE_SET_TOPLEVEL 3
3213#define WL_SHELL_SURFACE_SET_TRANSIENT 4
3214#define WL_SHELL_SURFACE_SET_FULLSCREEN 5
3215#define WL_SHELL_SURFACE_SET_POPUP 6
3216#define WL_SHELL_SURFACE_SET_MAXIMIZED 7
3217#define WL_SHELL_SURFACE_SET_TITLE 8
3218#define WL_SHELL_SURFACE_SET_CLASS 9
3219
3220/**
3221 * @ingroup iface_wl_shell_surface
3222 */
3223#define WL_SHELL_SURFACE_PING_SINCE_VERSION 1
3224/**
3225 * @ingroup iface_wl_shell_surface
3226 */
3227#define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1
3228/**
3229 * @ingroup iface_wl_shell_surface
3230 */
3231#define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1
3232
3233/**
3234 * @ingroup iface_wl_shell_surface
3235 */
3236#define WL_SHELL_SURFACE_PONG_SINCE_VERSION 1
3237/**
3238 * @ingroup iface_wl_shell_surface
3239 */
3240#define WL_SHELL_SURFACE_MOVE_SINCE_VERSION 1
3241/**
3242 * @ingroup iface_wl_shell_surface
3243 */
3244#define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION 1
3245/**
3246 * @ingroup iface_wl_shell_surface
3247 */
3248#define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION 1
3249/**
3250 * @ingroup iface_wl_shell_surface
3251 */
3252#define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION 1
3253/**
3254 * @ingroup iface_wl_shell_surface
3255 */
3256#define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
3257/**
3258 * @ingroup iface_wl_shell_surface
3259 */
3260#define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION 1
3261/**
3262 * @ingroup iface_wl_shell_surface
3263 */
3264#define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
3265/**
3266 * @ingroup iface_wl_shell_surface
3267 */
3268#define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION 1
3269/**
3270 * @ingroup iface_wl_shell_surface
3271 */
3272#define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION 1
3273
3274/** @ingroup iface_wl_shell_surface */
3275static inline void
3276wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
3277{
3278 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_shell_surface, user_data);
3279}
3280
3281/** @ingroup iface_wl_shell_surface */
3282static inline void *
3283wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface)
3284{
3285 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_shell_surface);
3286}
3287
3288static inline uint32_t
3289wl_shell_surface_get_version(struct wl_shell_surface *wl_shell_surface)
3290{
3291 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface);
3292}
3293
3294/** @ingroup iface_wl_shell_surface */
3295static inline void
3296wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
3297{
3298 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_shell_surface);
3299}
3300
3301/**
3302 * @ingroup iface_wl_shell_surface
3303 *
3304 * A client must respond to a ping event with a pong request or
3305 * the client may be deemed unresponsive.
3306 */
3307static inline void
3308wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
3309{
3310 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3311 WL_SHELL_SURFACE_PONG, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, serial);
3312}
3313
3314/**
3315 * @ingroup iface_wl_shell_surface
3316 *
3317 * Start a pointer-driven move of the surface.
3318 *
3319 * This request must be used in response to a button press event.
3320 * The server may ignore move requests depending on the state of
3321 * the surface (e.g. fullscreen or maximized).
3322 */
3323static inline void
3324wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
3325{
3326 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3327 WL_SHELL_SURFACE_MOVE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, seat, serial);
3328}
3329
3330/**
3331 * @ingroup iface_wl_shell_surface
3332 *
3333 * Start a pointer-driven resizing of the surface.
3334 *
3335 * This request must be used in response to a button press event.
3336 * The server may ignore resize requests depending on the state of
3337 * the surface (e.g. fullscreen or maximized).
3338 */
3339static inline void
3340wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
3341{
3342 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3343 WL_SHELL_SURFACE_RESIZE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, seat, serial, edges);
3344}
3345
3346/**
3347 * @ingroup iface_wl_shell_surface
3348 *
3349 * Map the surface as a toplevel surface.
3350 *
3351 * A toplevel surface is not fullscreen, maximized or transient.
3352 */
3353static inline void
3354wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
3355{
3356 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3357 WL_SHELL_SURFACE_SET_TOPLEVEL, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0);
3358}
3359
3360/**
3361 * @ingroup iface_wl_shell_surface
3362 *
3363 * Map the surface relative to an existing surface.
3364 *
3365 * The x and y arguments specify the location of the upper left
3366 * corner of the surface relative to the upper left corner of the
3367 * parent surface, in surface-local coordinates.
3368 *
3369 * The flags argument controls details of the transient behaviour.
3370 */
3371static inline void
3372wl_shell_surface_set_transient(struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
3373{
3374 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3375 WL_SHELL_SURFACE_SET_TRANSIENT, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, parent, x, y, flags);
3376}
3377
3378/**
3379 * @ingroup iface_wl_shell_surface
3380 *
3381 * Map the surface as a fullscreen surface.
3382 *
3383 * If an output parameter is given then the surface will be made
3384 * fullscreen on that output. If the client does not specify the
3385 * output then the compositor will apply its policy - usually
3386 * choosing the output on which the surface has the biggest surface
3387 * area.
3388 *
3389 * The client may specify a method to resolve a size conflict
3390 * between the output size and the surface size - this is provided
3391 * through the method parameter.
3392 *
3393 * The framerate parameter is used only when the method is set
3394 * to "driver", to indicate the preferred framerate. A value of 0
3395 * indicates that the client does not care about framerate. The
3396 * framerate is specified in mHz, that is framerate of 60000 is 60Hz.
3397 *
3398 * A method of "scale" or "driver" implies a scaling operation of
3399 * the surface, either via a direct scaling operation or a change of
3400 * the output mode. This will override any kind of output scaling, so
3401 * that mapping a surface with a buffer size equal to the mode can
3402 * fill the screen independent of buffer_scale.
3403 *
3404 * A method of "fill" means we don't scale up the buffer, however
3405 * any output scale is applied. This means that you may run into
3406 * an edge case where the application maps a buffer with the same
3407 * size of the output mode but buffer_scale 1 (thus making a
3408 * surface larger than the output). In this case it is allowed to
3409 * downscale the results to fit the screen.
3410 *
3411 * The compositor must reply to this request with a configure event
3412 * with the dimensions for the output on which the surface will
3413 * be made fullscreen.
3414 */
3415static inline void
3416wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
3417{
3418 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3419 WL_SHELL_SURFACE_SET_FULLSCREEN, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, method, framerate, output);
3420}
3421
3422/**
3423 * @ingroup iface_wl_shell_surface
3424 *
3425 * Map the surface as a popup.
3426 *
3427 * A popup surface is a transient surface with an added pointer
3428 * grab.
3429 *
3430 * An existing implicit grab will be changed to owner-events mode,
3431 * and the popup grab will continue after the implicit grab ends
3432 * (i.e. releasing the mouse button does not cause the popup to
3433 * be unmapped).
3434 *
3435 * The popup grab continues until the window is destroyed or a
3436 * mouse button is pressed in any other client's window. A click
3437 * in any of the client's surfaces is reported as normal, however,
3438 * clicks in other clients' surfaces will be discarded and trigger
3439 * the callback.
3440 *
3441 * The x and y arguments specify the location of the upper left
3442 * corner of the surface relative to the upper left corner of the
3443 * parent surface, in surface-local coordinates.
3444 */
3445static inline void
3446wl_shell_surface_set_popup(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
3447{
3448 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3449 WL_SHELL_SURFACE_SET_POPUP, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, seat, serial, parent, x, y, flags);
3450}
3451
3452/**
3453 * @ingroup iface_wl_shell_surface
3454 *
3455 * Map the surface as a maximized surface.
3456 *
3457 * If an output parameter is given then the surface will be
3458 * maximized on that output. If the client does not specify the
3459 * output then the compositor will apply its policy - usually
3460 * choosing the output on which the surface has the biggest surface
3461 * area.
3462 *
3463 * The compositor will reply with a configure event telling
3464 * the expected new surface size. The operation is completed
3465 * on the next buffer attach to this surface.
3466 *
3467 * A maximized surface typically fills the entire output it is
3468 * bound to, except for desktop elements such as panels. This is
3469 * the main difference between a maximized shell surface and a
3470 * fullscreen shell surface.
3471 *
3472 * The details depend on the compositor implementation.
3473 */
3474static inline void
3475wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
3476{
3477 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3478 WL_SHELL_SURFACE_SET_MAXIMIZED, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, output);
3479}
3480
3481/**
3482 * @ingroup iface_wl_shell_surface
3483 *
3484 * Set a short title for the surface.
3485 *
3486 * This string may be used to identify the surface in a task bar,
3487 * window list, or other user interface elements provided by the
3488 * compositor.
3489 *
3490 * The string must be encoded in UTF-8.
3491 */
3492static inline void
3493wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
3494{
3495 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3496 WL_SHELL_SURFACE_SET_TITLE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, title);
3497}
3498
3499/**
3500 * @ingroup iface_wl_shell_surface
3501 *
3502 * Set a class for the surface.
3503 *
3504 * The surface class identifies the general class of applications
3505 * to which the surface belongs. A common convention is to use the
3506 * file name (or the full path if it is a non-standard location) of
3507 * the application's .desktop file as the class.
3508 */
3509static inline void
3510wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
3511{
3512 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_shell_surface,
3513 WL_SHELL_SURFACE_SET_CLASS, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_shell_surface), flags: 0, class_);
3514}
3515
3516#ifndef WL_SURFACE_ERROR_ENUM
3517#define WL_SURFACE_ERROR_ENUM
3518/**
3519 * @ingroup iface_wl_surface
3520 * wl_surface error values
3521 *
3522 * These errors can be emitted in response to wl_surface requests.
3523 */
3524enum wl_surface_error {
3525 /**
3526 * buffer scale value is invalid
3527 */
3528 WL_SURFACE_ERROR_INVALID_SCALE = 0,
3529 /**
3530 * buffer transform value is invalid
3531 */
3532 WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
3533 /**
3534 * buffer size is invalid
3535 */
3536 WL_SURFACE_ERROR_INVALID_SIZE = 2,
3537 /**
3538 * buffer offset is invalid
3539 */
3540 WL_SURFACE_ERROR_INVALID_OFFSET = 3,
3541 /**
3542 * surface was destroyed before its role object
3543 */
3544 WL_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 4,
3545};
3546#endif /* WL_SURFACE_ERROR_ENUM */
3547
3548/**
3549 * @ingroup iface_wl_surface
3550 * @struct wl_surface_listener
3551 */
3552struct wl_surface_listener {
3553 /**
3554 * surface enters an output
3555 *
3556 * This is emitted whenever a surface's creation, movement, or
3557 * resizing results in some part of it being within the scanout
3558 * region of an output.
3559 *
3560 * Note that a surface may be overlapping with zero or more
3561 * outputs.
3562 * @param output output entered by the surface
3563 */
3564 void (*enter)(void *data,
3565 struct wl_surface *wl_surface,
3566 struct wl_output *output);
3567 /**
3568 * surface leaves an output
3569 *
3570 * This is emitted whenever a surface's creation, movement, or
3571 * resizing results in it no longer having any part of it within
3572 * the scanout region of an output.
3573 *
3574 * Clients should not use the number of outputs the surface is on
3575 * for frame throttling purposes. The surface might be hidden even
3576 * if no leave event has been sent, and the compositor might expect
3577 * new surface content updates even if no enter event has been
3578 * sent. The frame event should be used instead.
3579 * @param output output left by the surface
3580 */
3581 void (*leave)(void *data,
3582 struct wl_surface *wl_surface,
3583 struct wl_output *output);
3584 /**
3585 * preferred buffer scale for the surface
3586 *
3587 * This event indicates the preferred buffer scale for this
3588 * surface. It is sent whenever the compositor's preference
3589 * changes.
3590 *
3591 * It is intended that scaling aware clients use this event to
3592 * scale their content and use wl_surface.set_buffer_scale to
3593 * indicate the scale they have rendered with. This allows clients
3594 * to supply a higher detail buffer.
3595 * @param factor preferred scaling factor
3596 * @since 6
3597 */
3598 void (*preferred_buffer_scale)(void *data,
3599 struct wl_surface *wl_surface,
3600 int32_t factor);
3601 /**
3602 * preferred buffer transform for the surface
3603 *
3604 * This event indicates the preferred buffer transform for this
3605 * surface. It is sent whenever the compositor's preference
3606 * changes.
3607 *
3608 * It is intended that transform aware clients use this event to
3609 * apply the transform to their content and use
3610 * wl_surface.set_buffer_transform to indicate the transform they
3611 * have rendered with.
3612 * @param transform preferred transform
3613 * @since 6
3614 */
3615 void (*preferred_buffer_transform)(void *data,
3616 struct wl_surface *wl_surface,
3617 uint32_t transform);
3618};
3619
3620/**
3621 * @ingroup iface_wl_surface
3622 */
3623static inline int
3624wl_surface_add_listener(struct wl_surface *wl_surface,
3625 const struct wl_surface_listener *listener, void *data)
3626{
3627 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_surface,
3628 implementation: (void (**)(void)) listener, data);
3629}
3630
3631#define WL_SURFACE_DESTROY 0
3632#define WL_SURFACE_ATTACH 1
3633#define WL_SURFACE_DAMAGE 2
3634#define WL_SURFACE_FRAME 3
3635#define WL_SURFACE_SET_OPAQUE_REGION 4
3636#define WL_SURFACE_SET_INPUT_REGION 5
3637#define WL_SURFACE_COMMIT 6
3638#define WL_SURFACE_SET_BUFFER_TRANSFORM 7
3639#define WL_SURFACE_SET_BUFFER_SCALE 8
3640#define WL_SURFACE_DAMAGE_BUFFER 9
3641#define WL_SURFACE_OFFSET 10
3642
3643/**
3644 * @ingroup iface_wl_surface
3645 */
3646#define WL_SURFACE_ENTER_SINCE_VERSION 1
3647/**
3648 * @ingroup iface_wl_surface
3649 */
3650#define WL_SURFACE_LEAVE_SINCE_VERSION 1
3651/**
3652 * @ingroup iface_wl_surface
3653 */
3654#define WL_SURFACE_PREFERRED_BUFFER_SCALE_SINCE_VERSION 6
3655/**
3656 * @ingroup iface_wl_surface
3657 */
3658#define WL_SURFACE_PREFERRED_BUFFER_TRANSFORM_SINCE_VERSION 6
3659
3660/**
3661 * @ingroup iface_wl_surface
3662 */
3663#define WL_SURFACE_DESTROY_SINCE_VERSION 1
3664/**
3665 * @ingroup iface_wl_surface
3666 */
3667#define WL_SURFACE_ATTACH_SINCE_VERSION 1
3668/**
3669 * @ingroup iface_wl_surface
3670 */
3671#define WL_SURFACE_DAMAGE_SINCE_VERSION 1
3672/**
3673 * @ingroup iface_wl_surface
3674 */
3675#define WL_SURFACE_FRAME_SINCE_VERSION 1
3676/**
3677 * @ingroup iface_wl_surface
3678 */
3679#define WL_SURFACE_SET_OPAQUE_REGION_SINCE_VERSION 1
3680/**
3681 * @ingroup iface_wl_surface
3682 */
3683#define WL_SURFACE_SET_INPUT_REGION_SINCE_VERSION 1
3684/**
3685 * @ingroup iface_wl_surface
3686 */
3687#define WL_SURFACE_COMMIT_SINCE_VERSION 1
3688/**
3689 * @ingroup iface_wl_surface
3690 */
3691#define WL_SURFACE_SET_BUFFER_TRANSFORM_SINCE_VERSION 2
3692/**
3693 * @ingroup iface_wl_surface
3694 */
3695#define WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION 3
3696/**
3697 * @ingroup iface_wl_surface
3698 */
3699#define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION 4
3700/**
3701 * @ingroup iface_wl_surface
3702 */
3703#define WL_SURFACE_OFFSET_SINCE_VERSION 5
3704
3705/** @ingroup iface_wl_surface */
3706static inline void
3707wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
3708{
3709 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_surface, user_data);
3710}
3711
3712/** @ingroup iface_wl_surface */
3713static inline void *
3714wl_surface_get_user_data(struct wl_surface *wl_surface)
3715{
3716 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_surface);
3717}
3718
3719static inline uint32_t
3720wl_surface_get_version(struct wl_surface *wl_surface)
3721{
3722 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface);
3723}
3724
3725/**
3726 * @ingroup iface_wl_surface
3727 *
3728 * Deletes the surface and invalidates its object ID.
3729 */
3730static inline void
3731wl_surface_destroy(struct wl_surface *wl_surface)
3732{
3733 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3734 WL_SURFACE_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), WL_MARSHAL_FLAG_DESTROY);
3735}
3736
3737/**
3738 * @ingroup iface_wl_surface
3739 *
3740 * Set a buffer as the content of this surface.
3741 *
3742 * The new size of the surface is calculated based on the buffer
3743 * size transformed by the inverse buffer_transform and the
3744 * inverse buffer_scale. This means that at commit time the supplied
3745 * buffer size must be an integer multiple of the buffer_scale. If
3746 * that's not the case, an invalid_size error is sent.
3747 *
3748 * The x and y arguments specify the location of the new pending
3749 * buffer's upper left corner, relative to the current buffer's upper
3750 * left corner, in surface-local coordinates. In other words, the
3751 * x and y, combined with the new surface size define in which
3752 * directions the surface's size changes. Setting anything other than 0
3753 * as x and y arguments is discouraged, and should instead be replaced
3754 * with using the separate wl_surface.offset request.
3755 *
3756 * When the bound wl_surface version is 5 or higher, passing any
3757 * non-zero x or y is a protocol violation, and will result in an
3758 * 'invalid_offset' error being raised. The x and y arguments are ignored
3759 * and do not change the pending state. To achieve equivalent semantics,
3760 * use wl_surface.offset.
3761 *
3762 * Surface contents are double-buffered state, see wl_surface.commit.
3763 *
3764 * The initial surface contents are void; there is no content.
3765 * wl_surface.attach assigns the given wl_buffer as the pending
3766 * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
3767 * surface contents, and the size of the surface becomes the size
3768 * calculated from the wl_buffer, as described above. After commit,
3769 * there is no pending buffer until the next attach.
3770 *
3771 * Committing a pending wl_buffer allows the compositor to read the
3772 * pixels in the wl_buffer. The compositor may access the pixels at
3773 * any time after the wl_surface.commit request. When the compositor
3774 * will not access the pixels anymore, it will send the
3775 * wl_buffer.release event. Only after receiving wl_buffer.release,
3776 * the client may reuse the wl_buffer. A wl_buffer that has been
3777 * attached and then replaced by another attach instead of committed
3778 * will not receive a release event, and is not used by the
3779 * compositor.
3780 *
3781 * If a pending wl_buffer has been committed to more than one wl_surface,
3782 * the delivery of wl_buffer.release events becomes undefined. A well
3783 * behaved client should not rely on wl_buffer.release events in this
3784 * case. Alternatively, a client could create multiple wl_buffer objects
3785 * from the same backing storage or use wp_linux_buffer_release.
3786 *
3787 * Destroying the wl_buffer after wl_buffer.release does not change
3788 * the surface contents. Destroying the wl_buffer before wl_buffer.release
3789 * is allowed as long as the underlying buffer storage isn't re-used (this
3790 * can happen e.g. on client process termination). However, if the client
3791 * destroys the wl_buffer before receiving the wl_buffer.release event and
3792 * mutates the underlying buffer storage, the surface contents become
3793 * undefined immediately.
3794 *
3795 * If wl_surface.attach is sent with a NULL wl_buffer, the
3796 * following wl_surface.commit will remove the surface content.
3797 */
3798static inline void
3799wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
3800{
3801 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3802 WL_SURFACE_ATTACH, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, buffer, x, y);
3803}
3804
3805/**
3806 * @ingroup iface_wl_surface
3807 *
3808 * This request is used to describe the regions where the pending
3809 * buffer is different from the current surface contents, and where
3810 * the surface therefore needs to be repainted. The compositor
3811 * ignores the parts of the damage that fall outside of the surface.
3812 *
3813 * Damage is double-buffered state, see wl_surface.commit.
3814 *
3815 * The damage rectangle is specified in surface-local coordinates,
3816 * where x and y specify the upper left corner of the damage rectangle.
3817 *
3818 * The initial value for pending damage is empty: no damage.
3819 * wl_surface.damage adds pending damage: the new pending damage
3820 * is the union of old pending damage and the given rectangle.
3821 *
3822 * wl_surface.commit assigns pending damage as the current damage,
3823 * and clears pending damage. The server will clear the current
3824 * damage as it repaints the surface.
3825 *
3826 * Note! New clients should not use this request. Instead damage can be
3827 * posted with wl_surface.damage_buffer which uses buffer coordinates
3828 * instead of surface coordinates.
3829 */
3830static inline void
3831wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
3832{
3833 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3834 WL_SURFACE_DAMAGE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, x, y, width, height);
3835}
3836
3837/**
3838 * @ingroup iface_wl_surface
3839 *
3840 * Request a notification when it is a good time to start drawing a new
3841 * frame, by creating a frame callback. This is useful for throttling
3842 * redrawing operations, and driving animations.
3843 *
3844 * When a client is animating on a wl_surface, it can use the 'frame'
3845 * request to get notified when it is a good time to draw and commit the
3846 * next frame of animation. If the client commits an update earlier than
3847 * that, it is likely that some updates will not make it to the display,
3848 * and the client is wasting resources by drawing too often.
3849 *
3850 * The frame request will take effect on the next wl_surface.commit.
3851 * The notification will only be posted for one frame unless
3852 * requested again. For a wl_surface, the notifications are posted in
3853 * the order the frame requests were committed.
3854 *
3855 * The server must send the notifications so that a client
3856 * will not send excessive updates, while still allowing
3857 * the highest possible update rate for clients that wait for the reply
3858 * before drawing again. The server should give some time for the client
3859 * to draw and commit after sending the frame callback events to let it
3860 * hit the next output refresh.
3861 *
3862 * A server should avoid signaling the frame callbacks if the
3863 * surface is not visible in any way, e.g. the surface is off-screen,
3864 * or completely obscured by other opaque surfaces.
3865 *
3866 * The object returned by this request will be destroyed by the
3867 * compositor after the callback is fired and as such the client must not
3868 * attempt to use it after that point.
3869 *
3870 * The callback_data passed in the callback is the current time, in
3871 * milliseconds, with an undefined base.
3872 */
3873static inline struct wl_callback *
3874wl_surface_frame(struct wl_surface *wl_surface)
3875{
3876 struct wl_proxy *callback;
3877
3878 callback = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3879 WL_SURFACE_FRAME, interface: &wl_callback_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, NULL);
3880
3881 return (struct wl_callback *) callback;
3882}
3883
3884/**
3885 * @ingroup iface_wl_surface
3886 *
3887 * This request sets the region of the surface that contains
3888 * opaque content.
3889 *
3890 * The opaque region is an optimization hint for the compositor
3891 * that lets it optimize the redrawing of content behind opaque
3892 * regions. Setting an opaque region is not required for correct
3893 * behaviour, but marking transparent content as opaque will result
3894 * in repaint artifacts.
3895 *
3896 * The opaque region is specified in surface-local coordinates.
3897 *
3898 * The compositor ignores the parts of the opaque region that fall
3899 * outside of the surface.
3900 *
3901 * Opaque region is double-buffered state, see wl_surface.commit.
3902 *
3903 * wl_surface.set_opaque_region changes the pending opaque region.
3904 * wl_surface.commit copies the pending region to the current region.
3905 * Otherwise, the pending and current regions are never changed.
3906 *
3907 * The initial value for an opaque region is empty. Setting the pending
3908 * opaque region has copy semantics, and the wl_region object can be
3909 * destroyed immediately. A NULL wl_region causes the pending opaque
3910 * region to be set to empty.
3911 */
3912static inline void
3913wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
3914{
3915 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3916 WL_SURFACE_SET_OPAQUE_REGION, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, region);
3917}
3918
3919/**
3920 * @ingroup iface_wl_surface
3921 *
3922 * This request sets the region of the surface that can receive
3923 * pointer and touch events.
3924 *
3925 * Input events happening outside of this region will try the next
3926 * surface in the server surface stack. The compositor ignores the
3927 * parts of the input region that fall outside of the surface.
3928 *
3929 * The input region is specified in surface-local coordinates.
3930 *
3931 * Input region is double-buffered state, see wl_surface.commit.
3932 *
3933 * wl_surface.set_input_region changes the pending input region.
3934 * wl_surface.commit copies the pending region to the current region.
3935 * Otherwise the pending and current regions are never changed,
3936 * except cursor and icon surfaces are special cases, see
3937 * wl_pointer.set_cursor and wl_data_device.start_drag.
3938 *
3939 * The initial value for an input region is infinite. That means the
3940 * whole surface will accept input. Setting the pending input region
3941 * has copy semantics, and the wl_region object can be destroyed
3942 * immediately. A NULL wl_region causes the input region to be set
3943 * to infinite.
3944 */
3945static inline void
3946wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *region)
3947{
3948 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3949 WL_SURFACE_SET_INPUT_REGION, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, region);
3950}
3951
3952/**
3953 * @ingroup iface_wl_surface
3954 *
3955 * Surface state (input, opaque, and damage regions, attached buffers,
3956 * etc.) is double-buffered. Protocol requests modify the pending state,
3957 * as opposed to the current state in use by the compositor. A commit
3958 * request atomically applies all pending state, replacing the current
3959 * state. After commit, the new pending state is as documented for each
3960 * related request.
3961 *
3962 * On commit, a pending wl_buffer is applied first, and all other state
3963 * second. This means that all coordinates in double-buffered state are
3964 * relative to the new wl_buffer coming into use, except for
3965 * wl_surface.attach itself. If there is no pending wl_buffer, the
3966 * coordinates are relative to the current surface contents.
3967 *
3968 * All requests that need a commit to become effective are documented
3969 * to affect double-buffered state.
3970 *
3971 * Other interfaces may add further double-buffered surface state.
3972 */
3973static inline void
3974wl_surface_commit(struct wl_surface *wl_surface)
3975{
3976 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
3977 WL_SURFACE_COMMIT, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0);
3978}
3979
3980/**
3981 * @ingroup iface_wl_surface
3982 *
3983 * This request sets an optional transformation on how the compositor
3984 * interprets the contents of the buffer attached to the surface. The
3985 * accepted values for the transform parameter are the values for
3986 * wl_output.transform.
3987 *
3988 * Buffer transform is double-buffered state, see wl_surface.commit.
3989 *
3990 * A newly created surface has its buffer transformation set to normal.
3991 *
3992 * wl_surface.set_buffer_transform changes the pending buffer
3993 * transformation. wl_surface.commit copies the pending buffer
3994 * transformation to the current one. Otherwise, the pending and current
3995 * values are never changed.
3996 *
3997 * The purpose of this request is to allow clients to render content
3998 * according to the output transform, thus permitting the compositor to
3999 * use certain optimizations even if the display is rotated. Using
4000 * hardware overlays and scanning out a client buffer for fullscreen
4001 * surfaces are examples of such optimizations. Those optimizations are
4002 * highly dependent on the compositor implementation, so the use of this
4003 * request should be considered on a case-by-case basis.
4004 *
4005 * Note that if the transform value includes 90 or 270 degree rotation,
4006 * the width of the buffer will become the surface height and the height
4007 * of the buffer will become the surface width.
4008 *
4009 * If transform is not one of the values from the
4010 * wl_output.transform enum the invalid_transform protocol error
4011 * is raised.
4012 */
4013static inline void
4014wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform)
4015{
4016 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
4017 WL_SURFACE_SET_BUFFER_TRANSFORM, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, transform);
4018}
4019
4020/**
4021 * @ingroup iface_wl_surface
4022 *
4023 * This request sets an optional scaling factor on how the compositor
4024 * interprets the contents of the buffer attached to the window.
4025 *
4026 * Buffer scale is double-buffered state, see wl_surface.commit.
4027 *
4028 * A newly created surface has its buffer scale set to 1.
4029 *
4030 * wl_surface.set_buffer_scale changes the pending buffer scale.
4031 * wl_surface.commit copies the pending buffer scale to the current one.
4032 * Otherwise, the pending and current values are never changed.
4033 *
4034 * The purpose of this request is to allow clients to supply higher
4035 * resolution buffer data for use on high resolution outputs. It is
4036 * intended that you pick the same buffer scale as the scale of the
4037 * output that the surface is displayed on. This means the compositor
4038 * can avoid scaling when rendering the surface on that output.
4039 *
4040 * Note that if the scale is larger than 1, then you have to attach
4041 * a buffer that is larger (by a factor of scale in each dimension)
4042 * than the desired surface size.
4043 *
4044 * If scale is not positive the invalid_scale protocol error is
4045 * raised.
4046 */
4047static inline void
4048wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
4049{
4050 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
4051 WL_SURFACE_SET_BUFFER_SCALE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, scale);
4052}
4053
4054/**
4055 * @ingroup iface_wl_surface
4056 *
4057 * This request is used to describe the regions where the pending
4058 * buffer is different from the current surface contents, and where
4059 * the surface therefore needs to be repainted. The compositor
4060 * ignores the parts of the damage that fall outside of the surface.
4061 *
4062 * Damage is double-buffered state, see wl_surface.commit.
4063 *
4064 * The damage rectangle is specified in buffer coordinates,
4065 * where x and y specify the upper left corner of the damage rectangle.
4066 *
4067 * The initial value for pending damage is empty: no damage.
4068 * wl_surface.damage_buffer adds pending damage: the new pending
4069 * damage is the union of old pending damage and the given rectangle.
4070 *
4071 * wl_surface.commit assigns pending damage as the current damage,
4072 * and clears pending damage. The server will clear the current
4073 * damage as it repaints the surface.
4074 *
4075 * This request differs from wl_surface.damage in only one way - it
4076 * takes damage in buffer coordinates instead of surface-local
4077 * coordinates. While this generally is more intuitive than surface
4078 * coordinates, it is especially desirable when using wp_viewport
4079 * or when a drawing library (like EGL) is unaware of buffer scale
4080 * and buffer transform.
4081 *
4082 * Note: Because buffer transformation changes and damage requests may
4083 * be interleaved in the protocol stream, it is impossible to determine
4084 * the actual mapping between surface and buffer damage until
4085 * wl_surface.commit time. Therefore, compositors wishing to take both
4086 * kinds of damage into account will have to accumulate damage from the
4087 * two requests separately and only transform from one to the other
4088 * after receiving the wl_surface.commit.
4089 */
4090static inline void
4091wl_surface_damage_buffer(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
4092{
4093 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
4094 WL_SURFACE_DAMAGE_BUFFER, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, x, y, width, height);
4095}
4096
4097/**
4098 * @ingroup iface_wl_surface
4099 *
4100 * The x and y arguments specify the location of the new pending
4101 * buffer's upper left corner, relative to the current buffer's upper
4102 * left corner, in surface-local coordinates. In other words, the
4103 * x and y, combined with the new surface size define in which
4104 * directions the surface's size changes.
4105 *
4106 * Surface location offset is double-buffered state, see
4107 * wl_surface.commit.
4108 *
4109 * This request is semantically equivalent to and the replaces the x and y
4110 * arguments in the wl_surface.attach request in wl_surface versions prior
4111 * to 5. See wl_surface.attach for details.
4112 */
4113static inline void
4114wl_surface_offset(struct wl_surface *wl_surface, int32_t x, int32_t y)
4115{
4116 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_surface,
4117 WL_SURFACE_OFFSET, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_surface), flags: 0, x, y);
4118}
4119
4120#ifndef WL_SEAT_CAPABILITY_ENUM
4121#define WL_SEAT_CAPABILITY_ENUM
4122/**
4123 * @ingroup iface_wl_seat
4124 * seat capability bitmask
4125 *
4126 * This is a bitmask of capabilities this seat has; if a member is
4127 * set, then it is present on the seat.
4128 */
4129enum wl_seat_capability {
4130 /**
4131 * the seat has pointer devices
4132 */
4133 WL_SEAT_CAPABILITY_POINTER = 1,
4134 /**
4135 * the seat has one or more keyboards
4136 */
4137 WL_SEAT_CAPABILITY_KEYBOARD = 2,
4138 /**
4139 * the seat has touch devices
4140 */
4141 WL_SEAT_CAPABILITY_TOUCH = 4,
4142};
4143#endif /* WL_SEAT_CAPABILITY_ENUM */
4144
4145#ifndef WL_SEAT_ERROR_ENUM
4146#define WL_SEAT_ERROR_ENUM
4147/**
4148 * @ingroup iface_wl_seat
4149 * wl_seat error values
4150 *
4151 * These errors can be emitted in response to wl_seat requests.
4152 */
4153enum wl_seat_error {
4154 /**
4155 * get_pointer, get_keyboard or get_touch called on seat without the matching capability
4156 */
4157 WL_SEAT_ERROR_MISSING_CAPABILITY = 0,
4158};
4159#endif /* WL_SEAT_ERROR_ENUM */
4160
4161/**
4162 * @ingroup iface_wl_seat
4163 * @struct wl_seat_listener
4164 */
4165struct wl_seat_listener {
4166 /**
4167 * seat capabilities changed
4168 *
4169 * This is emitted whenever a seat gains or loses the pointer,
4170 * keyboard or touch capabilities. The argument is a capability
4171 * enum containing the complete set of capabilities this seat has.
4172 *
4173 * When the pointer capability is added, a client may create a
4174 * wl_pointer object using the wl_seat.get_pointer request. This
4175 * object will receive pointer events until the capability is
4176 * removed in the future.
4177 *
4178 * When the pointer capability is removed, a client should destroy
4179 * the wl_pointer objects associated with the seat where the
4180 * capability was removed, using the wl_pointer.release request. No
4181 * further pointer events will be received on these objects.
4182 *
4183 * In some compositors, if a seat regains the pointer capability
4184 * and a client has a previously obtained wl_pointer object of
4185 * version 4 or less, that object may start sending pointer events
4186 * again. This behavior is considered a misinterpretation of the
4187 * intended behavior and must not be relied upon by the client.
4188 * wl_pointer objects of version 5 or later must not send events if
4189 * created before the most recent event notifying the client of an
4190 * added pointer capability.
4191 *
4192 * The above behavior also applies to wl_keyboard and wl_touch with
4193 * the keyboard and touch capabilities, respectively.
4194 * @param capabilities capabilities of the seat
4195 */
4196 void (*capabilities)(void *data,
4197 struct wl_seat *wl_seat,
4198 uint32_t capabilities);
4199 /**
4200 * unique identifier for this seat
4201 *
4202 * In a multi-seat configuration the seat name can be used by
4203 * clients to help identify which physical devices the seat
4204 * represents.
4205 *
4206 * The seat name is a UTF-8 string with no convention defined for
4207 * its contents. Each name is unique among all wl_seat globals. The
4208 * name is only guaranteed to be unique for the current compositor
4209 * instance.
4210 *
4211 * The same seat names are used for all clients. Thus, the name can
4212 * be shared across processes to refer to a specific wl_seat
4213 * global.
4214 *
4215 * The name event is sent after binding to the seat global. This
4216 * event is only sent once per seat object, and the name does not
4217 * change over the lifetime of the wl_seat global.
4218 *
4219 * Compositors may re-use the same seat name if the wl_seat global
4220 * is destroyed and re-created later.
4221 * @param name seat identifier
4222 * @since 2
4223 */
4224 void (*name)(void *data,
4225 struct wl_seat *wl_seat,
4226 const char *name);
4227};
4228
4229/**
4230 * @ingroup iface_wl_seat
4231 */
4232static inline int
4233wl_seat_add_listener(struct wl_seat *wl_seat,
4234 const struct wl_seat_listener *listener, void *data)
4235{
4236 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_seat,
4237 implementation: (void (**)(void)) listener, data);
4238}
4239
4240#define WL_SEAT_GET_POINTER 0
4241#define WL_SEAT_GET_KEYBOARD 1
4242#define WL_SEAT_GET_TOUCH 2
4243#define WL_SEAT_RELEASE 3
4244
4245/**
4246 * @ingroup iface_wl_seat
4247 */
4248#define WL_SEAT_CAPABILITIES_SINCE_VERSION 1
4249/**
4250 * @ingroup iface_wl_seat
4251 */
4252#define WL_SEAT_NAME_SINCE_VERSION 2
4253
4254/**
4255 * @ingroup iface_wl_seat
4256 */
4257#define WL_SEAT_GET_POINTER_SINCE_VERSION 1
4258/**
4259 * @ingroup iface_wl_seat
4260 */
4261#define WL_SEAT_GET_KEYBOARD_SINCE_VERSION 1
4262/**
4263 * @ingroup iface_wl_seat
4264 */
4265#define WL_SEAT_GET_TOUCH_SINCE_VERSION 1
4266/**
4267 * @ingroup iface_wl_seat
4268 */
4269#define WL_SEAT_RELEASE_SINCE_VERSION 5
4270
4271/** @ingroup iface_wl_seat */
4272static inline void
4273wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data)
4274{
4275 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_seat, user_data);
4276}
4277
4278/** @ingroup iface_wl_seat */
4279static inline void *
4280wl_seat_get_user_data(struct wl_seat *wl_seat)
4281{
4282 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_seat);
4283}
4284
4285static inline uint32_t
4286wl_seat_get_version(struct wl_seat *wl_seat)
4287{
4288 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_seat);
4289}
4290
4291/** @ingroup iface_wl_seat */
4292static inline void
4293wl_seat_destroy(struct wl_seat *wl_seat)
4294{
4295 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_seat);
4296}
4297
4298/**
4299 * @ingroup iface_wl_seat
4300 *
4301 * The ID provided will be initialized to the wl_pointer interface
4302 * for this seat.
4303 *
4304 * This request only takes effect if the seat has the pointer
4305 * capability, or has had the pointer capability in the past.
4306 * It is a protocol violation to issue this request on a seat that has
4307 * never had the pointer capability. The missing_capability error will
4308 * be sent in this case.
4309 */
4310static inline struct wl_pointer *
4311wl_seat_get_pointer(struct wl_seat *wl_seat)
4312{
4313 struct wl_proxy *id;
4314
4315 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_seat,
4316 WL_SEAT_GET_POINTER, interface: &wl_pointer_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_seat), flags: 0, NULL);
4317
4318 return (struct wl_pointer *) id;
4319}
4320
4321/**
4322 * @ingroup iface_wl_seat
4323 *
4324 * The ID provided will be initialized to the wl_keyboard interface
4325 * for this seat.
4326 *
4327 * This request only takes effect if the seat has the keyboard
4328 * capability, or has had the keyboard capability in the past.
4329 * It is a protocol violation to issue this request on a seat that has
4330 * never had the keyboard capability. The missing_capability error will
4331 * be sent in this case.
4332 */
4333static inline struct wl_keyboard *
4334wl_seat_get_keyboard(struct wl_seat *wl_seat)
4335{
4336 struct wl_proxy *id;
4337
4338 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_seat,
4339 WL_SEAT_GET_KEYBOARD, interface: &wl_keyboard_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_seat), flags: 0, NULL);
4340
4341 return (struct wl_keyboard *) id;
4342}
4343
4344/**
4345 * @ingroup iface_wl_seat
4346 *
4347 * The ID provided will be initialized to the wl_touch interface
4348 * for this seat.
4349 *
4350 * This request only takes effect if the seat has the touch
4351 * capability, or has had the touch capability in the past.
4352 * It is a protocol violation to issue this request on a seat that has
4353 * never had the touch capability. The missing_capability error will
4354 * be sent in this case.
4355 */
4356static inline struct wl_touch *
4357wl_seat_get_touch(struct wl_seat *wl_seat)
4358{
4359 struct wl_proxy *id;
4360
4361 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_seat,
4362 WL_SEAT_GET_TOUCH, interface: &wl_touch_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_seat), flags: 0, NULL);
4363
4364 return (struct wl_touch *) id;
4365}
4366
4367/**
4368 * @ingroup iface_wl_seat
4369 *
4370 * Using this request a client can tell the server that it is not going to
4371 * use the seat object anymore.
4372 */
4373static inline void
4374wl_seat_release(struct wl_seat *wl_seat)
4375{
4376 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_seat,
4377 WL_SEAT_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_seat), WL_MARSHAL_FLAG_DESTROY);
4378}
4379
4380#ifndef WL_POINTER_ERROR_ENUM
4381#define WL_POINTER_ERROR_ENUM
4382enum wl_pointer_error {
4383 /**
4384 * given wl_surface has another role
4385 */
4386 WL_POINTER_ERROR_ROLE = 0,
4387};
4388#endif /* WL_POINTER_ERROR_ENUM */
4389
4390#ifndef WL_POINTER_BUTTON_STATE_ENUM
4391#define WL_POINTER_BUTTON_STATE_ENUM
4392/**
4393 * @ingroup iface_wl_pointer
4394 * physical button state
4395 *
4396 * Describes the physical state of a button that produced the button
4397 * event.
4398 */
4399enum wl_pointer_button_state {
4400 /**
4401 * the button is not pressed
4402 */
4403 WL_POINTER_BUTTON_STATE_RELEASED = 0,
4404 /**
4405 * the button is pressed
4406 */
4407 WL_POINTER_BUTTON_STATE_PRESSED = 1,
4408};
4409#endif /* WL_POINTER_BUTTON_STATE_ENUM */
4410
4411#ifndef WL_POINTER_AXIS_ENUM
4412#define WL_POINTER_AXIS_ENUM
4413/**
4414 * @ingroup iface_wl_pointer
4415 * axis types
4416 *
4417 * Describes the axis types of scroll events.
4418 */
4419enum wl_pointer_axis {
4420 /**
4421 * vertical axis
4422 */
4423 WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
4424 /**
4425 * horizontal axis
4426 */
4427 WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
4428};
4429#endif /* WL_POINTER_AXIS_ENUM */
4430
4431#ifndef WL_POINTER_AXIS_SOURCE_ENUM
4432#define WL_POINTER_AXIS_SOURCE_ENUM
4433/**
4434 * @ingroup iface_wl_pointer
4435 * axis source types
4436 *
4437 * Describes the source types for axis events. This indicates to the
4438 * client how an axis event was physically generated; a client may
4439 * adjust the user interface accordingly. For example, scroll events
4440 * from a "finger" source may be in a smooth coordinate space with
4441 * kinetic scrolling whereas a "wheel" source may be in discrete steps
4442 * of a number of lines.
4443 *
4444 * The "continuous" axis source is a device generating events in a
4445 * continuous coordinate space, but using something other than a
4446 * finger. One example for this source is button-based scrolling where
4447 * the vertical motion of a device is converted to scroll events while
4448 * a button is held down.
4449 *
4450 * The "wheel tilt" axis source indicates that the actual device is a
4451 * wheel but the scroll event is not caused by a rotation but a
4452 * (usually sideways) tilt of the wheel.
4453 */
4454enum wl_pointer_axis_source {
4455 /**
4456 * a physical wheel rotation
4457 */
4458 WL_POINTER_AXIS_SOURCE_WHEEL = 0,
4459 /**
4460 * finger on a touch surface
4461 */
4462 WL_POINTER_AXIS_SOURCE_FINGER = 1,
4463 /**
4464 * continuous coordinate space
4465 */
4466 WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
4467 /**
4468 * a physical wheel tilt
4469 * @since 6
4470 */
4471 WL_POINTER_AXIS_SOURCE_WHEEL_TILT = 3,
4472};
4473/**
4474 * @ingroup iface_wl_pointer
4475 */
4476#define WL_POINTER_AXIS_SOURCE_WHEEL_TILT_SINCE_VERSION 6
4477#endif /* WL_POINTER_AXIS_SOURCE_ENUM */
4478
4479#ifndef WL_POINTER_AXIS_RELATIVE_DIRECTION_ENUM
4480#define WL_POINTER_AXIS_RELATIVE_DIRECTION_ENUM
4481/**
4482 * @ingroup iface_wl_pointer
4483 * axis relative direction
4484 *
4485 * This specifies the direction of the physical motion that caused a
4486 * wl_pointer.axis event, relative to the wl_pointer.axis direction.
4487 */
4488enum wl_pointer_axis_relative_direction {
4489 /**
4490 * physical motion matches axis direction
4491 */
4492 WL_POINTER_AXIS_RELATIVE_DIRECTION_IDENTICAL = 0,
4493 /**
4494 * physical motion is the inverse of the axis direction
4495 */
4496 WL_POINTER_AXIS_RELATIVE_DIRECTION_INVERTED = 1,
4497};
4498#endif /* WL_POINTER_AXIS_RELATIVE_DIRECTION_ENUM */
4499
4500/**
4501 * @ingroup iface_wl_pointer
4502 * @struct wl_pointer_listener
4503 */
4504struct wl_pointer_listener {
4505 /**
4506 * enter event
4507 *
4508 * Notification that this seat's pointer is focused on a certain
4509 * surface.
4510 *
4511 * When a seat's focus enters a surface, the pointer image is
4512 * undefined and a client should respond to this event by setting
4513 * an appropriate pointer image with the set_cursor request.
4514 * @param serial serial number of the enter event
4515 * @param surface surface entered by the pointer
4516 * @param surface_x surface-local x coordinate
4517 * @param surface_y surface-local y coordinate
4518 */
4519 void (*enter)(void *data,
4520 struct wl_pointer *wl_pointer,
4521 uint32_t serial,
4522 struct wl_surface *surface,
4523 wl_fixed_t surface_x,
4524 wl_fixed_t surface_y);
4525 /**
4526 * leave event
4527 *
4528 * Notification that this seat's pointer is no longer focused on
4529 * a certain surface.
4530 *
4531 * The leave notification is sent before the enter notification for
4532 * the new focus.
4533 * @param serial serial number of the leave event
4534 * @param surface surface left by the pointer
4535 */
4536 void (*leave)(void *data,
4537 struct wl_pointer *wl_pointer,
4538 uint32_t serial,
4539 struct wl_surface *surface);
4540 /**
4541 * pointer motion event
4542 *
4543 * Notification of pointer location change. The arguments
4544 * surface_x and surface_y are the location relative to the focused
4545 * surface.
4546 * @param time timestamp with millisecond granularity
4547 * @param surface_x surface-local x coordinate
4548 * @param surface_y surface-local y coordinate
4549 */
4550 void (*motion)(void *data,
4551 struct wl_pointer *wl_pointer,
4552 uint32_t time,
4553 wl_fixed_t surface_x,
4554 wl_fixed_t surface_y);
4555 /**
4556 * pointer button event
4557 *
4558 * Mouse button click and release notifications.
4559 *
4560 * The location of the click is given by the last motion or enter
4561 * event. The time argument is a timestamp with millisecond
4562 * granularity, with an undefined base.
4563 *
4564 * The button is a button code as defined in the Linux kernel's
4565 * linux/input-event-codes.h header file, e.g. BTN_LEFT.
4566 *
4567 * Any 16-bit button code value is reserved for future additions to
4568 * the kernel's event code list. All other button codes above
4569 * 0xFFFF are currently undefined but may be used in future
4570 * versions of this protocol.
4571 * @param serial serial number of the button event
4572 * @param time timestamp with millisecond granularity
4573 * @param button button that produced the event
4574 * @param state physical state of the button
4575 */
4576 void (*button)(void *data,
4577 struct wl_pointer *wl_pointer,
4578 uint32_t serial,
4579 uint32_t time,
4580 uint32_t button,
4581 uint32_t state);
4582 /**
4583 * axis event
4584 *
4585 * Scroll and other axis notifications.
4586 *
4587 * For scroll events (vertical and horizontal scroll axes), the
4588 * value parameter is the length of a vector along the specified
4589 * axis in a coordinate space identical to those of motion events,
4590 * representing a relative movement along the specified axis.
4591 *
4592 * For devices that support movements non-parallel to axes multiple
4593 * axis events will be emitted.
4594 *
4595 * When applicable, for example for touch pads, the server can
4596 * choose to emit scroll events where the motion vector is
4597 * equivalent to a motion event vector.
4598 *
4599 * When applicable, a client can transform its content relative to
4600 * the scroll distance.
4601 * @param time timestamp with millisecond granularity
4602 * @param axis axis type
4603 * @param value length of vector in surface-local coordinate space
4604 */
4605 void (*axis)(void *data,
4606 struct wl_pointer *wl_pointer,
4607 uint32_t time,
4608 uint32_t axis,
4609 wl_fixed_t value);
4610 /**
4611 * end of a pointer event sequence
4612 *
4613 * Indicates the end of a set of events that logically belong
4614 * together. A client is expected to accumulate the data in all
4615 * events within the frame before proceeding.
4616 *
4617 * All wl_pointer events before a wl_pointer.frame event belong
4618 * logically together. For example, in a diagonal scroll motion the
4619 * compositor will send an optional wl_pointer.axis_source event,
4620 * two wl_pointer.axis events (horizontal and vertical) and finally
4621 * a wl_pointer.frame event. The client may use this information to
4622 * calculate a diagonal vector for scrolling.
4623 *
4624 * When multiple wl_pointer.axis events occur within the same
4625 * frame, the motion vector is the combined motion of all events.
4626 * When a wl_pointer.axis and a wl_pointer.axis_stop event occur
4627 * within the same frame, this indicates that axis movement in one
4628 * axis has stopped but continues in the other axis. When multiple
4629 * wl_pointer.axis_stop events occur within the same frame, this
4630 * indicates that these axes stopped in the same instance.
4631 *
4632 * A wl_pointer.frame event is sent for every logical event group,
4633 * even if the group only contains a single wl_pointer event.
4634 * Specifically, a client may get a sequence: motion, frame,
4635 * button, frame, axis, frame, axis_stop, frame.
4636 *
4637 * The wl_pointer.enter and wl_pointer.leave events are logical
4638 * events generated by the compositor and not the hardware. These
4639 * events are also grouped by a wl_pointer.frame. When a pointer
4640 * moves from one surface to another, a compositor should group the
4641 * wl_pointer.leave event within the same wl_pointer.frame.
4642 * However, a client must not rely on wl_pointer.leave and
4643 * wl_pointer.enter being in the same wl_pointer.frame.
4644 * Compositor-specific policies may require the wl_pointer.leave
4645 * and wl_pointer.enter event being split across multiple
4646 * wl_pointer.frame groups.
4647 * @since 5
4648 */
4649 void (*frame)(void *data,
4650 struct wl_pointer *wl_pointer);
4651 /**
4652 * axis source event
4653 *
4654 * Source information for scroll and other axes.
4655 *
4656 * This event does not occur on its own. It is sent before a
4657 * wl_pointer.frame event and carries the source information for
4658 * all events within that frame.
4659 *
4660 * The source specifies how this event was generated. If the source
4661 * is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event
4662 * will be sent when the user lifts the finger off the device.
4663 *
4664 * If the source is wl_pointer.axis_source.wheel,
4665 * wl_pointer.axis_source.wheel_tilt or
4666 * wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event
4667 * may or may not be sent. Whether a compositor sends an axis_stop
4668 * event for these sources is hardware-specific and
4669 * implementation-dependent; clients must not rely on receiving an
4670 * axis_stop event for these scroll sources and should treat scroll
4671 * sequences from these scroll sources as unterminated by default.
4672 *
4673 * This event is optional. If the source is unknown for a
4674 * particular axis event sequence, no event is sent. Only one
4675 * wl_pointer.axis_source event is permitted per frame.
4676 *
4677 * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
4678 * is not guaranteed.
4679 * @param axis_source source of the axis event
4680 * @since 5
4681 */
4682 void (*axis_source)(void *data,
4683 struct wl_pointer *wl_pointer,
4684 uint32_t axis_source);
4685 /**
4686 * axis stop event
4687 *
4688 * Stop notification for scroll and other axes.
4689 *
4690 * For some wl_pointer.axis_source types, a wl_pointer.axis_stop
4691 * event is sent to notify a client that the axis sequence has
4692 * terminated. This enables the client to implement kinetic
4693 * scrolling. See the wl_pointer.axis_source documentation for
4694 * information on when this event may be generated.
4695 *
4696 * Any wl_pointer.axis events with the same axis_source after this
4697 * event should be considered as the start of a new axis motion.
4698 *
4699 * The timestamp is to be interpreted identical to the timestamp in
4700 * the wl_pointer.axis event. The timestamp value may be the same
4701 * as a preceding wl_pointer.axis event.
4702 * @param time timestamp with millisecond granularity
4703 * @param axis the axis stopped with this event
4704 * @since 5
4705 */
4706 void (*axis_stop)(void *data,
4707 struct wl_pointer *wl_pointer,
4708 uint32_t time,
4709 uint32_t axis);
4710 /**
4711 * axis click event
4712 *
4713 * Discrete step information for scroll and other axes.
4714 *
4715 * This event carries the axis value of the wl_pointer.axis event
4716 * in discrete steps (e.g. mouse wheel clicks).
4717 *
4718 * This event is deprecated with wl_pointer version 8 - this event
4719 * is not sent to clients supporting version 8 or later.
4720 *
4721 * This event does not occur on its own, it is coupled with a
4722 * wl_pointer.axis event that represents this axis value on a
4723 * continuous scale. The protocol guarantees that each
4724 * axis_discrete event is always followed by exactly one axis event
4725 * with the same axis number within the same wl_pointer.frame. Note
4726 * that the protocol allows for other events to occur between the
4727 * axis_discrete and its coupled axis event, including other
4728 * axis_discrete or axis events. A wl_pointer.frame must not
4729 * contain more than one axis_discrete event per axis type.
4730 *
4731 * This event is optional; continuous scrolling devices like
4732 * two-finger scrolling on touchpads do not have discrete steps and
4733 * do not generate this event.
4734 *
4735 * The discrete value carries the directional information. e.g. a
4736 * value of -2 is two steps towards the negative direction of this
4737 * axis.
4738 *
4739 * The axis number is identical to the axis number in the
4740 * associated axis event.
4741 *
4742 * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
4743 * is not guaranteed.
4744 * @param axis axis type
4745 * @param discrete number of steps
4746 * @since 5
4747 */
4748 void (*axis_discrete)(void *data,
4749 struct wl_pointer *wl_pointer,
4750 uint32_t axis,
4751 int32_t discrete);
4752 /**
4753 * axis high-resolution scroll event
4754 *
4755 * Discrete high-resolution scroll information.
4756 *
4757 * This event carries high-resolution wheel scroll information,
4758 * with each multiple of 120 representing one logical scroll step
4759 * (a wheel detent). For example, an axis_value120 of 30 is one
4760 * quarter of a logical scroll step in the positive direction, a
4761 * value120 of -240 are two logical scroll steps in the negative
4762 * direction within the same hardware event. Clients that rely on
4763 * discrete scrolling should accumulate the value120 to multiples
4764 * of 120 before processing the event.
4765 *
4766 * The value120 must not be zero.
4767 *
4768 * This event replaces the wl_pointer.axis_discrete event in
4769 * clients supporting wl_pointer version 8 or later.
4770 *
4771 * Where a wl_pointer.axis_source event occurs in the same
4772 * wl_pointer.frame, the axis source applies to this event.
4773 *
4774 * The order of wl_pointer.axis_value120 and wl_pointer.axis_source
4775 * is not guaranteed.
4776 * @param axis axis type
4777 * @param value120 scroll distance as fraction of 120
4778 * @since 8
4779 */
4780 void (*axis_value120)(void *data,
4781 struct wl_pointer *wl_pointer,
4782 uint32_t axis,
4783 int32_t value120);
4784 /**
4785 * axis relative physical direction event
4786 *
4787 * Relative directional information of the entity causing the
4788 * axis motion.
4789 *
4790 * For a wl_pointer.axis event, the
4791 * wl_pointer.axis_relative_direction event specifies the movement
4792 * direction of the entity causing the wl_pointer.axis event. For
4793 * example: - if a user's fingers on a touchpad move down and this
4794 * causes a wl_pointer.axis vertical_scroll down event, the
4795 * physical direction is 'identical' - if a user's fingers on a
4796 * touchpad move down and this causes a wl_pointer.axis
4797 * vertical_scroll up scroll up event ('natural scrolling'), the
4798 * physical direction is 'inverted'.
4799 *
4800 * A client may use this information to adjust scroll motion of
4801 * components. Specifically, enabling natural scrolling causes the
4802 * content to change direction compared to traditional scrolling.
4803 * Some widgets like volume control sliders should usually match
4804 * the physical direction regardless of whether natural scrolling
4805 * is active. This event enables clients to match the scroll
4806 * direction of a widget to the physical direction.
4807 *
4808 * This event does not occur on its own, it is coupled with a
4809 * wl_pointer.axis event that represents this axis value. The
4810 * protocol guarantees that each axis_relative_direction event is
4811 * always followed by exactly one axis event with the same axis
4812 * number within the same wl_pointer.frame. Note that the protocol
4813 * allows for other events to occur between the
4814 * axis_relative_direction and its coupled axis event.
4815 *
4816 * The axis number is identical to the axis number in the
4817 * associated axis event.
4818 *
4819 * The order of wl_pointer.axis_relative_direction,
4820 * wl_pointer.axis_discrete and wl_pointer.axis_source is not
4821 * guaranteed.
4822 * @param axis axis type
4823 * @param direction physical direction relative to axis motion
4824 * @since 9
4825 */
4826 void (*axis_relative_direction)(void *data,
4827 struct wl_pointer *wl_pointer,
4828 uint32_t axis,
4829 uint32_t direction);
4830};
4831
4832/**
4833 * @ingroup iface_wl_pointer
4834 */
4835static inline int
4836wl_pointer_add_listener(struct wl_pointer *wl_pointer,
4837 const struct wl_pointer_listener *listener, void *data)
4838{
4839 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_pointer,
4840 implementation: (void (**)(void)) listener, data);
4841}
4842
4843#define WL_POINTER_SET_CURSOR 0
4844#define WL_POINTER_RELEASE 1
4845
4846/**
4847 * @ingroup iface_wl_pointer
4848 */
4849#define WL_POINTER_ENTER_SINCE_VERSION 1
4850/**
4851 * @ingroup iface_wl_pointer
4852 */
4853#define WL_POINTER_LEAVE_SINCE_VERSION 1
4854/**
4855 * @ingroup iface_wl_pointer
4856 */
4857#define WL_POINTER_MOTION_SINCE_VERSION 1
4858/**
4859 * @ingroup iface_wl_pointer
4860 */
4861#define WL_POINTER_BUTTON_SINCE_VERSION 1
4862/**
4863 * @ingroup iface_wl_pointer
4864 */
4865#define WL_POINTER_AXIS_SINCE_VERSION 1
4866/**
4867 * @ingroup iface_wl_pointer
4868 */
4869#define WL_POINTER_FRAME_SINCE_VERSION 5
4870/**
4871 * @ingroup iface_wl_pointer
4872 */
4873#define WL_POINTER_AXIS_SOURCE_SINCE_VERSION 5
4874/**
4875 * @ingroup iface_wl_pointer
4876 */
4877#define WL_POINTER_AXIS_STOP_SINCE_VERSION 5
4878/**
4879 * @ingroup iface_wl_pointer
4880 */
4881#define WL_POINTER_AXIS_DISCRETE_SINCE_VERSION 5
4882/**
4883 * @ingroup iface_wl_pointer
4884 */
4885#define WL_POINTER_AXIS_VALUE120_SINCE_VERSION 8
4886/**
4887 * @ingroup iface_wl_pointer
4888 */
4889#define WL_POINTER_AXIS_RELATIVE_DIRECTION_SINCE_VERSION 9
4890
4891/**
4892 * @ingroup iface_wl_pointer
4893 */
4894#define WL_POINTER_SET_CURSOR_SINCE_VERSION 1
4895/**
4896 * @ingroup iface_wl_pointer
4897 */
4898#define WL_POINTER_RELEASE_SINCE_VERSION 3
4899
4900/** @ingroup iface_wl_pointer */
4901static inline void
4902wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data)
4903{
4904 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_pointer, user_data);
4905}
4906
4907/** @ingroup iface_wl_pointer */
4908static inline void *
4909wl_pointer_get_user_data(struct wl_pointer *wl_pointer)
4910{
4911 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_pointer);
4912}
4913
4914static inline uint32_t
4915wl_pointer_get_version(struct wl_pointer *wl_pointer)
4916{
4917 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_pointer);
4918}
4919
4920/** @ingroup iface_wl_pointer */
4921static inline void
4922wl_pointer_destroy(struct wl_pointer *wl_pointer)
4923{
4924 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_pointer);
4925}
4926
4927/**
4928 * @ingroup iface_wl_pointer
4929 *
4930 * Set the pointer surface, i.e., the surface that contains the
4931 * pointer image (cursor). This request gives the surface the role
4932 * of a cursor. If the surface already has another role, it raises
4933 * a protocol error.
4934 *
4935 * The cursor actually changes only if the pointer
4936 * focus for this device is one of the requesting client's surfaces
4937 * or the surface parameter is the current pointer surface. If
4938 * there was a previous surface set with this request it is
4939 * replaced. If surface is NULL, the pointer image is hidden.
4940 *
4941 * The parameters hotspot_x and hotspot_y define the position of
4942 * the pointer surface relative to the pointer location. Its
4943 * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
4944 * where (x, y) are the coordinates of the pointer location, in
4945 * surface-local coordinates.
4946 *
4947 * On surface.attach requests to the pointer surface, hotspot_x
4948 * and hotspot_y are decremented by the x and y parameters
4949 * passed to the request. Attach must be confirmed by
4950 * wl_surface.commit as usual.
4951 *
4952 * The hotspot can also be updated by passing the currently set
4953 * pointer surface to this request with new values for hotspot_x
4954 * and hotspot_y.
4955 *
4956 * The input region is ignored for wl_surfaces with the role of
4957 * a cursor. When the use as a cursor ends, the wl_surface is
4958 * unmapped.
4959 *
4960 * The serial parameter must match the latest wl_pointer.enter
4961 * serial number sent to the client. Otherwise the request will be
4962 * ignored.
4963 */
4964static inline void
4965wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
4966{
4967 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_pointer,
4968 WL_POINTER_SET_CURSOR, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_pointer), flags: 0, serial, surface, hotspot_x, hotspot_y);
4969}
4970
4971/**
4972 * @ingroup iface_wl_pointer
4973 *
4974 * Using this request a client can tell the server that it is not going to
4975 * use the pointer object anymore.
4976 *
4977 * This request destroys the pointer proxy object, so clients must not call
4978 * wl_pointer_destroy() after using this request.
4979 */
4980static inline void
4981wl_pointer_release(struct wl_pointer *wl_pointer)
4982{
4983 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_pointer,
4984 WL_POINTER_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_pointer), WL_MARSHAL_FLAG_DESTROY);
4985}
4986
4987#ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
4988#define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
4989/**
4990 * @ingroup iface_wl_keyboard
4991 * keyboard mapping format
4992 *
4993 * This specifies the format of the keymap provided to the
4994 * client with the wl_keyboard.keymap event.
4995 */
4996enum wl_keyboard_keymap_format {
4997 /**
4998 * no keymap; client must understand how to interpret the raw keycode
4999 */
5000 WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
5001 /**
5002 * libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode
5003 */
5004 WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
5005};
5006#endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
5007
5008#ifndef WL_KEYBOARD_KEY_STATE_ENUM
5009#define WL_KEYBOARD_KEY_STATE_ENUM
5010/**
5011 * @ingroup iface_wl_keyboard
5012 * physical key state
5013 *
5014 * Describes the physical state of a key that produced the key event.
5015 */
5016enum wl_keyboard_key_state {
5017 /**
5018 * key is not pressed
5019 */
5020 WL_KEYBOARD_KEY_STATE_RELEASED = 0,
5021 /**
5022 * key is pressed
5023 */
5024 WL_KEYBOARD_KEY_STATE_PRESSED = 1,
5025};
5026#endif /* WL_KEYBOARD_KEY_STATE_ENUM */
5027
5028/**
5029 * @ingroup iface_wl_keyboard
5030 * @struct wl_keyboard_listener
5031 */
5032struct wl_keyboard_listener {
5033 /**
5034 * keyboard mapping
5035 *
5036 * This event provides a file descriptor to the client which can
5037 * be memory-mapped in read-only mode to provide a keyboard mapping
5038 * description.
5039 *
5040 * From version 7 onwards, the fd must be mapped with MAP_PRIVATE
5041 * by the recipient, as MAP_SHARED may fail.
5042 * @param format keymap format
5043 * @param fd keymap file descriptor
5044 * @param size keymap size, in bytes
5045 */
5046 void (*keymap)(void *data,
5047 struct wl_keyboard *wl_keyboard,
5048 uint32_t format,
5049 int32_t fd,
5050 uint32_t size);
5051 /**
5052 * enter event
5053 *
5054 * Notification that this seat's keyboard focus is on a certain
5055 * surface.
5056 *
5057 * The compositor must send the wl_keyboard.modifiers event after
5058 * this event.
5059 * @param serial serial number of the enter event
5060 * @param surface surface gaining keyboard focus
5061 * @param keys the currently pressed keys
5062 */
5063 void (*enter)(void *data,
5064 struct wl_keyboard *wl_keyboard,
5065 uint32_t serial,
5066 struct wl_surface *surface,
5067 struct wl_array *keys);
5068 /**
5069 * leave event
5070 *
5071 * Notification that this seat's keyboard focus is no longer on a
5072 * certain surface.
5073 *
5074 * The leave notification is sent before the enter notification for
5075 * the new focus.
5076 *
5077 * After this event client must assume that all keys, including
5078 * modifiers, are lifted and also it must stop key repeating if
5079 * there's some going on.
5080 * @param serial serial number of the leave event
5081 * @param surface surface that lost keyboard focus
5082 */
5083 void (*leave)(void *data,
5084 struct wl_keyboard *wl_keyboard,
5085 uint32_t serial,
5086 struct wl_surface *surface);
5087 /**
5088 * key event
5089 *
5090 * A key was pressed or released. The time argument is a
5091 * timestamp with millisecond granularity, with an undefined base.
5092 *
5093 * The key is a platform-specific key code that can be interpreted
5094 * by feeding it to the keyboard mapping (see the keymap event).
5095 *
5096 * If this event produces a change in modifiers, then the resulting
5097 * wl_keyboard.modifiers event must be sent after this event.
5098 * @param serial serial number of the key event
5099 * @param time timestamp with millisecond granularity
5100 * @param key key that produced the event
5101 * @param state physical state of the key
5102 */
5103 void (*key)(void *data,
5104 struct wl_keyboard *wl_keyboard,
5105 uint32_t serial,
5106 uint32_t time,
5107 uint32_t key,
5108 uint32_t state);
5109 /**
5110 * modifier and group state
5111 *
5112 * Notifies clients that the modifier and/or group state has
5113 * changed, and it should update its local state.
5114 * @param serial serial number of the modifiers event
5115 * @param mods_depressed depressed modifiers
5116 * @param mods_latched latched modifiers
5117 * @param mods_locked locked modifiers
5118 * @param group keyboard layout
5119 */
5120 void (*modifiers)(void *data,
5121 struct wl_keyboard *wl_keyboard,
5122 uint32_t serial,
5123 uint32_t mods_depressed,
5124 uint32_t mods_latched,
5125 uint32_t mods_locked,
5126 uint32_t group);
5127 /**
5128 * repeat rate and delay
5129 *
5130 * Informs the client about the keyboard's repeat rate and delay.
5131 *
5132 * This event is sent as soon as the wl_keyboard object has been
5133 * created, and is guaranteed to be received by the client before
5134 * any key press event.
5135 *
5136 * Negative values for either rate or delay are illegal. A rate of
5137 * zero will disable any repeating (regardless of the value of
5138 * delay).
5139 *
5140 * This event can be sent later on as well with a new value if
5141 * necessary, so clients should continue listening for the event
5142 * past the creation of wl_keyboard.
5143 * @param rate the rate of repeating keys in characters per second
5144 * @param delay delay in milliseconds since key down until repeating starts
5145 * @since 4
5146 */
5147 void (*repeat_info)(void *data,
5148 struct wl_keyboard *wl_keyboard,
5149 int32_t rate,
5150 int32_t delay);
5151};
5152
5153/**
5154 * @ingroup iface_wl_keyboard
5155 */
5156static inline int
5157wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard,
5158 const struct wl_keyboard_listener *listener, void *data)
5159{
5160 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_keyboard,
5161 implementation: (void (**)(void)) listener, data);
5162}
5163
5164#define WL_KEYBOARD_RELEASE 0
5165
5166/**
5167 * @ingroup iface_wl_keyboard
5168 */
5169#define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1
5170/**
5171 * @ingroup iface_wl_keyboard
5172 */
5173#define WL_KEYBOARD_ENTER_SINCE_VERSION 1
5174/**
5175 * @ingroup iface_wl_keyboard
5176 */
5177#define WL_KEYBOARD_LEAVE_SINCE_VERSION 1
5178/**
5179 * @ingroup iface_wl_keyboard
5180 */
5181#define WL_KEYBOARD_KEY_SINCE_VERSION 1
5182/**
5183 * @ingroup iface_wl_keyboard
5184 */
5185#define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1
5186/**
5187 * @ingroup iface_wl_keyboard
5188 */
5189#define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4
5190
5191/**
5192 * @ingroup iface_wl_keyboard
5193 */
5194#define WL_KEYBOARD_RELEASE_SINCE_VERSION 3
5195
5196/** @ingroup iface_wl_keyboard */
5197static inline void
5198wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data)
5199{
5200 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_keyboard, user_data);
5201}
5202
5203/** @ingroup iface_wl_keyboard */
5204static inline void *
5205wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard)
5206{
5207 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_keyboard);
5208}
5209
5210static inline uint32_t
5211wl_keyboard_get_version(struct wl_keyboard *wl_keyboard)
5212{
5213 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_keyboard);
5214}
5215
5216/** @ingroup iface_wl_keyboard */
5217static inline void
5218wl_keyboard_destroy(struct wl_keyboard *wl_keyboard)
5219{
5220 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_keyboard);
5221}
5222
5223/**
5224 * @ingroup iface_wl_keyboard
5225 */
5226static inline void
5227wl_keyboard_release(struct wl_keyboard *wl_keyboard)
5228{
5229 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_keyboard,
5230 WL_KEYBOARD_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_keyboard), WL_MARSHAL_FLAG_DESTROY);
5231}
5232
5233/**
5234 * @ingroup iface_wl_touch
5235 * @struct wl_touch_listener
5236 */
5237struct wl_touch_listener {
5238 /**
5239 * touch down event and beginning of a touch sequence
5240 *
5241 * A new touch point has appeared on the surface. This touch
5242 * point is assigned a unique ID. Future events from this touch
5243 * point reference this ID. The ID ceases to be valid after a touch
5244 * up event and may be reused in the future.
5245 * @param serial serial number of the touch down event
5246 * @param time timestamp with millisecond granularity
5247 * @param surface surface touched
5248 * @param id the unique ID of this touch point
5249 * @param x surface-local x coordinate
5250 * @param y surface-local y coordinate
5251 */
5252 void (*down)(void *data,
5253 struct wl_touch *wl_touch,
5254 uint32_t serial,
5255 uint32_t time,
5256 struct wl_surface *surface,
5257 int32_t id,
5258 wl_fixed_t x,
5259 wl_fixed_t y);
5260 /**
5261 * end of a touch event sequence
5262 *
5263 * The touch point has disappeared. No further events will be
5264 * sent for this touch point and the touch point's ID is released
5265 * and may be reused in a future touch down event.
5266 * @param serial serial number of the touch up event
5267 * @param time timestamp with millisecond granularity
5268 * @param id the unique ID of this touch point
5269 */
5270 void (*up)(void *data,
5271 struct wl_touch *wl_touch,
5272 uint32_t serial,
5273 uint32_t time,
5274 int32_t id);
5275 /**
5276 * update of touch point coordinates
5277 *
5278 * A touch point has changed coordinates.
5279 * @param time timestamp with millisecond granularity
5280 * @param id the unique ID of this touch point
5281 * @param x surface-local x coordinate
5282 * @param y surface-local y coordinate
5283 */
5284 void (*motion)(void *data,
5285 struct wl_touch *wl_touch,
5286 uint32_t time,
5287 int32_t id,
5288 wl_fixed_t x,
5289 wl_fixed_t y);
5290 /**
5291 * end of touch frame event
5292 *
5293 * Indicates the end of a set of events that logically belong
5294 * together. A client is expected to accumulate the data in all
5295 * events within the frame before proceeding.
5296 *
5297 * A wl_touch.frame terminates at least one event but otherwise no
5298 * guarantee is provided about the set of events within a frame. A
5299 * client must assume that any state not updated in a frame is
5300 * unchanged from the previously known state.
5301 */
5302 void (*frame)(void *data,
5303 struct wl_touch *wl_touch);
5304 /**
5305 * touch session cancelled
5306 *
5307 * Sent if the compositor decides the touch stream is a global
5308 * gesture. No further events are sent to the clients from that
5309 * particular gesture. Touch cancellation applies to all touch
5310 * points currently active on this client's surface. The client is
5311 * responsible for finalizing the touch points, future touch points
5312 * on this surface may reuse the touch point ID.
5313 */
5314 void (*cancel)(void *data,
5315 struct wl_touch *wl_touch);
5316 /**
5317 * update shape of touch point
5318 *
5319 * Sent when a touchpoint has changed its shape.
5320 *
5321 * This event does not occur on its own. It is sent before a
5322 * wl_touch.frame event and carries the new shape information for
5323 * any previously reported, or new touch points of that frame.
5324 *
5325 * Other events describing the touch point such as wl_touch.down,
5326 * wl_touch.motion or wl_touch.orientation may be sent within the
5327 * same wl_touch.frame. A client should treat these events as a
5328 * single logical touch point update. The order of wl_touch.shape,
5329 * wl_touch.orientation and wl_touch.motion is not guaranteed. A
5330 * wl_touch.down event is guaranteed to occur before the first
5331 * wl_touch.shape event for this touch ID but both events may occur
5332 * within the same wl_touch.frame.
5333 *
5334 * A touchpoint shape is approximated by an ellipse through the
5335 * major and minor axis length. The major axis length describes the
5336 * longer diameter of the ellipse, while the minor axis length
5337 * describes the shorter diameter. Major and minor are orthogonal
5338 * and both are specified in surface-local coordinates. The center
5339 * of the ellipse is always at the touchpoint location as reported
5340 * by wl_touch.down or wl_touch.move.
5341 *
5342 * This event is only sent by the compositor if the touch device
5343 * supports shape reports. The client has to make reasonable
5344 * assumptions about the shape if it did not receive this event.
5345 * @param id the unique ID of this touch point
5346 * @param major length of the major axis in surface-local coordinates
5347 * @param minor length of the minor axis in surface-local coordinates
5348 * @since 6
5349 */
5350 void (*shape)(void *data,
5351 struct wl_touch *wl_touch,
5352 int32_t id,
5353 wl_fixed_t major,
5354 wl_fixed_t minor);
5355 /**
5356 * update orientation of touch point
5357 *
5358 * Sent when a touchpoint has changed its orientation.
5359 *
5360 * This event does not occur on its own. It is sent before a
5361 * wl_touch.frame event and carries the new shape information for
5362 * any previously reported, or new touch points of that frame.
5363 *
5364 * Other events describing the touch point such as wl_touch.down,
5365 * wl_touch.motion or wl_touch.shape may be sent within the same
5366 * wl_touch.frame. A client should treat these events as a single
5367 * logical touch point update. The order of wl_touch.shape,
5368 * wl_touch.orientation and wl_touch.motion is not guaranteed. A
5369 * wl_touch.down event is guaranteed to occur before the first
5370 * wl_touch.orientation event for this touch ID but both events may
5371 * occur within the same wl_touch.frame.
5372 *
5373 * The orientation describes the clockwise angle of a touchpoint's
5374 * major axis to the positive surface y-axis and is normalized to
5375 * the -180 to +180 degree range. The granularity of orientation
5376 * depends on the touch device, some devices only support binary
5377 * rotation values between 0 and 90 degrees.
5378 *
5379 * This event is only sent by the compositor if the touch device
5380 * supports orientation reports.
5381 * @param id the unique ID of this touch point
5382 * @param orientation angle between major axis and positive surface y-axis in degrees
5383 * @since 6
5384 */
5385 void (*orientation)(void *data,
5386 struct wl_touch *wl_touch,
5387 int32_t id,
5388 wl_fixed_t orientation);
5389};
5390
5391/**
5392 * @ingroup iface_wl_touch
5393 */
5394static inline int
5395wl_touch_add_listener(struct wl_touch *wl_touch,
5396 const struct wl_touch_listener *listener, void *data)
5397{
5398 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_touch,
5399 implementation: (void (**)(void)) listener, data);
5400}
5401
5402#define WL_TOUCH_RELEASE 0
5403
5404/**
5405 * @ingroup iface_wl_touch
5406 */
5407#define WL_TOUCH_DOWN_SINCE_VERSION 1
5408/**
5409 * @ingroup iface_wl_touch
5410 */
5411#define WL_TOUCH_UP_SINCE_VERSION 1
5412/**
5413 * @ingroup iface_wl_touch
5414 */
5415#define WL_TOUCH_MOTION_SINCE_VERSION 1
5416/**
5417 * @ingroup iface_wl_touch
5418 */
5419#define WL_TOUCH_FRAME_SINCE_VERSION 1
5420/**
5421 * @ingroup iface_wl_touch
5422 */
5423#define WL_TOUCH_CANCEL_SINCE_VERSION 1
5424/**
5425 * @ingroup iface_wl_touch
5426 */
5427#define WL_TOUCH_SHAPE_SINCE_VERSION 6
5428/**
5429 * @ingroup iface_wl_touch
5430 */
5431#define WL_TOUCH_ORIENTATION_SINCE_VERSION 6
5432
5433/**
5434 * @ingroup iface_wl_touch
5435 */
5436#define WL_TOUCH_RELEASE_SINCE_VERSION 3
5437
5438/** @ingroup iface_wl_touch */
5439static inline void
5440wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data)
5441{
5442 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_touch, user_data);
5443}
5444
5445/** @ingroup iface_wl_touch */
5446static inline void *
5447wl_touch_get_user_data(struct wl_touch *wl_touch)
5448{
5449 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_touch);
5450}
5451
5452static inline uint32_t
5453wl_touch_get_version(struct wl_touch *wl_touch)
5454{
5455 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_touch);
5456}
5457
5458/** @ingroup iface_wl_touch */
5459static inline void
5460wl_touch_destroy(struct wl_touch *wl_touch)
5461{
5462 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_touch);
5463}
5464
5465/**
5466 * @ingroup iface_wl_touch
5467 */
5468static inline void
5469wl_touch_release(struct wl_touch *wl_touch)
5470{
5471 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_touch,
5472 WL_TOUCH_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_touch), WL_MARSHAL_FLAG_DESTROY);
5473}
5474
5475#ifndef WL_OUTPUT_SUBPIXEL_ENUM
5476#define WL_OUTPUT_SUBPIXEL_ENUM
5477/**
5478 * @ingroup iface_wl_output
5479 * subpixel geometry information
5480 *
5481 * This enumeration describes how the physical
5482 * pixels on an output are laid out.
5483 */
5484enum wl_output_subpixel {
5485 /**
5486 * unknown geometry
5487 */
5488 WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
5489 /**
5490 * no geometry
5491 */
5492 WL_OUTPUT_SUBPIXEL_NONE = 1,
5493 /**
5494 * horizontal RGB
5495 */
5496 WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
5497 /**
5498 * horizontal BGR
5499 */
5500 WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
5501 /**
5502 * vertical RGB
5503 */
5504 WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
5505 /**
5506 * vertical BGR
5507 */
5508 WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
5509};
5510#endif /* WL_OUTPUT_SUBPIXEL_ENUM */
5511
5512#ifndef WL_OUTPUT_TRANSFORM_ENUM
5513#define WL_OUTPUT_TRANSFORM_ENUM
5514/**
5515 * @ingroup iface_wl_output
5516 * transform from framebuffer to output
5517 *
5518 * This describes the transform that a compositor will apply to a
5519 * surface to compensate for the rotation or mirroring of an
5520 * output device.
5521 *
5522 * The flipped values correspond to an initial flip around a
5523 * vertical axis followed by rotation.
5524 *
5525 * The purpose is mainly to allow clients to render accordingly and
5526 * tell the compositor, so that for fullscreen surfaces, the
5527 * compositor will still be able to scan out directly from client
5528 * surfaces.
5529 */
5530enum wl_output_transform {
5531 /**
5532 * no transform
5533 */
5534 WL_OUTPUT_TRANSFORM_NORMAL = 0,
5535 /**
5536 * 90 degrees counter-clockwise
5537 */
5538 WL_OUTPUT_TRANSFORM_90 = 1,
5539 /**
5540 * 180 degrees counter-clockwise
5541 */
5542 WL_OUTPUT_TRANSFORM_180 = 2,
5543 /**
5544 * 270 degrees counter-clockwise
5545 */
5546 WL_OUTPUT_TRANSFORM_270 = 3,
5547 /**
5548 * 180 degree flip around a vertical axis
5549 */
5550 WL_OUTPUT_TRANSFORM_FLIPPED = 4,
5551 /**
5552 * flip and rotate 90 degrees counter-clockwise
5553 */
5554 WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
5555 /**
5556 * flip and rotate 180 degrees counter-clockwise
5557 */
5558 WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
5559 /**
5560 * flip and rotate 270 degrees counter-clockwise
5561 */
5562 WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
5563};
5564#endif /* WL_OUTPUT_TRANSFORM_ENUM */
5565
5566#ifndef WL_OUTPUT_MODE_ENUM
5567#define WL_OUTPUT_MODE_ENUM
5568/**
5569 * @ingroup iface_wl_output
5570 * mode information
5571 *
5572 * These flags describe properties of an output mode.
5573 * They are used in the flags bitfield of the mode event.
5574 */
5575enum wl_output_mode {
5576 /**
5577 * indicates this is the current mode
5578 */
5579 WL_OUTPUT_MODE_CURRENT = 0x1,
5580 /**
5581 * indicates this is the preferred mode
5582 */
5583 WL_OUTPUT_MODE_PREFERRED = 0x2,
5584};
5585#endif /* WL_OUTPUT_MODE_ENUM */
5586
5587/**
5588 * @ingroup iface_wl_output
5589 * @struct wl_output_listener
5590 */
5591struct wl_output_listener {
5592 /**
5593 * properties of the output
5594 *
5595 * The geometry event describes geometric properties of the
5596 * output. The event is sent when binding to the output object and
5597 * whenever any of the properties change.
5598 *
5599 * The physical size can be set to zero if it doesn't make sense
5600 * for this output (e.g. for projectors or virtual outputs).
5601 *
5602 * The geometry event will be followed by a done event (starting
5603 * from version 2).
5604 *
5605 * Note: wl_output only advertises partial information about the
5606 * output position and identification. Some compositors, for
5607 * instance those not implementing a desktop-style output layout or
5608 * those exposing virtual outputs, might fake this information.
5609 * Instead of using x and y, clients should use
5610 * xdg_output.logical_position. Instead of using make and model,
5611 * clients should use name and description.
5612 * @param x x position within the global compositor space
5613 * @param y y position within the global compositor space
5614 * @param physical_width width in millimeters of the output
5615 * @param physical_height height in millimeters of the output
5616 * @param subpixel subpixel orientation of the output
5617 * @param make textual description of the manufacturer
5618 * @param model textual description of the model
5619 * @param transform transform that maps framebuffer to output
5620 */
5621 void (*geometry)(void *data,
5622 struct wl_output *wl_output,
5623 int32_t x,
5624 int32_t y,
5625 int32_t physical_width,
5626 int32_t physical_height,
5627 int32_t subpixel,
5628 const char *make,
5629 const char *model,
5630 int32_t transform);
5631 /**
5632 * advertise available modes for the output
5633 *
5634 * The mode event describes an available mode for the output.
5635 *
5636 * The event is sent when binding to the output object and there
5637 * will always be one mode, the current mode. The event is sent
5638 * again if an output changes mode, for the mode that is now
5639 * current. In other words, the current mode is always the last
5640 * mode that was received with the current flag set.
5641 *
5642 * Non-current modes are deprecated. A compositor can decide to
5643 * only advertise the current mode and never send other modes.
5644 * Clients should not rely on non-current modes.
5645 *
5646 * The size of a mode is given in physical hardware units of the
5647 * output device. This is not necessarily the same as the output
5648 * size in the global compositor space. For instance, the output
5649 * may be scaled, as described in wl_output.scale, or transformed,
5650 * as described in wl_output.transform. Clients willing to retrieve
5651 * the output size in the global compositor space should use
5652 * xdg_output.logical_size instead.
5653 *
5654 * The vertical refresh rate can be set to zero if it doesn't make
5655 * sense for this output (e.g. for virtual outputs).
5656 *
5657 * The mode event will be followed by a done event (starting from
5658 * version 2).
5659 *
5660 * Clients should not use the refresh rate to schedule frames.
5661 * Instead, they should use the wl_surface.frame event or the
5662 * presentation-time protocol.
5663 *
5664 * Note: this information is not always meaningful for all outputs.
5665 * Some compositors, such as those exposing virtual outputs, might
5666 * fake the refresh rate or the size.
5667 * @param flags bitfield of mode flags
5668 * @param width width of the mode in hardware units
5669 * @param height height of the mode in hardware units
5670 * @param refresh vertical refresh rate in mHz
5671 */
5672 void (*mode)(void *data,
5673 struct wl_output *wl_output,
5674 uint32_t flags,
5675 int32_t width,
5676 int32_t height,
5677 int32_t refresh);
5678 /**
5679 * sent all information about output
5680 *
5681 * This event is sent after all other properties have been sent
5682 * after binding to the output object and after any other property
5683 * changes done after that. This allows changes to the output
5684 * properties to be seen as atomic, even if they happen via
5685 * multiple events.
5686 * @since 2
5687 */
5688 void (*done)(void *data,
5689 struct wl_output *wl_output);
5690 /**
5691 * output scaling properties
5692 *
5693 * This event contains scaling geometry information that is not
5694 * in the geometry event. It may be sent after binding the output
5695 * object or if the output scale changes later. If it is not sent,
5696 * the client should assume a scale of 1.
5697 *
5698 * A scale larger than 1 means that the compositor will
5699 * automatically scale surface buffers by this amount when
5700 * rendering. This is used for very high resolution displays where
5701 * applications rendering at the native resolution would be too
5702 * small to be legible.
5703 *
5704 * It is intended that scaling aware clients track the current
5705 * output of a surface, and if it is on a scaled output it should
5706 * use wl_surface.set_buffer_scale with the scale of the output.
5707 * That way the compositor can avoid scaling the surface, and the
5708 * client can supply a higher detail image.
5709 *
5710 * The scale event will be followed by a done event.
5711 * @param factor scaling factor of output
5712 * @since 2
5713 */
5714 void (*scale)(void *data,
5715 struct wl_output *wl_output,
5716 int32_t factor);
5717 /**
5718 * name of this output
5719 *
5720 * Many compositors will assign user-friendly names to their
5721 * outputs, show them to the user, allow the user to refer to an
5722 * output, etc. The client may wish to know this name as well to
5723 * offer the user similar behaviors.
5724 *
5725 * The name is a UTF-8 string with no convention defined for its
5726 * contents. Each name is unique among all wl_output globals. The
5727 * name is only guaranteed to be unique for the compositor
5728 * instance.
5729 *
5730 * The same output name is used for all clients for a given
5731 * wl_output global. Thus, the name can be shared across processes
5732 * to refer to a specific wl_output global.
5733 *
5734 * The name is not guaranteed to be persistent across sessions,
5735 * thus cannot be used to reliably identify an output in e.g.
5736 * configuration files.
5737 *
5738 * Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc.
5739 * However, do not assume that the name is a reflection of an
5740 * underlying DRM connector, X11 connection, etc.
5741 *
5742 * The name event is sent after binding the output object. This
5743 * event is only sent once per output object, and the name does not
5744 * change over the lifetime of the wl_output global.
5745 *
5746 * Compositors may re-use the same output name if the wl_output
5747 * global is destroyed and re-created later. Compositors should
5748 * avoid re-using the same name if possible.
5749 *
5750 * The name event will be followed by a done event.
5751 * @param name output name
5752 * @since 4
5753 */
5754 void (*name)(void *data,
5755 struct wl_output *wl_output,
5756 const char *name);
5757 /**
5758 * human-readable description of this output
5759 *
5760 * Many compositors can produce human-readable descriptions of
5761 * their outputs. The client may wish to know this description as
5762 * well, e.g. for output selection purposes.
5763 *
5764 * The description is a UTF-8 string with no convention defined for
5765 * its contents. The description is not guaranteed to be unique
5766 * among all wl_output globals. Examples might include 'Foocorp 11"
5767 * Display' or 'Virtual X11 output via :1'.
5768 *
5769 * The description event is sent after binding the output object
5770 * and whenever the description changes. The description is
5771 * optional, and may not be sent at all.
5772 *
5773 * The description event will be followed by a done event.
5774 * @param description output description
5775 * @since 4
5776 */
5777 void (*description)(void *data,
5778 struct wl_output *wl_output,
5779 const char *description);
5780};
5781
5782/**
5783 * @ingroup iface_wl_output
5784 */
5785static inline int
5786wl_output_add_listener(struct wl_output *wl_output,
5787 const struct wl_output_listener *listener, void *data)
5788{
5789 return wl_proxy_add_listener(proxy: (struct wl_proxy *) wl_output,
5790 implementation: (void (**)(void)) listener, data);
5791}
5792
5793#define WL_OUTPUT_RELEASE 0
5794
5795/**
5796 * @ingroup iface_wl_output
5797 */
5798#define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1
5799/**
5800 * @ingroup iface_wl_output
5801 */
5802#define WL_OUTPUT_MODE_SINCE_VERSION 1
5803/**
5804 * @ingroup iface_wl_output
5805 */
5806#define WL_OUTPUT_DONE_SINCE_VERSION 2
5807/**
5808 * @ingroup iface_wl_output
5809 */
5810#define WL_OUTPUT_SCALE_SINCE_VERSION 2
5811/**
5812 * @ingroup iface_wl_output
5813 */
5814#define WL_OUTPUT_NAME_SINCE_VERSION 4
5815/**
5816 * @ingroup iface_wl_output
5817 */
5818#define WL_OUTPUT_DESCRIPTION_SINCE_VERSION 4
5819
5820/**
5821 * @ingroup iface_wl_output
5822 */
5823#define WL_OUTPUT_RELEASE_SINCE_VERSION 3
5824
5825/** @ingroup iface_wl_output */
5826static inline void
5827wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
5828{
5829 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_output, user_data);
5830}
5831
5832/** @ingroup iface_wl_output */
5833static inline void *
5834wl_output_get_user_data(struct wl_output *wl_output)
5835{
5836 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_output);
5837}
5838
5839static inline uint32_t
5840wl_output_get_version(struct wl_output *wl_output)
5841{
5842 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_output);
5843}
5844
5845/** @ingroup iface_wl_output */
5846static inline void
5847wl_output_destroy(struct wl_output *wl_output)
5848{
5849 wl_proxy_destroy(proxy: (struct wl_proxy *) wl_output);
5850}
5851
5852/**
5853 * @ingroup iface_wl_output
5854 *
5855 * Using this request a client can tell the server that it is not going to
5856 * use the output object anymore.
5857 */
5858static inline void
5859wl_output_release(struct wl_output *wl_output)
5860{
5861 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_output,
5862 WL_OUTPUT_RELEASE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_output), WL_MARSHAL_FLAG_DESTROY);
5863}
5864
5865#define WL_REGION_DESTROY 0
5866#define WL_REGION_ADD 1
5867#define WL_REGION_SUBTRACT 2
5868
5869
5870/**
5871 * @ingroup iface_wl_region
5872 */
5873#define WL_REGION_DESTROY_SINCE_VERSION 1
5874/**
5875 * @ingroup iface_wl_region
5876 */
5877#define WL_REGION_ADD_SINCE_VERSION 1
5878/**
5879 * @ingroup iface_wl_region
5880 */
5881#define WL_REGION_SUBTRACT_SINCE_VERSION 1
5882
5883/** @ingroup iface_wl_region */
5884static inline void
5885wl_region_set_user_data(struct wl_region *wl_region, void *user_data)
5886{
5887 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_region, user_data);
5888}
5889
5890/** @ingroup iface_wl_region */
5891static inline void *
5892wl_region_get_user_data(struct wl_region *wl_region)
5893{
5894 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_region);
5895}
5896
5897static inline uint32_t
5898wl_region_get_version(struct wl_region *wl_region)
5899{
5900 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_region);
5901}
5902
5903/**
5904 * @ingroup iface_wl_region
5905 *
5906 * Destroy the region. This will invalidate the object ID.
5907 */
5908static inline void
5909wl_region_destroy(struct wl_region *wl_region)
5910{
5911 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_region,
5912 WL_REGION_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_region), WL_MARSHAL_FLAG_DESTROY);
5913}
5914
5915/**
5916 * @ingroup iface_wl_region
5917 *
5918 * Add the specified rectangle to the region.
5919 */
5920static inline void
5921wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
5922{
5923 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_region,
5924 WL_REGION_ADD, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_region), flags: 0, x, y, width, height);
5925}
5926
5927/**
5928 * @ingroup iface_wl_region
5929 *
5930 * Subtract the specified rectangle from the region.
5931 */
5932static inline void
5933wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
5934{
5935 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_region,
5936 WL_REGION_SUBTRACT, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_region), flags: 0, x, y, width, height);
5937}
5938
5939#ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
5940#define WL_SUBCOMPOSITOR_ERROR_ENUM
5941enum wl_subcompositor_error {
5942 /**
5943 * the to-be sub-surface is invalid
5944 */
5945 WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
5946 /**
5947 * the to-be sub-surface parent is invalid
5948 */
5949 WL_SUBCOMPOSITOR_ERROR_BAD_PARENT = 1,
5950};
5951#endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
5952
5953#define WL_SUBCOMPOSITOR_DESTROY 0
5954#define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
5955
5956
5957/**
5958 * @ingroup iface_wl_subcompositor
5959 */
5960#define WL_SUBCOMPOSITOR_DESTROY_SINCE_VERSION 1
5961/**
5962 * @ingroup iface_wl_subcompositor
5963 */
5964#define WL_SUBCOMPOSITOR_GET_SUBSURFACE_SINCE_VERSION 1
5965
5966/** @ingroup iface_wl_subcompositor */
5967static inline void
5968wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
5969{
5970 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_subcompositor, user_data);
5971}
5972
5973/** @ingroup iface_wl_subcompositor */
5974static inline void *
5975wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
5976{
5977 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_subcompositor);
5978}
5979
5980static inline uint32_t
5981wl_subcompositor_get_version(struct wl_subcompositor *wl_subcompositor)
5982{
5983 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subcompositor);
5984}
5985
5986/**
5987 * @ingroup iface_wl_subcompositor
5988 *
5989 * Informs the server that the client will not be using this
5990 * protocol object anymore. This does not affect any other
5991 * objects, wl_subsurface objects included.
5992 */
5993static inline void
5994wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
5995{
5996 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subcompositor,
5997 WL_SUBCOMPOSITOR_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subcompositor), WL_MARSHAL_FLAG_DESTROY);
5998}
5999
6000/**
6001 * @ingroup iface_wl_subcompositor
6002 *
6003 * Create a sub-surface interface for the given surface, and
6004 * associate it with the given parent surface. This turns a
6005 * plain wl_surface into a sub-surface.
6006 *
6007 * The to-be sub-surface must not already have another role, and it
6008 * must not have an existing wl_subsurface object. Otherwise the
6009 * bad_surface protocol error is raised.
6010 *
6011 * Adding sub-surfaces to a parent is a double-buffered operation on the
6012 * parent (see wl_surface.commit). The effect of adding a sub-surface
6013 * becomes visible on the next time the state of the parent surface is
6014 * applied.
6015 *
6016 * The parent surface must not be one of the child surface's descendants,
6017 * and the parent must be different from the child surface, otherwise the
6018 * bad_parent protocol error is raised.
6019 *
6020 * This request modifies the behaviour of wl_surface.commit request on
6021 * the sub-surface, see the documentation on wl_subsurface interface.
6022 */
6023static inline struct wl_subsurface *
6024wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
6025{
6026 struct wl_proxy *id;
6027
6028 id = wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subcompositor,
6029 WL_SUBCOMPOSITOR_GET_SUBSURFACE, interface: &wl_subsurface_interface, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subcompositor), flags: 0, NULL, surface, parent);
6030
6031 return (struct wl_subsurface *) id;
6032}
6033
6034#ifndef WL_SUBSURFACE_ERROR_ENUM
6035#define WL_SUBSURFACE_ERROR_ENUM
6036enum wl_subsurface_error {
6037 /**
6038 * wl_surface is not a sibling or the parent
6039 */
6040 WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
6041};
6042#endif /* WL_SUBSURFACE_ERROR_ENUM */
6043
6044#define WL_SUBSURFACE_DESTROY 0
6045#define WL_SUBSURFACE_SET_POSITION 1
6046#define WL_SUBSURFACE_PLACE_ABOVE 2
6047#define WL_SUBSURFACE_PLACE_BELOW 3
6048#define WL_SUBSURFACE_SET_SYNC 4
6049#define WL_SUBSURFACE_SET_DESYNC 5
6050
6051
6052/**
6053 * @ingroup iface_wl_subsurface
6054 */
6055#define WL_SUBSURFACE_DESTROY_SINCE_VERSION 1
6056/**
6057 * @ingroup iface_wl_subsurface
6058 */
6059#define WL_SUBSURFACE_SET_POSITION_SINCE_VERSION 1
6060/**
6061 * @ingroup iface_wl_subsurface
6062 */
6063#define WL_SUBSURFACE_PLACE_ABOVE_SINCE_VERSION 1
6064/**
6065 * @ingroup iface_wl_subsurface
6066 */
6067#define WL_SUBSURFACE_PLACE_BELOW_SINCE_VERSION 1
6068/**
6069 * @ingroup iface_wl_subsurface
6070 */
6071#define WL_SUBSURFACE_SET_SYNC_SINCE_VERSION 1
6072/**
6073 * @ingroup iface_wl_subsurface
6074 */
6075#define WL_SUBSURFACE_SET_DESYNC_SINCE_VERSION 1
6076
6077/** @ingroup iface_wl_subsurface */
6078static inline void
6079wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
6080{
6081 wl_proxy_set_user_data(proxy: (struct wl_proxy *) wl_subsurface, user_data);
6082}
6083
6084/** @ingroup iface_wl_subsurface */
6085static inline void *
6086wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
6087{
6088 return wl_proxy_get_user_data(proxy: (struct wl_proxy *) wl_subsurface);
6089}
6090
6091static inline uint32_t
6092wl_subsurface_get_version(struct wl_subsurface *wl_subsurface)
6093{
6094 return wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface);
6095}
6096
6097/**
6098 * @ingroup iface_wl_subsurface
6099 *
6100 * The sub-surface interface is removed from the wl_surface object
6101 * that was turned into a sub-surface with a
6102 * wl_subcompositor.get_subsurface request. The wl_surface's association
6103 * to the parent is deleted. The wl_surface is unmapped immediately.
6104 */
6105static inline void
6106wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
6107{
6108 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6109 WL_SUBSURFACE_DESTROY, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), WL_MARSHAL_FLAG_DESTROY);
6110}
6111
6112/**
6113 * @ingroup iface_wl_subsurface
6114 *
6115 * This schedules a sub-surface position change.
6116 * The sub-surface will be moved so that its origin (top left
6117 * corner pixel) will be at the location x, y of the parent surface
6118 * coordinate system. The coordinates are not restricted to the parent
6119 * surface area. Negative values are allowed.
6120 *
6121 * The scheduled coordinates will take effect whenever the state of the
6122 * parent surface is applied. When this happens depends on whether the
6123 * parent surface is in synchronized mode or not. See
6124 * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
6125 *
6126 * If more than one set_position request is invoked by the client before
6127 * the commit of the parent surface, the position of a new request always
6128 * replaces the scheduled position from any previous request.
6129 *
6130 * The initial position is 0, 0.
6131 */
6132static inline void
6133wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
6134{
6135 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6136 WL_SUBSURFACE_SET_POSITION, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), flags: 0, x, y);
6137}
6138
6139/**
6140 * @ingroup iface_wl_subsurface
6141 *
6142 * This sub-surface is taken from the stack, and put back just
6143 * above the reference surface, changing the z-order of the sub-surfaces.
6144 * The reference surface must be one of the sibling surfaces, or the
6145 * parent surface. Using any other surface, including this sub-surface,
6146 * will cause a protocol error.
6147 *
6148 * The z-order is double-buffered. Requests are handled in order and
6149 * applied immediately to a pending state. The final pending state is
6150 * copied to the active state the next time the state of the parent
6151 * surface is applied. When this happens depends on whether the parent
6152 * surface is in synchronized mode or not. See wl_subsurface.set_sync and
6153 * wl_subsurface.set_desync for details.
6154 *
6155 * A new sub-surface is initially added as the top-most in the stack
6156 * of its siblings and parent.
6157 */
6158static inline void
6159wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
6160{
6161 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6162 WL_SUBSURFACE_PLACE_ABOVE, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), flags: 0, sibling);
6163}
6164
6165/**
6166 * @ingroup iface_wl_subsurface
6167 *
6168 * The sub-surface is placed just below the reference surface.
6169 * See wl_subsurface.place_above.
6170 */
6171static inline void
6172wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
6173{
6174 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6175 WL_SUBSURFACE_PLACE_BELOW, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), flags: 0, sibling);
6176}
6177
6178/**
6179 * @ingroup iface_wl_subsurface
6180 *
6181 * Change the commit behaviour of the sub-surface to synchronized
6182 * mode, also described as the parent dependent mode.
6183 *
6184 * In synchronized mode, wl_surface.commit on a sub-surface will
6185 * accumulate the committed state in a cache, but the state will
6186 * not be applied and hence will not change the compositor output.
6187 * The cached state is applied to the sub-surface immediately after
6188 * the parent surface's state is applied. This ensures atomic
6189 * updates of the parent and all its synchronized sub-surfaces.
6190 * Applying the cached state will invalidate the cache, so further
6191 * parent surface commits do not (re-)apply old state.
6192 *
6193 * See wl_subsurface for the recursive effect of this mode.
6194 */
6195static inline void
6196wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
6197{
6198 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6199 WL_SUBSURFACE_SET_SYNC, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), flags: 0);
6200}
6201
6202/**
6203 * @ingroup iface_wl_subsurface
6204 *
6205 * Change the commit behaviour of the sub-surface to desynchronized
6206 * mode, also described as independent or freely running mode.
6207 *
6208 * In desynchronized mode, wl_surface.commit on a sub-surface will
6209 * apply the pending state directly, without caching, as happens
6210 * normally with a wl_surface. Calling wl_surface.commit on the
6211 * parent surface has no effect on the sub-surface's wl_surface
6212 * state. This mode allows a sub-surface to be updated on its own.
6213 *
6214 * If cached state exists when wl_surface.commit is called in
6215 * desynchronized mode, the pending state is added to the cached
6216 * state, and applied as a whole. This invalidates the cache.
6217 *
6218 * Note: even if a sub-surface is set to desynchronized, a parent
6219 * sub-surface may override it to behave as synchronized. For details,
6220 * see wl_subsurface.
6221 *
6222 * If a surface's parent surface behaves as desynchronized, then
6223 * the cached state is applied on set_desync.
6224 */
6225static inline void
6226wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
6227{
6228 wl_proxy_marshal_flags(proxy: (struct wl_proxy *) wl_subsurface,
6229 WL_SUBSURFACE_SET_DESYNC, NULL, version: wl_proxy_get_version(proxy: (struct wl_proxy *) wl_subsurface), flags: 0);
6230}
6231
6232#ifdef __cplusplus
6233}
6234#endif
6235
6236#endif
6237

source code of include/wayland-client-protocol.h