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