1 /* Generated by wayland-scanner 1.18.0 */
2 
3 #ifndef WAYLAND_SERVER_PROTOCOL_H
4 #define WAYLAND_SERVER_PROTOCOL_H
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include "wayland-server-core.h"
9 
10 #ifdef  __cplusplus
11 extern "C" {
12 #endif
13 
14 struct wl_client;
15 struct wl_resource;
16 
17 /**
18  * @page page_wayland The wayland protocol
19  * @section page_ifaces_wayland Interfaces
20  * - @subpage page_iface_wl_display - core global object
21  * - @subpage page_iface_wl_registry - global registry object
22  * - @subpage page_iface_wl_callback - callback object
23  * - @subpage page_iface_wl_compositor - the compositor singleton
24  * - @subpage page_iface_wl_shm_pool - a shared memory pool
25  * - @subpage page_iface_wl_shm - shared memory support
26  * - @subpage page_iface_wl_buffer - content for a wl_surface
27  * - @subpage page_iface_wl_data_offer - offer to transfer data
28  * - @subpage page_iface_wl_data_source - offer to transfer data
29  * - @subpage page_iface_wl_data_device - data transfer device
30  * - @subpage page_iface_wl_data_device_manager - data transfer interface
31  * - @subpage page_iface_wl_shell - create desktop-style surfaces
32  * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
33  * - @subpage page_iface_wl_surface - an onscreen surface
34  * - @subpage page_iface_wl_seat - group of input devices
35  * - @subpage page_iface_wl_pointer - pointer input device
36  * - @subpage page_iface_wl_keyboard - keyboard input device
37  * - @subpage page_iface_wl_touch - touchscreen input device
38  * - @subpage page_iface_wl_output - compositor output region
39  * - @subpage page_iface_wl_region - region interface
40  * - @subpage page_iface_wl_subcompositor - sub-surface compositing
41  * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
42  * @section page_copyright_wayland Copyright
43  * <pre>
44  *
45  * Copyright © 2008-2011 Kristian Høgsberg
46  * Copyright © 2010-2011 Intel Corporation
47  * Copyright © 2012-2013 Collabora, Ltd.
48  *
49  * Permission is hereby granted, free of charge, to any person
50  * obtaining a copy of this software and associated documentation files
51  * (the "Software"), to deal in the Software without restriction,
52  * including without limitation the rights to use, copy, modify, merge,
53  * publish, distribute, sublicense, and/or sell copies of the Software,
54  * and to permit persons to whom the Software is furnished to do so,
55  * subject to the following conditions:
56  *
57  * The above copyright notice and this permission notice (including the
58  * next paragraph) shall be included in all copies or substantial
59  * portions of the Software.
60  *
61  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
62  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
64  * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
65  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
66  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
67  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
68  * SOFTWARE.
69  * </pre>
70  */
71 struct wl_buffer;
72 struct wl_callback;
73 struct wl_compositor;
74 struct wl_data_device;
75 struct wl_data_device_manager;
76 struct wl_data_offer;
77 struct wl_data_source;
78 struct wl_display;
79 struct wl_keyboard;
80 struct wl_output;
81 struct wl_pointer;
82 struct wl_region;
83 struct wl_registry;
84 struct wl_seat;
85 struct wl_shell;
86 struct wl_shell_surface;
87 struct wl_shm;
88 struct wl_shm_pool;
89 struct wl_subcompositor;
90 struct wl_subsurface;
91 struct wl_surface;
92 struct wl_touch;
93 
94 /**
95  * @page page_iface_wl_display wl_display
96  * @section page_iface_wl_display_desc Description
97  *
98  * The core global object.  This is a special singleton object.  It
99  * is used for internal Wayland protocol features.
100  * @section page_iface_wl_display_api API
101  * See @ref iface_wl_display.
102  */
103 /**
104  * @defgroup iface_wl_display The wl_display interface
105  *
106  * The core global object.  This is a special singleton object.  It
107  * is used for internal Wayland protocol features.
108  */
109 extern const struct wl_interface wl_display_interface;
110 /**
111  * @page page_iface_wl_registry wl_registry
112  * @section page_iface_wl_registry_desc Description
113  *
114  * The singleton global registry object.  The server has a number of
115  * global objects that are available to all clients.  These objects
116  * typically represent an actual object in the server (for example,
117  * an input device) or they are singleton objects that provide
118  * extension functionality.
119  *
120  * When a client creates a registry object, the registry object
121  * will emit a global event for each global currently in the
122  * registry.  Globals come and go as a result of device or
123  * monitor hotplugs, reconfiguration or other events, and the
124  * registry will send out global and global_remove events to
125  * keep the client up to date with the changes.  To mark the end
126  * of the initial burst of events, the client can use the
127  * wl_display.sync request immediately after calling
128  * wl_display.get_registry.
129  *
130  * A client can bind to a global object by using the bind
131  * request.  This creates a client-side handle that lets the object
132  * emit events to the client and lets the client invoke requests on
133  * the object.
134  * @section page_iface_wl_registry_api API
135  * See @ref iface_wl_registry.
136  */
137 /**
138  * @defgroup iface_wl_registry The wl_registry interface
139  *
140  * The singleton global registry object.  The server has a number of
141  * global objects that are available to all clients.  These objects
142  * typically represent an actual object in the server (for example,
143  * an input device) or they are singleton objects that provide
144  * extension functionality.
145  *
146  * When a client creates a registry object, the registry object
147  * will emit a global event for each global currently in the
148  * registry.  Globals come and go as a result of device or
149  * monitor hotplugs, reconfiguration or other events, and the
150  * registry will send out global and global_remove events to
151  * keep the client up to date with the changes.  To mark the end
152  * of the initial burst of events, the client can use the
153  * wl_display.sync request immediately after calling
154  * wl_display.get_registry.
155  *
156  * A client can bind to a global object by using the bind
157  * request.  This creates a client-side handle that lets the object
158  * emit events to the client and lets the client invoke requests on
159  * the object.
160  */
161 extern const struct wl_interface wl_registry_interface;
162 /**
163  * @page page_iface_wl_callback wl_callback
164  * @section page_iface_wl_callback_desc Description
165  *
166  * Clients can handle the 'done' event to get notified when
167  * the related request is done.
168  * @section page_iface_wl_callback_api API
169  * See @ref iface_wl_callback.
170  */
171 /**
172  * @defgroup iface_wl_callback The wl_callback interface
173  *
174  * Clients can handle the 'done' event to get notified when
175  * the related request is done.
176  */
177 extern const struct wl_interface wl_callback_interface;
178 /**
179  * @page page_iface_wl_compositor wl_compositor
180  * @section page_iface_wl_compositor_desc Description
181  *
182  * A compositor.  This object is a singleton global.  The
183  * compositor is in charge of combining the contents of multiple
184  * surfaces into one displayable output.
185  * @section page_iface_wl_compositor_api API
186  * See @ref iface_wl_compositor.
187  */
188 /**
189  * @defgroup iface_wl_compositor The wl_compositor interface
190  *
191  * A compositor.  This object is a singleton global.  The
192  * compositor is in charge of combining the contents of multiple
193  * surfaces into one displayable output.
194  */
195 extern const struct wl_interface wl_compositor_interface;
196 /**
197  * @page page_iface_wl_shm_pool wl_shm_pool
198  * @section page_iface_wl_shm_pool_desc Description
199  *
200  * The wl_shm_pool object encapsulates a piece of memory shared
201  * between the compositor and client.  Through the wl_shm_pool
202  * object, the client can allocate shared memory wl_buffer objects.
203  * All objects created through the same pool share the same
204  * underlying mapped memory. Reusing the mapped memory avoids the
205  * setup/teardown overhead and is useful when interactively resizing
206  * a surface or for many small buffers.
207  * @section page_iface_wl_shm_pool_api API
208  * See @ref iface_wl_shm_pool.
209  */
210 /**
211  * @defgroup iface_wl_shm_pool The wl_shm_pool interface
212  *
213  * The wl_shm_pool object encapsulates a piece of memory shared
214  * between the compositor and client.  Through the wl_shm_pool
215  * object, the client can allocate shared memory wl_buffer objects.
216  * All objects created through the same pool share the same
217  * underlying mapped memory. Reusing the mapped memory avoids the
218  * setup/teardown overhead and is useful when interactively resizing
219  * a surface or for many small buffers.
220  */
221 extern const struct wl_interface wl_shm_pool_interface;
222 /**
223  * @page page_iface_wl_shm wl_shm
224  * @section page_iface_wl_shm_desc Description
225  *
226  * A singleton global object that provides support for shared
227  * memory.
228  *
229  * Clients can create wl_shm_pool objects using the create_pool
230  * request.
231  *
232  * At connection setup time, the wl_shm object emits one or more
233  * format events to inform clients about the valid pixel formats
234  * that can be used for buffers.
235  * @section page_iface_wl_shm_api API
236  * See @ref iface_wl_shm.
237  */
238 /**
239  * @defgroup iface_wl_shm The wl_shm interface
240  *
241  * A singleton global object that provides support for shared
242  * memory.
243  *
244  * Clients can create wl_shm_pool objects using the create_pool
245  * request.
246  *
247  * At connection setup time, the wl_shm object emits one or more
248  * format events to inform clients about the valid pixel formats
249  * that can be used for buffers.
250  */
251 extern const struct wl_interface wl_shm_interface;
252 /**
253  * @page page_iface_wl_buffer wl_buffer
254  * @section page_iface_wl_buffer_desc Description
255  *
256  * A buffer provides the content for a wl_surface. Buffers are
257  * created through factory interfaces such as wl_drm, wl_shm or
258  * similar. It has a width and a height and can be attached to a
259  * wl_surface, but the mechanism by which a client provides and
260  * updates the contents is defined by the buffer factory interface.
261  * @section page_iface_wl_buffer_api API
262  * See @ref iface_wl_buffer.
263  */
264 /**
265  * @defgroup iface_wl_buffer The wl_buffer interface
266  *
267  * A buffer provides the content for a wl_surface. Buffers are
268  * created through factory interfaces such as wl_drm, wl_shm or
269  * similar. It has a width and a height and can be attached to a
270  * wl_surface, but the mechanism by which a client provides and
271  * updates the contents is defined by the buffer factory interface.
272  */
273 extern const struct wl_interface wl_buffer_interface;
274 /**
275  * @page page_iface_wl_data_offer wl_data_offer
276  * @section page_iface_wl_data_offer_desc Description
277  *
278  * A wl_data_offer represents a piece of data offered for transfer
279  * by another client (the source client).  It is used by the
280  * copy-and-paste and drag-and-drop mechanisms.  The offer
281  * describes the different mime types that the data can be
282  * converted to and provides the mechanism for transferring the
283  * data directly from the source client.
284  * @section page_iface_wl_data_offer_api API
285  * See @ref iface_wl_data_offer.
286  */
287 /**
288  * @defgroup iface_wl_data_offer The wl_data_offer interface
289  *
290  * A wl_data_offer represents a piece of data offered for transfer
291  * by another client (the source client).  It is used by the
292  * copy-and-paste and drag-and-drop mechanisms.  The offer
293  * describes the different mime types that the data can be
294  * converted to and provides the mechanism for transferring the
295  * data directly from the source client.
296  */
297 extern const struct wl_interface wl_data_offer_interface;
298 /**
299  * @page page_iface_wl_data_source wl_data_source
300  * @section page_iface_wl_data_source_desc Description
301  *
302  * The wl_data_source object is the source side of a wl_data_offer.
303  * It is created by the source client in a data transfer and
304  * provides a way to describe the offered data and a way to respond
305  * to requests to transfer the data.
306  * @section page_iface_wl_data_source_api API
307  * See @ref iface_wl_data_source.
308  */
309 /**
310  * @defgroup iface_wl_data_source The wl_data_source interface
311  *
312  * The wl_data_source object is the source side of a wl_data_offer.
313  * It is created by the source client in a data transfer and
314  * provides a way to describe the offered data and a way to respond
315  * to requests to transfer the data.
316  */
317 extern const struct wl_interface wl_data_source_interface;
318 /**
319  * @page page_iface_wl_data_device wl_data_device
320  * @section page_iface_wl_data_device_desc Description
321  *
322  * There is one wl_data_device per seat which can be obtained
323  * from the global wl_data_device_manager singleton.
324  *
325  * A wl_data_device provides access to inter-client data transfer
326  * mechanisms such as copy-and-paste and drag-and-drop.
327  * @section page_iface_wl_data_device_api API
328  * See @ref iface_wl_data_device.
329  */
330 /**
331  * @defgroup iface_wl_data_device The wl_data_device interface
332  *
333  * There is one wl_data_device per seat which can be obtained
334  * from the global wl_data_device_manager singleton.
335  *
336  * A wl_data_device provides access to inter-client data transfer
337  * mechanisms such as copy-and-paste and drag-and-drop.
338  */
339 extern const struct wl_interface wl_data_device_interface;
340 /**
341  * @page page_iface_wl_data_device_manager wl_data_device_manager
342  * @section page_iface_wl_data_device_manager_desc Description
343  *
344  * The wl_data_device_manager is a singleton global object that
345  * provides access to inter-client data transfer mechanisms such as
346  * copy-and-paste and drag-and-drop.  These mechanisms are tied to
347  * a wl_seat and this interface lets a client get a wl_data_device
348  * corresponding to a wl_seat.
349  *
350  * Depending on the version bound, the objects created from the bound
351  * wl_data_device_manager object will have different requirements for
352  * functioning properly. See wl_data_source.set_actions,
353  * wl_data_offer.accept and wl_data_offer.finish for details.
354  * @section page_iface_wl_data_device_manager_api API
355  * See @ref iface_wl_data_device_manager.
356  */
357 /**
358  * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
359  *
360  * The wl_data_device_manager is a singleton global object that
361  * provides access to inter-client data transfer mechanisms such as
362  * copy-and-paste and drag-and-drop.  These mechanisms are tied to
363  * a wl_seat and this interface lets a client get a wl_data_device
364  * corresponding to a wl_seat.
365  *
366  * Depending on the version bound, the objects created from the bound
367  * wl_data_device_manager object will have different requirements for
368  * functioning properly. See wl_data_source.set_actions,
369  * wl_data_offer.accept and wl_data_offer.finish for details.
370  */
371 extern const struct wl_interface wl_data_device_manager_interface;
372 /**
373  * @page page_iface_wl_shell wl_shell
374  * @section page_iface_wl_shell_desc Description
375  *
376  * This interface is implemented by servers that provide
377  * desktop-style user interfaces.
378  *
379  * It allows clients to associate a wl_shell_surface with
380  * a basic surface.
381  *
382  * Note! This protocol is deprecated and not intended for production use.
383  * For desktop-style user interfaces, use xdg_shell.
384  * @section page_iface_wl_shell_api API
385  * See @ref iface_wl_shell.
386  */
387 /**
388  * @defgroup iface_wl_shell The wl_shell interface
389  *
390  * This interface is implemented by servers that provide
391  * desktop-style user interfaces.
392  *
393  * It allows clients to associate a wl_shell_surface with
394  * a basic surface.
395  *
396  * Note! This protocol is deprecated and not intended for production use.
397  * For desktop-style user interfaces, use xdg_shell.
398  */
399 extern const struct wl_interface wl_shell_interface;
400 /**
401  * @page page_iface_wl_shell_surface wl_shell_surface
402  * @section page_iface_wl_shell_surface_desc Description
403  *
404  * An interface that may be implemented by a wl_surface, for
405  * implementations that provide a desktop-style user interface.
406  *
407  * It provides requests to treat surfaces like toplevel, fullscreen
408  * or popup windows, move, resize or maximize them, associate
409  * metadata like title and class, etc.
410  *
411  * On the server side the object is automatically destroyed when
412  * the related wl_surface is destroyed. On the client side,
413  * wl_shell_surface_destroy() must be called before destroying
414  * the wl_surface object.
415  * @section page_iface_wl_shell_surface_api API
416  * See @ref iface_wl_shell_surface.
417  */
418 /**
419  * @defgroup iface_wl_shell_surface The wl_shell_surface interface
420  *
421  * An interface that may be implemented by a wl_surface, for
422  * implementations that provide a desktop-style user interface.
423  *
424  * It provides requests to treat surfaces like toplevel, fullscreen
425  * or popup windows, move, resize or maximize them, associate
426  * metadata like title and class, etc.
427  *
428  * On the server side the object is automatically destroyed when
429  * the related wl_surface is destroyed. On the client side,
430  * wl_shell_surface_destroy() must be called before destroying
431  * the wl_surface object.
432  */
433 extern const struct wl_interface wl_shell_surface_interface;
434 /**
435  * @page page_iface_wl_surface wl_surface
436  * @section page_iface_wl_surface_desc Description
437  *
438  * A surface is a rectangular area that may be displayed on zero
439  * or more outputs, and shown any number of times at the compositor's
440  * discretion. They can present wl_buffers, receive user input, and
441  * define a local coordinate system.
442  *
443  * The size of a surface (and relative positions on it) is described
444  * in surface-local coordinates, which may differ from the buffer
445  * coordinates of the pixel content, in case a buffer_transform
446  * or a buffer_scale is used.
447  *
448  * A surface without a "role" is fairly useless: a compositor does
449  * not know where, when or how to present it. The role is the
450  * purpose of a wl_surface. Examples of roles are a cursor for a
451  * pointer (as set by wl_pointer.set_cursor), a drag icon
452  * (wl_data_device.start_drag), a sub-surface
453  * (wl_subcompositor.get_subsurface), and a window as defined by a
454  * shell protocol (e.g. wl_shell.get_shell_surface).
455  *
456  * A surface can have only one role at a time. Initially a
457  * wl_surface does not have a role. Once a wl_surface is given a
458  * role, it is set permanently for the whole lifetime of the
459  * wl_surface object. Giving the current role again is allowed,
460  * unless explicitly forbidden by the relevant interface
461  * specification.
462  *
463  * Surface roles are given by requests in other interfaces such as
464  * wl_pointer.set_cursor. The request should explicitly mention
465  * that this request gives a role to a wl_surface. Often, this
466  * request also creates a new protocol object that represents the
467  * role and adds additional functionality to wl_surface. When a
468  * client wants to destroy a wl_surface, they must destroy this 'role
469  * object' before the wl_surface.
470  *
471  * Destroying the role object does not remove the role from the
472  * wl_surface, but it may stop the wl_surface from "playing the role".
473  * For instance, if a wl_subsurface object is destroyed, the wl_surface
474  * it was created for will be unmapped and forget its position and
475  * z-order. It is allowed to create a wl_subsurface for the same
476  * wl_surface again, but it is not allowed to use the wl_surface as
477  * a cursor (cursor is a different role than sub-surface, and role
478  * switching is not allowed).
479  * @section page_iface_wl_surface_api API
480  * See @ref iface_wl_surface.
481  */
482 /**
483  * @defgroup iface_wl_surface The wl_surface interface
484  *
485  * A surface is a rectangular area that may be displayed on zero
486  * or more outputs, and shown any number of times at the compositor's
487  * discretion. They can present wl_buffers, receive user input, and
488  * define a local coordinate system.
489  *
490  * The size of a surface (and relative positions on it) is described
491  * in surface-local coordinates, which may differ from the buffer
492  * coordinates of the pixel content, in case a buffer_transform
493  * or a buffer_scale is used.
494  *
495  * A surface without a "role" is fairly useless: a compositor does
496  * not know where, when or how to present it. The role is the
497  * purpose of a wl_surface. Examples of roles are a cursor for a
498  * pointer (as set by wl_pointer.set_cursor), a drag icon
499  * (wl_data_device.start_drag), a sub-surface
500  * (wl_subcompositor.get_subsurface), and a window as defined by a
501  * shell protocol (e.g. wl_shell.get_shell_surface).
502  *
503  * A surface can have only one role at a time. Initially a
504  * wl_surface does not have a role. Once a wl_surface is given a
505  * role, it is set permanently for the whole lifetime of the
506  * wl_surface object. Giving the current role again is allowed,
507  * unless explicitly forbidden by the relevant interface
508  * specification.
509  *
510  * Surface roles are given by requests in other interfaces such as
511  * wl_pointer.set_cursor. The request should explicitly mention
512  * that this request gives a role to a wl_surface. Often, this
513  * request also creates a new protocol object that represents the
514  * role and adds additional functionality to wl_surface. When a
515  * client wants to destroy a wl_surface, they must destroy this 'role
516  * object' before the wl_surface.
517  *
518  * Destroying the role object does not remove the role from the
519  * wl_surface, but it may stop the wl_surface from "playing the role".
520  * For instance, if a wl_subsurface object is destroyed, the wl_surface
521  * it was created for will be unmapped and forget its position and
522  * z-order. It is allowed to create a wl_subsurface for the same
523  * wl_surface again, but it is not allowed to use the wl_surface as
524  * a cursor (cursor is a different role than sub-surface, and role
525  * switching is not allowed).
526  */
527 extern const struct wl_interface wl_surface_interface;
528 /**
529  * @page page_iface_wl_seat wl_seat
530  * @section page_iface_wl_seat_desc Description
531  *
532  * A seat is a group of keyboards, pointer and touch devices. This
533  * object is published as a global during start up, or when such a
534  * device is hot plugged.  A seat typically has a pointer and
535  * maintains a keyboard focus and a pointer focus.
536  * @section page_iface_wl_seat_api API
537  * See @ref iface_wl_seat.
538  */
539 /**
540  * @defgroup iface_wl_seat The wl_seat interface
541  *
542  * A seat is a group of keyboards, pointer and touch devices. This
543  * object is published as a global during start up, or when such a
544  * device is hot plugged.  A seat typically has a pointer and
545  * maintains a keyboard focus and a pointer focus.
546  */
547 extern const struct wl_interface wl_seat_interface;
548 /**
549  * @page page_iface_wl_pointer wl_pointer
550  * @section page_iface_wl_pointer_desc Description
551  *
552  * The wl_pointer interface represents one or more input devices,
553  * such as mice, which control the pointer location and pointer_focus
554  * of a seat.
555  *
556  * The wl_pointer interface generates motion, enter and leave
557  * events for the surfaces that the pointer is located over,
558  * and button and axis events for button presses, button releases
559  * and scrolling.
560  * @section page_iface_wl_pointer_api API
561  * See @ref iface_wl_pointer.
562  */
563 /**
564  * @defgroup iface_wl_pointer The wl_pointer interface
565  *
566  * The wl_pointer interface represents one or more input devices,
567  * such as mice, which control the pointer location and pointer_focus
568  * of a seat.
569  *
570  * The wl_pointer interface generates motion, enter and leave
571  * events for the surfaces that the pointer is located over,
572  * and button and axis events for button presses, button releases
573  * and scrolling.
574  */
575 extern const struct wl_interface wl_pointer_interface;
576 /**
577  * @page page_iface_wl_keyboard wl_keyboard
578  * @section page_iface_wl_keyboard_desc Description
579  *
580  * The wl_keyboard interface represents one or more keyboards
581  * associated with a seat.
582  * @section page_iface_wl_keyboard_api API
583  * See @ref iface_wl_keyboard.
584  */
585 /**
586  * @defgroup iface_wl_keyboard The wl_keyboard interface
587  *
588  * The wl_keyboard interface represents one or more keyboards
589  * associated with a seat.
590  */
591 extern const struct wl_interface wl_keyboard_interface;
592 /**
593  * @page page_iface_wl_touch wl_touch
594  * @section page_iface_wl_touch_desc Description
595  *
596  * The wl_touch interface represents a touchscreen
597  * associated with a seat.
598  *
599  * Touch interactions can consist of one or more contacts.
600  * For each contact, a series of events is generated, starting
601  * with a down event, followed by zero or more motion events,
602  * and ending with an up event. Events relating to the same
603  * contact point can be identified by the ID of the sequence.
604  * @section page_iface_wl_touch_api API
605  * See @ref iface_wl_touch.
606  */
607 /**
608  * @defgroup iface_wl_touch The wl_touch interface
609  *
610  * The wl_touch interface represents a touchscreen
611  * associated with a seat.
612  *
613  * Touch interactions can consist of one or more contacts.
614  * For each contact, a series of events is generated, starting
615  * with a down event, followed by zero or more motion events,
616  * and ending with an up event. Events relating to the same
617  * contact point can be identified by the ID of the sequence.
618  */
619 extern const struct wl_interface wl_touch_interface;
620 /**
621  * @page page_iface_wl_output wl_output
622  * @section page_iface_wl_output_desc Description
623  *
624  * An output describes part of the compositor geometry.  The
625  * compositor works in the 'compositor coordinate system' and an
626  * output corresponds to a rectangular area in that space that is
627  * actually visible.  This typically corresponds to a monitor that
628  * displays part of the compositor space.  This object is published
629  * as global during start up, or when a monitor is hotplugged.
630  * @section page_iface_wl_output_api API
631  * See @ref iface_wl_output.
632  */
633 /**
634  * @defgroup iface_wl_output The wl_output interface
635  *
636  * An output describes part of the compositor geometry.  The
637  * compositor works in the 'compositor coordinate system' and an
638  * output corresponds to a rectangular area in that space that is
639  * actually visible.  This typically corresponds to a monitor that
640  * displays part of the compositor space.  This object is published
641  * as global during start up, or when a monitor is hotplugged.
642  */
643 extern const struct wl_interface wl_output_interface;
644 /**
645  * @page page_iface_wl_region wl_region
646  * @section page_iface_wl_region_desc Description
647  *
648  * A region object describes an area.
649  *
650  * Region objects are used to describe the opaque and input
651  * regions of a surface.
652  * @section page_iface_wl_region_api API
653  * See @ref iface_wl_region.
654  */
655 /**
656  * @defgroup iface_wl_region The wl_region interface
657  *
658  * A region object describes an area.
659  *
660  * Region objects are used to describe the opaque and input
661  * regions of a surface.
662  */
663 extern const struct wl_interface wl_region_interface;
664 /**
665  * @page page_iface_wl_subcompositor wl_subcompositor
666  * @section page_iface_wl_subcompositor_desc Description
667  *
668  * The global interface exposing sub-surface compositing capabilities.
669  * A wl_surface, that has sub-surfaces associated, is called the
670  * parent surface. Sub-surfaces can be arbitrarily nested and create
671  * a tree of sub-surfaces.
672  *
673  * The root surface in a tree of sub-surfaces is the main
674  * surface. The main surface cannot be a sub-surface, because
675  * sub-surfaces must always have a parent.
676  *
677  * A main surface with its sub-surfaces forms a (compound) window.
678  * For window management purposes, this set of wl_surface objects is
679  * to be considered as a single window, and it should also behave as
680  * such.
681  *
682  * The aim of sub-surfaces is to offload some of the compositing work
683  * within a window from clients to the compositor. A prime example is
684  * a video player with decorations and video in separate wl_surface
685  * objects. This should allow the compositor to pass YUV video buffer
686  * processing to dedicated overlay hardware when possible.
687  * @section page_iface_wl_subcompositor_api API
688  * See @ref iface_wl_subcompositor.
689  */
690 /**
691  * @defgroup iface_wl_subcompositor The wl_subcompositor interface
692  *
693  * The global interface exposing sub-surface compositing capabilities.
694  * A wl_surface, that has sub-surfaces associated, is called the
695  * parent surface. Sub-surfaces can be arbitrarily nested and create
696  * a tree of sub-surfaces.
697  *
698  * The root surface in a tree of sub-surfaces is the main
699  * surface. The main surface cannot be a sub-surface, because
700  * sub-surfaces must always have a parent.
701  *
702  * A main surface with its sub-surfaces forms a (compound) window.
703  * For window management purposes, this set of wl_surface objects is
704  * to be considered as a single window, and it should also behave as
705  * such.
706  *
707  * The aim of sub-surfaces is to offload some of the compositing work
708  * within a window from clients to the compositor. A prime example is
709  * a video player with decorations and video in separate wl_surface
710  * objects. This should allow the compositor to pass YUV video buffer
711  * processing to dedicated overlay hardware when possible.
712  */
713 extern const struct wl_interface wl_subcompositor_interface;
714 /**
715  * @page page_iface_wl_subsurface wl_subsurface
716  * @section page_iface_wl_subsurface_desc Description
717  *
718  * An additional interface to a wl_surface object, which has been
719  * made a sub-surface. A sub-surface has one parent surface. A
720  * sub-surface's size and position are not limited to that of the parent.
721  * Particularly, a sub-surface is not automatically clipped to its
722  * parent's area.
723  *
724  * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
725  * and the parent surface is mapped. The order of which one happens
726  * first is irrelevant. A sub-surface is hidden if the parent becomes
727  * hidden, or if a NULL wl_buffer is applied. These rules apply
728  * recursively through the tree of surfaces.
729  *
730  * The behaviour of a wl_surface.commit request on a sub-surface
731  * depends on the sub-surface's mode. The possible modes are
732  * synchronized and desynchronized, see methods
733  * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
734  * mode caches the wl_surface state to be applied when the parent's
735  * state gets applied, and desynchronized mode applies the pending
736  * wl_surface state directly. A sub-surface is initially in the
737  * synchronized mode.
738  *
739  * Sub-surfaces have also other kind of state, which is managed by
740  * wl_subsurface requests, as opposed to wl_surface requests. This
741  * state includes the sub-surface position relative to the parent
742  * surface (wl_subsurface.set_position), and the stacking order of
743  * the parent and its sub-surfaces (wl_subsurface.place_above and
744  * .place_below). This state is applied when the parent surface's
745  * wl_surface state is applied, regardless of the sub-surface's mode.
746  * As the exception, set_sync and set_desync are effective immediately.
747  *
748  * The main surface can be thought to be always in desynchronized mode,
749  * since it does not have a parent in the sub-surfaces sense.
750  *
751  * Even if a sub-surface is in desynchronized mode, it will behave as
752  * in synchronized mode, if its parent surface behaves as in
753  * synchronized mode. This rule is applied recursively throughout the
754  * tree of surfaces. This means, that one can set a sub-surface into
755  * synchronized mode, and then assume that all its child and grand-child
756  * sub-surfaces are synchronized, too, without explicitly setting them.
757  *
758  * If the wl_surface associated with the wl_subsurface is destroyed, the
759  * wl_subsurface object becomes inert. Note, that destroying either object
760  * takes effect immediately. If you need to synchronize the removal
761  * of a sub-surface to the parent surface update, unmap the sub-surface
762  * first by attaching a NULL wl_buffer, update parent, and then destroy
763  * the sub-surface.
764  *
765  * If the parent wl_surface object is destroyed, the sub-surface is
766  * unmapped.
767  * @section page_iface_wl_subsurface_api API
768  * See @ref iface_wl_subsurface.
769  */
770 /**
771  * @defgroup iface_wl_subsurface The wl_subsurface interface
772  *
773  * An additional interface to a wl_surface object, which has been
774  * made a sub-surface. A sub-surface has one parent surface. A
775  * sub-surface's size and position are not limited to that of the parent.
776  * Particularly, a sub-surface is not automatically clipped to its
777  * parent's area.
778  *
779  * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
780  * and the parent surface is mapped. The order of which one happens
781  * first is irrelevant. A sub-surface is hidden if the parent becomes
782  * hidden, or if a NULL wl_buffer is applied. These rules apply
783  * recursively through the tree of surfaces.
784  *
785  * The behaviour of a wl_surface.commit request on a sub-surface
786  * depends on the sub-surface's mode. The possible modes are
787  * synchronized and desynchronized, see methods
788  * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
789  * mode caches the wl_surface state to be applied when the parent's
790  * state gets applied, and desynchronized mode applies the pending
791  * wl_surface state directly. A sub-surface is initially in the
792  * synchronized mode.
793  *
794  * Sub-surfaces have also other kind of state, which is managed by
795  * wl_subsurface requests, as opposed to wl_surface requests. This
796  * state includes the sub-surface position relative to the parent
797  * surface (wl_subsurface.set_position), and the stacking order of
798  * the parent and its sub-surfaces (wl_subsurface.place_above and
799  * .place_below). This state is applied when the parent surface's
800  * wl_surface state is applied, regardless of the sub-surface's mode.
801  * As the exception, set_sync and set_desync are effective immediately.
802  *
803  * The main surface can be thought to be always in desynchronized mode,
804  * since it does not have a parent in the sub-surfaces sense.
805  *
806  * Even if a sub-surface is in desynchronized mode, it will behave as
807  * in synchronized mode, if its parent surface behaves as in
808  * synchronized mode. This rule is applied recursively throughout the
809  * tree of surfaces. This means, that one can set a sub-surface into
810  * synchronized mode, and then assume that all its child and grand-child
811  * sub-surfaces are synchronized, too, without explicitly setting them.
812  *
813  * If the wl_surface associated with the wl_subsurface is destroyed, the
814  * wl_subsurface object becomes inert. Note, that destroying either object
815  * takes effect immediately. If you need to synchronize the removal
816  * of a sub-surface to the parent surface update, unmap the sub-surface
817  * first by attaching a NULL wl_buffer, update parent, and then destroy
818  * the sub-surface.
819  *
820  * If the parent wl_surface object is destroyed, the sub-surface is
821  * unmapped.
822  */
823 extern const struct wl_interface wl_subsurface_interface;
824 
825 #ifndef WL_DISPLAY_ERROR_ENUM
826 #define WL_DISPLAY_ERROR_ENUM
827 /**
828  * @ingroup iface_wl_display
829  * global error values
830  *
831  * These errors are global and can be emitted in response to any
832  * server request.
833  */
834 enum wl_display_error {
835 	/**
836 	 * server couldn't find object
837 	 */
838 	WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
839 	/**
840 	 * method doesn't exist on the specified interface or malformed request
841 	 */
842 	WL_DISPLAY_ERROR_INVALID_METHOD = 1,
843 	/**
844 	 * server is out of memory
845 	 */
846 	WL_DISPLAY_ERROR_NO_MEMORY = 2,
847 	/**
848 	 * implementation error in compositor
849 	 */
850 	WL_DISPLAY_ERROR_IMPLEMENTATION = 3,
851 };
852 #endif /* WL_DISPLAY_ERROR_ENUM */
853 
854 /**
855  * @ingroup iface_wl_display
856  * @struct wl_display_interface
857  */
858 struct wl_display_interface {
859 	/**
860 	 * asynchronous roundtrip
861 	 *
862 	 * The sync request asks the server to emit the 'done' event on
863 	 * the returned wl_callback object. Since requests are handled
864 	 * in-order and events are delivered in-order, this can be used as
865 	 * a barrier to ensure all previous requests and the resulting
866 	 * events have been handled.
867 	 *
868 	 * The object returned by this request will be destroyed by the
869 	 * compositor after the callback is fired and as such the client
870 	 * must not attempt to use it after that point.
871 	 *
872 	 * The callback_data passed in the callback is the event serial.
873 	 * @param callback callback object for the sync request
874 	 */
875 	void (*sync)(struct wl_client *client,
876 		     struct wl_resource *resource,
877 		     uint32_t callback);
878 	/**
879 	 * get global registry object
880 	 *
881 	 * This request creates a registry object that allows the client
882 	 * to list and bind the global objects available from the
883 	 * compositor.
884 	 *
885 	 * It should be noted that the server side resources consumed in
886 	 * response to a get_registry request can only be released when the
887 	 * client disconnects, not when the client side proxy is destroyed.
888 	 * Therefore, clients should invoke get_registry as infrequently as
889 	 * possible to avoid wasting memory.
890 	 * @param registry global registry object
891 	 */
892 	void (*get_registry)(struct wl_client *client,
893 			     struct wl_resource *resource,
894 			     uint32_t registry);
895 };
896 
897 #define WL_DISPLAY_ERROR 0
898 #define WL_DISPLAY_DELETE_ID 1
899 
900 /**
901  * @ingroup iface_wl_display
902  */
903 #define WL_DISPLAY_ERROR_SINCE_VERSION 1
904 /**
905  * @ingroup iface_wl_display
906  */
907 #define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1
908 
909 /**
910  * @ingroup iface_wl_display
911  */
912 #define WL_DISPLAY_SYNC_SINCE_VERSION 1
913 /**
914  * @ingroup iface_wl_display
915  */
916 #define WL_DISPLAY_GET_REGISTRY_SINCE_VERSION 1
917 
918 /**
919  * @ingroup iface_wl_registry
920  * @struct wl_registry_interface
921  */
922 struct wl_registry_interface {
923 	/**
924 	 * bind an object to the display
925 	 *
926 	 * Binds a new, client-created object to the server using the
927 	 * specified name as the identifier.
928 	 * @param name unique numeric name of the object
929 	 * @param interface name of the objects interface
930 	 * @param version version of the objects interface
931 	 * @param id bounded object
932 	 */
933 	void (*bind)(struct wl_client *client,
934 		     struct wl_resource *resource,
935 		     uint32_t name,
936 		     const char *interface, uint32_t version, uint32_t id);
937 };
938 
939 #define WL_REGISTRY_GLOBAL 0
940 #define WL_REGISTRY_GLOBAL_REMOVE 1
941 
942 /**
943  * @ingroup iface_wl_registry
944  */
945 #define WL_REGISTRY_GLOBAL_SINCE_VERSION 1
946 /**
947  * @ingroup iface_wl_registry
948  */
949 #define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1
950 
951 /**
952  * @ingroup iface_wl_registry
953  */
954 #define WL_REGISTRY_BIND_SINCE_VERSION 1
955 
956 /**
957  * @ingroup iface_wl_registry
958  * Sends an global event to the client owning the resource.
959  * @param resource_ The client's resource
960  * @param name numeric name of the global object
961  * @param interface interface implemented by the object
962  * @param version interface version
963  */
964 static inline void
wl_registry_send_global(struct wl_resource * resource_,uint32_t name,const char * interface,uint32_t version)965 wl_registry_send_global(struct wl_resource *resource_, uint32_t name, const char *interface, uint32_t version)
966 {
967 	wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL, name, interface, version);
968 }
969 
970 /**
971  * @ingroup iface_wl_registry
972  * Sends an global_remove event to the client owning the resource.
973  * @param resource_ The client's resource
974  * @param name numeric name of the global object
975  */
976 static inline void
wl_registry_send_global_remove(struct wl_resource * resource_,uint32_t name)977 wl_registry_send_global_remove(struct wl_resource *resource_, uint32_t name)
978 {
979 	wl_resource_post_event(resource_, WL_REGISTRY_GLOBAL_REMOVE, name);
980 }
981 
982 #define WL_CALLBACK_DONE 0
983 
984 /**
985  * @ingroup iface_wl_callback
986  */
987 #define WL_CALLBACK_DONE_SINCE_VERSION 1
988 
989 
990 /**
991  * @ingroup iface_wl_callback
992  * Sends an done event to the client owning the resource.
993  * @param resource_ The client's resource
994  * @param callback_data request-specific data for the callback
995  */
996 static inline void
wl_callback_send_done(struct wl_resource * resource_,uint32_t callback_data)997 wl_callback_send_done(struct wl_resource *resource_, uint32_t callback_data)
998 {
999 	wl_resource_post_event(resource_, WL_CALLBACK_DONE, callback_data);
1000 }
1001 
1002 /**
1003  * @ingroup iface_wl_compositor
1004  * @struct wl_compositor_interface
1005  */
1006 struct wl_compositor_interface {
1007 	/**
1008 	 * create new surface
1009 	 *
1010 	 * Ask the compositor to create a new surface.
1011 	 * @param id the new surface
1012 	 */
1013 	void (*create_surface)(struct wl_client *client,
1014 			       struct wl_resource *resource,
1015 			       uint32_t id);
1016 	/**
1017 	 * create new region
1018 	 *
1019 	 * Ask the compositor to create a new region.
1020 	 * @param id the new region
1021 	 */
1022 	void (*create_region)(struct wl_client *client,
1023 			      struct wl_resource *resource,
1024 			      uint32_t id);
1025 };
1026 
1027 
1028 /**
1029  * @ingroup iface_wl_compositor
1030  */
1031 #define WL_COMPOSITOR_CREATE_SURFACE_SINCE_VERSION 1
1032 /**
1033  * @ingroup iface_wl_compositor
1034  */
1035 #define WL_COMPOSITOR_CREATE_REGION_SINCE_VERSION 1
1036 
1037 /**
1038  * @ingroup iface_wl_shm_pool
1039  * @struct wl_shm_pool_interface
1040  */
1041 struct wl_shm_pool_interface {
1042 	/**
1043 	 * create a buffer from the pool
1044 	 *
1045 	 * Create a wl_buffer object from the pool.
1046 	 *
1047 	 * The buffer is created offset bytes into the pool and has width
1048 	 * and height as specified. The stride argument specifies the
1049 	 * number of bytes from the beginning of one row to the beginning
1050 	 * of the next. The format is the pixel format of the buffer and
1051 	 * must be one of those advertised through the wl_shm.format event.
1052 	 *
1053 	 * A buffer will keep a reference to the pool it was created from
1054 	 * so it is valid to destroy the pool immediately after creating a
1055 	 * buffer from it.
1056 	 * @param id buffer to create
1057 	 * @param offset buffer byte offset within the pool
1058 	 * @param width buffer width, in pixels
1059 	 * @param height buffer height, in pixels
1060 	 * @param stride number of bytes from the beginning of one row to the beginning of the next row
1061 	 * @param format buffer pixel format
1062 	 */
1063 	void (*create_buffer)(struct wl_client *client,
1064 			      struct wl_resource *resource,
1065 			      uint32_t id,
1066 			      int32_t offset,
1067 			      int32_t width,
1068 			      int32_t height,
1069 			      int32_t stride,
1070 			      uint32_t format);
1071 	/**
1072 	 * destroy the pool
1073 	 *
1074 	 * Destroy the shared memory pool.
1075 	 *
1076 	 * The mmapped memory will be released when all buffers that have
1077 	 * been created from this pool are gone.
1078 	 */
1079 	void (*destroy)(struct wl_client *client,
1080 			struct wl_resource *resource);
1081 	/**
1082 	 * change the size of the pool mapping
1083 	 *
1084 	 * This request will cause the server to remap the backing memory
1085 	 * for the pool from the file descriptor passed when the pool was
1086 	 * created, but using the new size. This request can only be used
1087 	 * to make the pool bigger.
1088 	 * @param size new size of the pool, in bytes
1089 	 */
1090 	void (*resize)(struct wl_client *client,
1091 		       struct wl_resource *resource,
1092 		       int32_t size);
1093 };
1094 
1095 
1096 /**
1097  * @ingroup iface_wl_shm_pool
1098  */
1099 #define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION 1
1100 /**
1101  * @ingroup iface_wl_shm_pool
1102  */
1103 #define WL_SHM_POOL_DESTROY_SINCE_VERSION 1
1104 /**
1105  * @ingroup iface_wl_shm_pool
1106  */
1107 #define WL_SHM_POOL_RESIZE_SINCE_VERSION 1
1108 
1109 #ifndef WL_SHM_ERROR_ENUM
1110 #define WL_SHM_ERROR_ENUM
1111 /**
1112  * @ingroup iface_wl_shm
1113  * wl_shm error values
1114  *
1115  * These errors can be emitted in response to wl_shm requests.
1116  */
1117 enum wl_shm_error {
1118 	/**
1119 	 * buffer format is not known
1120 	 */
1121 	WL_SHM_ERROR_INVALID_FORMAT = 0,
1122 	/**
1123 	 * invalid size or stride during pool or buffer creation
1124 	 */
1125 	WL_SHM_ERROR_INVALID_STRIDE = 1,
1126 	/**
1127 	 * mmapping the file descriptor failed
1128 	 */
1129 	WL_SHM_ERROR_INVALID_FD = 2,
1130 };
1131 #endif /* WL_SHM_ERROR_ENUM */
1132 
1133 #ifndef WL_SHM_FORMAT_ENUM
1134 #define WL_SHM_FORMAT_ENUM
1135 /**
1136  * @ingroup iface_wl_shm
1137  * pixel formats
1138  *
1139  * This describes the memory layout of an individual pixel.
1140  *
1141  * All renderers should support argb8888 and xrgb8888 but any other
1142  * formats are optional and may not be supported by the particular
1143  * renderer in use.
1144  *
1145  * The drm format codes match the macros defined in drm_fourcc.h, except
1146  * argb8888 and xrgb8888. The formats actually supported by the compositor
1147  * will be reported by the format event.
1148  */
1149 enum wl_shm_format {
1150 	/**
1151 	 * 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
1152 	 */
1153 	WL_SHM_FORMAT_ARGB8888 = 0,
1154 	/**
1155 	 * 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
1156 	 */
1157 	WL_SHM_FORMAT_XRGB8888 = 1,
1158 	/**
1159 	 * 8-bit color index format, [7:0] C
1160 	 */
1161 	WL_SHM_FORMAT_C8 = 0x20203843,
1162 	/**
1163 	 * 8-bit RGB format, [7:0] R:G:B 3:3:2
1164 	 */
1165 	WL_SHM_FORMAT_RGB332 = 0x38424752,
1166 	/**
1167 	 * 8-bit BGR format, [7:0] B:G:R 2:3:3
1168 	 */
1169 	WL_SHM_FORMAT_BGR233 = 0x38524742,
1170 	/**
1171 	 * 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
1172 	 */
1173 	WL_SHM_FORMAT_XRGB4444 = 0x32315258,
1174 	/**
1175 	 * 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
1176 	 */
1177 	WL_SHM_FORMAT_XBGR4444 = 0x32314258,
1178 	/**
1179 	 * 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
1180 	 */
1181 	WL_SHM_FORMAT_RGBX4444 = 0x32315852,
1182 	/**
1183 	 * 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
1184 	 */
1185 	WL_SHM_FORMAT_BGRX4444 = 0x32315842,
1186 	/**
1187 	 * 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
1188 	 */
1189 	WL_SHM_FORMAT_ARGB4444 = 0x32315241,
1190 	/**
1191 	 * 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
1192 	 */
1193 	WL_SHM_FORMAT_ABGR4444 = 0x32314241,
1194 	/**
1195 	 * 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
1196 	 */
1197 	WL_SHM_FORMAT_RGBA4444 = 0x32314152,
1198 	/**
1199 	 * 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
1200 	 */
1201 	WL_SHM_FORMAT_BGRA4444 = 0x32314142,
1202 	/**
1203 	 * 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
1204 	 */
1205 	WL_SHM_FORMAT_XRGB1555 = 0x35315258,
1206 	/**
1207 	 * 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
1208 	 */
1209 	WL_SHM_FORMAT_XBGR1555 = 0x35314258,
1210 	/**
1211 	 * 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
1212 	 */
1213 	WL_SHM_FORMAT_RGBX5551 = 0x35315852,
1214 	/**
1215 	 * 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
1216 	 */
1217 	WL_SHM_FORMAT_BGRX5551 = 0x35315842,
1218 	/**
1219 	 * 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
1220 	 */
1221 	WL_SHM_FORMAT_ARGB1555 = 0x35315241,
1222 	/**
1223 	 * 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
1224 	 */
1225 	WL_SHM_FORMAT_ABGR1555 = 0x35314241,
1226 	/**
1227 	 * 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
1228 	 */
1229 	WL_SHM_FORMAT_RGBA5551 = 0x35314152,
1230 	/**
1231 	 * 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
1232 	 */
1233 	WL_SHM_FORMAT_BGRA5551 = 0x35314142,
1234 	/**
1235 	 * 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
1236 	 */
1237 	WL_SHM_FORMAT_RGB565 = 0x36314752,
1238 	/**
1239 	 * 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
1240 	 */
1241 	WL_SHM_FORMAT_BGR565 = 0x36314742,
1242 	/**
1243 	 * 24-bit RGB format, [23:0] R:G:B little endian
1244 	 */
1245 	WL_SHM_FORMAT_RGB888 = 0x34324752,
1246 	/**
1247 	 * 24-bit BGR format, [23:0] B:G:R little endian
1248 	 */
1249 	WL_SHM_FORMAT_BGR888 = 0x34324742,
1250 	/**
1251 	 * 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
1252 	 */
1253 	WL_SHM_FORMAT_XBGR8888 = 0x34324258,
1254 	/**
1255 	 * 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
1256 	 */
1257 	WL_SHM_FORMAT_RGBX8888 = 0x34325852,
1258 	/**
1259 	 * 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
1260 	 */
1261 	WL_SHM_FORMAT_BGRX8888 = 0x34325842,
1262 	/**
1263 	 * 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
1264 	 */
1265 	WL_SHM_FORMAT_ABGR8888 = 0x34324241,
1266 	/**
1267 	 * 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
1268 	 */
1269 	WL_SHM_FORMAT_RGBA8888 = 0x34324152,
1270 	/**
1271 	 * 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
1272 	 */
1273 	WL_SHM_FORMAT_BGRA8888 = 0x34324142,
1274 	/**
1275 	 * 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
1276 	 */
1277 	WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
1278 	/**
1279 	 * 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
1280 	 */
1281 	WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
1282 	/**
1283 	 * 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
1284 	 */
1285 	WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
1286 	/**
1287 	 * 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
1288 	 */
1289 	WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
1290 	/**
1291 	 * 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
1292 	 */
1293 	WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
1294 	/**
1295 	 * 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
1296 	 */
1297 	WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
1298 	/**
1299 	 * 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
1300 	 */
1301 	WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
1302 	/**
1303 	 * 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
1304 	 */
1305 	WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
1306 	/**
1307 	 * packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
1308 	 */
1309 	WL_SHM_FORMAT_YUYV = 0x56595559,
1310 	/**
1311 	 * packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
1312 	 */
1313 	WL_SHM_FORMAT_YVYU = 0x55595659,
1314 	/**
1315 	 * packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
1316 	 */
1317 	WL_SHM_FORMAT_UYVY = 0x59565955,
1318 	/**
1319 	 * packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
1320 	 */
1321 	WL_SHM_FORMAT_VYUY = 0x59555956,
1322 	/**
1323 	 * packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
1324 	 */
1325 	WL_SHM_FORMAT_AYUV = 0x56555941,
1326 	/**
1327 	 * 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
1328 	 */
1329 	WL_SHM_FORMAT_NV12 = 0x3231564e,
1330 	/**
1331 	 * 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
1332 	 */
1333 	WL_SHM_FORMAT_NV21 = 0x3132564e,
1334 	/**
1335 	 * 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
1336 	 */
1337 	WL_SHM_FORMAT_NV16 = 0x3631564e,
1338 	/**
1339 	 * 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
1340 	 */
1341 	WL_SHM_FORMAT_NV61 = 0x3136564e,
1342 	/**
1343 	 * 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
1344 	 */
1345 	WL_SHM_FORMAT_YUV410 = 0x39565559,
1346 	/**
1347 	 * 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
1348 	 */
1349 	WL_SHM_FORMAT_YVU410 = 0x39555659,
1350 	/**
1351 	 * 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
1352 	 */
1353 	WL_SHM_FORMAT_YUV411 = 0x31315559,
1354 	/**
1355 	 * 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
1356 	 */
1357 	WL_SHM_FORMAT_YVU411 = 0x31315659,
1358 	/**
1359 	 * 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
1360 	 */
1361 	WL_SHM_FORMAT_YUV420 = 0x32315559,
1362 	/**
1363 	 * 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
1364 	 */
1365 	WL_SHM_FORMAT_YVU420 = 0x32315659,
1366 	/**
1367 	 * 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
1368 	 */
1369 	WL_SHM_FORMAT_YUV422 = 0x36315559,
1370 	/**
1371 	 * 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
1372 	 */
1373 	WL_SHM_FORMAT_YVU422 = 0x36315659,
1374 	/**
1375 	 * 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
1376 	 */
1377 	WL_SHM_FORMAT_YUV444 = 0x34325559,
1378 	/**
1379 	 * 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
1380 	 */
1381 	WL_SHM_FORMAT_YVU444 = 0x34325659,
1382 	/**
1383 	 * [7:0] R
1384 	 */
1385 	WL_SHM_FORMAT_R8 = 0x20203852,
1386 	/**
1387 	 * [15:0] R little endian
1388 	 */
1389 	WL_SHM_FORMAT_R16 = 0x20363152,
1390 	/**
1391 	 * [15:0] R:G 8:8 little endian
1392 	 */
1393 	WL_SHM_FORMAT_RG88 = 0x38384752,
1394 	/**
1395 	 * [15:0] G:R 8:8 little endian
1396 	 */
1397 	WL_SHM_FORMAT_GR88 = 0x38385247,
1398 	/**
1399 	 * [31:0] R:G 16:16 little endian
1400 	 */
1401 	WL_SHM_FORMAT_RG1616 = 0x32334752,
1402 	/**
1403 	 * [31:0] G:R 16:16 little endian
1404 	 */
1405 	WL_SHM_FORMAT_GR1616 = 0x32335247,
1406 	/**
1407 	 * [63:0] x:R:G:B 16:16:16:16 little endian
1408 	 */
1409 	WL_SHM_FORMAT_XRGB16161616F = 0x48345258,
1410 	/**
1411 	 * [63:0] x:B:G:R 16:16:16:16 little endian
1412 	 */
1413 	WL_SHM_FORMAT_XBGR16161616F = 0x48344258,
1414 	/**
1415 	 * [63:0] A:R:G:B 16:16:16:16 little endian
1416 	 */
1417 	WL_SHM_FORMAT_ARGB16161616F = 0x48345241,
1418 	/**
1419 	 * [63:0] A:B:G:R 16:16:16:16 little endian
1420 	 */
1421 	WL_SHM_FORMAT_ABGR16161616F = 0x48344241,
1422 	/**
1423 	 * [31:0] X:Y:Cb:Cr 8:8:8:8 little endian
1424 	 */
1425 	WL_SHM_FORMAT_XYUV8888 = 0x56555958,
1426 	/**
1427 	 * [23:0] Cr:Cb:Y 8:8:8 little endian
1428 	 */
1429 	WL_SHM_FORMAT_VUY888 = 0x34325556,
1430 	/**
1431 	 * Y followed by U then V, 10:10:10. Non-linear modifier only
1432 	 */
1433 	WL_SHM_FORMAT_VUY101010 = 0x30335556,
1434 	/**
1435 	 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels
1436 	 */
1437 	WL_SHM_FORMAT_Y210 = 0x30313259,
1438 	/**
1439 	 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels
1440 	 */
1441 	WL_SHM_FORMAT_Y212 = 0x32313259,
1442 	/**
1443 	 * [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels
1444 	 */
1445 	WL_SHM_FORMAT_Y216 = 0x36313259,
1446 	/**
1447 	 * [31:0] A:Cr:Y:Cb 2:10:10:10 little endian
1448 	 */
1449 	WL_SHM_FORMAT_Y410 = 0x30313459,
1450 	/**
1451 	 * [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
1452 	 */
1453 	WL_SHM_FORMAT_Y412 = 0x32313459,
1454 	/**
1455 	 * [63:0] A:Cr:Y:Cb 16:16:16:16 little endian
1456 	 */
1457 	WL_SHM_FORMAT_Y416 = 0x36313459,
1458 	/**
1459 	 * [31:0] X:Cr:Y:Cb 2:10:10:10 little endian
1460 	 */
1461 	WL_SHM_FORMAT_XVYU2101010 = 0x30335658,
1462 	/**
1463 	 * [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
1464 	 */
1465 	WL_SHM_FORMAT_XVYU12_16161616 = 0x36335658,
1466 	/**
1467 	 * [63:0] X:Cr:Y:Cb 16:16:16:16 little endian
1468 	 */
1469 	WL_SHM_FORMAT_XVYU16161616 = 0x38345658,
1470 	/**
1471 	 * [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
1472 	 */
1473 	WL_SHM_FORMAT_Y0L0 = 0x304c3059,
1474 	/**
1475 	 * [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
1476 	 */
1477 	WL_SHM_FORMAT_X0L0 = 0x304c3058,
1478 	/**
1479 	 * [63:0]   A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian
1480 	 */
1481 	WL_SHM_FORMAT_Y0L2 = 0x324c3059,
1482 	/**
1483 	 * [63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian
1484 	 */
1485 	WL_SHM_FORMAT_X0L2 = 0x324c3058,
1486 	WL_SHM_FORMAT_YUV420_8BIT = 0x38305559,
1487 	WL_SHM_FORMAT_YUV420_10BIT = 0x30315559,
1488 	WL_SHM_FORMAT_XRGB8888_A8 = 0x38415258,
1489 	WL_SHM_FORMAT_XBGR8888_A8 = 0x38414258,
1490 	WL_SHM_FORMAT_RGBX8888_A8 = 0x38415852,
1491 	WL_SHM_FORMAT_BGRX8888_A8 = 0x38415842,
1492 	WL_SHM_FORMAT_RGB888_A8 = 0x38413852,
1493 	WL_SHM_FORMAT_BGR888_A8 = 0x38413842,
1494 	WL_SHM_FORMAT_RGB565_A8 = 0x38413552,
1495 	WL_SHM_FORMAT_BGR565_A8 = 0x38413542,
1496 	/**
1497 	 * non-subsampled Cr:Cb plane
1498 	 */
1499 	WL_SHM_FORMAT_NV24 = 0x3432564e,
1500 	/**
1501 	 * non-subsampled Cb:Cr plane
1502 	 */
1503 	WL_SHM_FORMAT_NV42 = 0x3234564e,
1504 	/**
1505 	 * 2x1 subsampled Cr:Cb plane, 10 bit per channel
1506 	 */
1507 	WL_SHM_FORMAT_P210 = 0x30313250,
1508 	/**
1509 	 * 2x2 subsampled Cr:Cb plane 10 bits per channel
1510 	 */
1511 	WL_SHM_FORMAT_P010 = 0x30313050,
1512 	/**
1513 	 * 2x2 subsampled Cr:Cb plane 12 bits per channel
1514 	 */
1515 	WL_SHM_FORMAT_P012 = 0x32313050,
1516 	/**
1517 	 * 2x2 subsampled Cr:Cb plane 16 bits per channel
1518 	 */
1519 	WL_SHM_FORMAT_P016 = 0x36313050,
1520 };
1521 #endif /* WL_SHM_FORMAT_ENUM */
1522 
1523 /**
1524  * @ingroup iface_wl_shm
1525  * @struct wl_shm_interface
1526  */
1527 struct wl_shm_interface {
1528 	/**
1529 	 * create a shm pool
1530 	 *
1531 	 * Create a new wl_shm_pool object.
1532 	 *
1533 	 * The pool can be used to create shared memory based buffer
1534 	 * objects. The server will mmap size bytes of the passed file
1535 	 * descriptor, to use as backing memory for the pool.
1536 	 * @param id pool to create
1537 	 * @param fd file descriptor for the pool
1538 	 * @param size pool size, in bytes
1539 	 */
1540 	void (*create_pool)(struct wl_client *client,
1541 			    struct wl_resource *resource,
1542 			    uint32_t id,
1543 			    int32_t fd,
1544 			    int32_t size);
1545 };
1546 
1547 #define WL_SHM_FORMAT 0
1548 
1549 /**
1550  * @ingroup iface_wl_shm
1551  */
1552 #define WL_SHM_FORMAT_SINCE_VERSION 1
1553 
1554 /**
1555  * @ingroup iface_wl_shm
1556  */
1557 #define WL_SHM_CREATE_POOL_SINCE_VERSION 1
1558 
1559 /**
1560  * @ingroup iface_wl_shm
1561  * Sends an format event to the client owning the resource.
1562  * @param resource_ The client's resource
1563  * @param format buffer pixel format
1564  */
1565 static inline void
wl_shm_send_format(struct wl_resource * resource_,uint32_t format)1566 wl_shm_send_format(struct wl_resource *resource_, uint32_t format)
1567 {
1568 	wl_resource_post_event(resource_, WL_SHM_FORMAT, format);
1569 }
1570 
1571 /**
1572  * @ingroup iface_wl_buffer
1573  * @struct wl_buffer_interface
1574  */
1575 struct wl_buffer_interface {
1576 	/**
1577 	 * destroy a buffer
1578 	 *
1579 	 * Destroy a buffer. If and how you need to release the backing
1580 	 * storage is defined by the buffer factory interface.
1581 	 *
1582 	 * For possible side-effects to a surface, see wl_surface.attach.
1583 	 */
1584 	void (*destroy)(struct wl_client *client,
1585 			struct wl_resource *resource);
1586 };
1587 
1588 #define WL_BUFFER_RELEASE 0
1589 
1590 /**
1591  * @ingroup iface_wl_buffer
1592  */
1593 #define WL_BUFFER_RELEASE_SINCE_VERSION 1
1594 
1595 /**
1596  * @ingroup iface_wl_buffer
1597  */
1598 #define WL_BUFFER_DESTROY_SINCE_VERSION 1
1599 
1600 /**
1601  * @ingroup iface_wl_buffer
1602  * Sends an release event to the client owning the resource.
1603  * @param resource_ The client's resource
1604  */
1605 static inline void
wl_buffer_send_release(struct wl_resource * resource_)1606 wl_buffer_send_release(struct wl_resource *resource_)
1607 {
1608 	wl_resource_post_event(resource_, WL_BUFFER_RELEASE);
1609 }
1610 
1611 #ifndef WL_DATA_OFFER_ERROR_ENUM
1612 #define WL_DATA_OFFER_ERROR_ENUM
1613 enum wl_data_offer_error {
1614 	/**
1615 	 * finish request was called untimely
1616 	 */
1617 	WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
1618 	/**
1619 	 * action mask contains invalid values
1620 	 */
1621 	WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
1622 	/**
1623 	 * action argument has an invalid value
1624 	 */
1625 	WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
1626 	/**
1627 	 * offer doesn't accept this request
1628 	 */
1629 	WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
1630 };
1631 #endif /* WL_DATA_OFFER_ERROR_ENUM */
1632 
1633 /**
1634  * @ingroup iface_wl_data_offer
1635  * @struct wl_data_offer_interface
1636  */
1637 struct wl_data_offer_interface {
1638 	/**
1639 	 * accept one of the offered mime types
1640 	 *
1641 	 * Indicate that the client can accept the given mime type, or
1642 	 * NULL for not accepted.
1643 	 *
1644 	 * For objects of version 2 or older, this request is used by the
1645 	 * client to give feedback whether the client can receive the given
1646 	 * mime type, or NULL if none is accepted; the feedback does not
1647 	 * determine whether the drag-and-drop operation succeeds or not.
1648 	 *
1649 	 * For objects of version 3 or newer, this request determines the
1650 	 * final result of the drag-and-drop operation. If the end result
1651 	 * is that no mime types were accepted, the drag-and-drop operation
1652 	 * will be cancelled and the corresponding drag source will receive
1653 	 * wl_data_source.cancelled. Clients may still use this event in
1654 	 * conjunction with wl_data_source.action for feedback.
1655 	 * @param serial serial number of the accept request
1656 	 * @param mime_type mime type accepted by the client
1657 	 */
1658 	void (*accept)(struct wl_client *client,
1659 		       struct wl_resource *resource,
1660 		       uint32_t serial,
1661 		       const char *mime_type);
1662 	/**
1663 	 * request that the data is transferred
1664 	 *
1665 	 * To transfer the offered data, the client issues this request
1666 	 * and indicates the mime type it wants to receive. The transfer
1667 	 * happens through the passed file descriptor (typically created
1668 	 * with the pipe system call). The source client writes the data in
1669 	 * the mime type representation requested and then closes the file
1670 	 * descriptor.
1671 	 *
1672 	 * The receiving client reads from the read end of the pipe until
1673 	 * EOF and then closes its end, at which point the transfer is
1674 	 * complete.
1675 	 *
1676 	 * This request may happen multiple times for different mime types,
1677 	 * both before and after wl_data_device.drop. Drag-and-drop
1678 	 * destination clients may preemptively fetch data or examine it
1679 	 * more closely to determine acceptance.
1680 	 * @param mime_type mime type desired by receiver
1681 	 * @param fd file descriptor for data transfer
1682 	 */
1683 	void (*receive)(struct wl_client *client,
1684 			struct wl_resource *resource,
1685 			const char *mime_type,
1686 			int32_t fd);
1687 	/**
1688 	 * destroy data offer
1689 	 *
1690 	 * Destroy the data offer.
1691 	 */
1692 	void (*destroy)(struct wl_client *client,
1693 			struct wl_resource *resource);
1694 	/**
1695 	 * the offer will no longer be used
1696 	 *
1697 	 * Notifies the compositor that the drag destination successfully
1698 	 * finished the drag-and-drop operation.
1699 	 *
1700 	 * Upon receiving this request, the compositor will emit
1701 	 * wl_data_source.dnd_finished on the drag source client.
1702 	 *
1703 	 * It is a client error to perform other requests than
1704 	 * wl_data_offer.destroy after this one. It is also an error to
1705 	 * perform this request after a NULL mime type has been set in
1706 	 * wl_data_offer.accept or no action was received through
1707 	 * wl_data_offer.action.
1708 	 *
1709 	 * If wl_data_offer.finish request is received for a non drag and
1710 	 * drop operation, the invalid_finish protocol error is raised.
1711 	 * @since 3
1712 	 */
1713 	void (*finish)(struct wl_client *client,
1714 		       struct wl_resource *resource);
1715 	/**
1716 	 * set the available/preferred drag-and-drop actions
1717 	 *
1718 	 * Sets the actions that the destination side client supports for
1719 	 * this operation. This request may trigger the emission of
1720 	 * wl_data_source.action and wl_data_offer.action events if the
1721 	 * compositor needs to change the selected action.
1722 	 *
1723 	 * This request can be called multiple times throughout the
1724 	 * drag-and-drop operation, typically in response to
1725 	 * wl_data_device.enter or wl_data_device.motion events.
1726 	 *
1727 	 * This request determines the final result of the drag-and-drop
1728 	 * operation. If the end result is that no action is accepted, the
1729 	 * drag source will receive wl_data_source.cancelled.
1730 	 *
1731 	 * The dnd_actions argument must contain only values expressed in
1732 	 * the wl_data_device_manager.dnd_actions enum, and the
1733 	 * preferred_action argument must only contain one of those values
1734 	 * set, otherwise it will result in a protocol error.
1735 	 *
1736 	 * While managing an "ask" action, the destination drag-and-drop
1737 	 * client may perform further wl_data_offer.receive requests, and
1738 	 * is expected to perform one last wl_data_offer.set_actions
1739 	 * request with a preferred action other than "ask" (and optionally
1740 	 * wl_data_offer.accept) before requesting wl_data_offer.finish, in
1741 	 * order to convey the action selected by the user. If the
1742 	 * preferred action is not in the wl_data_offer.source_actions
1743 	 * mask, an error will be raised.
1744 	 *
1745 	 * If the "ask" action is dismissed (e.g. user cancellation), the
1746 	 * client is expected to perform wl_data_offer.destroy right away.
1747 	 *
1748 	 * This request can only be made on drag-and-drop offers, a
1749 	 * protocol error will be raised otherwise.
1750 	 * @param dnd_actions actions supported by the destination client
1751 	 * @param preferred_action action preferred by the destination client
1752 	 * @since 3
1753 	 */
1754 	void (*set_actions)(struct wl_client *client,
1755 			    struct wl_resource *resource,
1756 			    uint32_t dnd_actions,
1757 			    uint32_t preferred_action);
1758 };
1759 
1760 #define WL_DATA_OFFER_OFFER 0
1761 #define WL_DATA_OFFER_SOURCE_ACTIONS 1
1762 #define WL_DATA_OFFER_ACTION 2
1763 
1764 /**
1765  * @ingroup iface_wl_data_offer
1766  */
1767 #define WL_DATA_OFFER_OFFER_SINCE_VERSION 1
1768 /**
1769  * @ingroup iface_wl_data_offer
1770  */
1771 #define WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION 3
1772 /**
1773  * @ingroup iface_wl_data_offer
1774  */
1775 #define WL_DATA_OFFER_ACTION_SINCE_VERSION 3
1776 
1777 /**
1778  * @ingroup iface_wl_data_offer
1779  */
1780 #define WL_DATA_OFFER_ACCEPT_SINCE_VERSION 1
1781 /**
1782  * @ingroup iface_wl_data_offer
1783  */
1784 #define WL_DATA_OFFER_RECEIVE_SINCE_VERSION 1
1785 /**
1786  * @ingroup iface_wl_data_offer
1787  */
1788 #define WL_DATA_OFFER_DESTROY_SINCE_VERSION 1
1789 /**
1790  * @ingroup iface_wl_data_offer
1791  */
1792 #define WL_DATA_OFFER_FINISH_SINCE_VERSION 3
1793 /**
1794  * @ingroup iface_wl_data_offer
1795  */
1796 #define WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION 3
1797 
1798 /**
1799  * @ingroup iface_wl_data_offer
1800  * Sends an offer event to the client owning the resource.
1801  * @param resource_ The client's resource
1802  * @param mime_type offered mime type
1803  */
1804 static inline void
wl_data_offer_send_offer(struct wl_resource * resource_,const char * mime_type)1805 wl_data_offer_send_offer(struct wl_resource *resource_, const char *mime_type)
1806 {
1807 	wl_resource_post_event(resource_, WL_DATA_OFFER_OFFER, mime_type);
1808 }
1809 
1810 /**
1811  * @ingroup iface_wl_data_offer
1812  * Sends an source_actions event to the client owning the resource.
1813  * @param resource_ The client's resource
1814  * @param source_actions actions offered by the data source
1815  */
1816 static inline void
wl_data_offer_send_source_actions(struct wl_resource * resource_,uint32_t source_actions)1817 wl_data_offer_send_source_actions(struct wl_resource *resource_, uint32_t source_actions)
1818 {
1819 	wl_resource_post_event(resource_, WL_DATA_OFFER_SOURCE_ACTIONS, source_actions);
1820 }
1821 
1822 /**
1823  * @ingroup iface_wl_data_offer
1824  * Sends an action event to the client owning the resource.
1825  * @param resource_ The client's resource
1826  * @param dnd_action action selected by the compositor
1827  */
1828 static inline void
wl_data_offer_send_action(struct wl_resource * resource_,uint32_t dnd_action)1829 wl_data_offer_send_action(struct wl_resource *resource_, uint32_t dnd_action)
1830 {
1831 	wl_resource_post_event(resource_, WL_DATA_OFFER_ACTION, dnd_action);
1832 }
1833 
1834 #ifndef WL_DATA_SOURCE_ERROR_ENUM
1835 #define WL_DATA_SOURCE_ERROR_ENUM
1836 enum wl_data_source_error {
1837 	/**
1838 	 * action mask contains invalid values
1839 	 */
1840 	WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
1841 	/**
1842 	 * source doesn't accept this request
1843 	 */
1844 	WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
1845 };
1846 #endif /* WL_DATA_SOURCE_ERROR_ENUM */
1847 
1848 /**
1849  * @ingroup iface_wl_data_source
1850  * @struct wl_data_source_interface
1851  */
1852 struct wl_data_source_interface {
1853 	/**
1854 	 * add an offered mime type
1855 	 *
1856 	 * This request adds a mime type to the set of mime types
1857 	 * advertised to targets. Can be called several times to offer
1858 	 * multiple types.
1859 	 * @param mime_type mime type offered by the data source
1860 	 */
1861 	void (*offer)(struct wl_client *client,
1862 		      struct wl_resource *resource,
1863 		      const char *mime_type);
1864 	/**
1865 	 * destroy the data source
1866 	 *
1867 	 * Destroy the data source.
1868 	 */
1869 	void (*destroy)(struct wl_client *client,
1870 			struct wl_resource *resource);
1871 	/**
1872 	 * set the available drag-and-drop actions
1873 	 *
1874 	 * Sets the actions that the source side client supports for this
1875 	 * operation. This request may trigger wl_data_source.action and
1876 	 * wl_data_offer.action events if the compositor needs to change
1877 	 * the selected action.
1878 	 *
1879 	 * The dnd_actions argument must contain only values expressed in
1880 	 * the wl_data_device_manager.dnd_actions enum, otherwise it will
1881 	 * result in a protocol error.
1882 	 *
1883 	 * This request must be made once only, and can only be made on
1884 	 * sources used in drag-and-drop, so it must be performed before
1885 	 * wl_data_device.start_drag. Attempting to use the source other
1886 	 * than for drag-and-drop will raise a protocol error.
1887 	 * @param dnd_actions actions supported by the data source
1888 	 * @since 3
1889 	 */
1890 	void (*set_actions)(struct wl_client *client,
1891 			    struct wl_resource *resource,
1892 			    uint32_t dnd_actions);
1893 };
1894 
1895 #define WL_DATA_SOURCE_TARGET 0
1896 #define WL_DATA_SOURCE_SEND 1
1897 #define WL_DATA_SOURCE_CANCELLED 2
1898 #define WL_DATA_SOURCE_DND_DROP_PERFORMED 3
1899 #define WL_DATA_SOURCE_DND_FINISHED 4
1900 #define WL_DATA_SOURCE_ACTION 5
1901 
1902 /**
1903  * @ingroup iface_wl_data_source
1904  */
1905 #define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1
1906 /**
1907  * @ingroup iface_wl_data_source
1908  */
1909 #define WL_DATA_SOURCE_SEND_SINCE_VERSION 1
1910 /**
1911  * @ingroup iface_wl_data_source
1912  */
1913 #define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1
1914 /**
1915  * @ingroup iface_wl_data_source
1916  */
1917 #define WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION 3
1918 /**
1919  * @ingroup iface_wl_data_source
1920  */
1921 #define WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION 3
1922 /**
1923  * @ingroup iface_wl_data_source
1924  */
1925 #define WL_DATA_SOURCE_ACTION_SINCE_VERSION 3
1926 
1927 /**
1928  * @ingroup iface_wl_data_source
1929  */
1930 #define WL_DATA_SOURCE_OFFER_SINCE_VERSION 1
1931 /**
1932  * @ingroup iface_wl_data_source
1933  */
1934 #define WL_DATA_SOURCE_DESTROY_SINCE_VERSION 1
1935 /**
1936  * @ingroup iface_wl_data_source
1937  */
1938 #define WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION 3
1939 
1940 /**
1941  * @ingroup iface_wl_data_source
1942  * Sends an target event to the client owning the resource.
1943  * @param resource_ The client's resource
1944  * @param mime_type mime type accepted by the target
1945  */
1946 static inline void
wl_data_source_send_target(struct wl_resource * resource_,const char * mime_type)1947 wl_data_source_send_target(struct wl_resource *resource_, const char *mime_type)
1948 {
1949 	wl_resource_post_event(resource_, WL_DATA_SOURCE_TARGET, mime_type);
1950 }
1951 
1952 /**
1953  * @ingroup iface_wl_data_source
1954  * Sends an send event to the client owning the resource.
1955  * @param resource_ The client's resource
1956  * @param mime_type mime type for the data
1957  * @param fd file descriptor for the data
1958  */
1959 static inline void
wl_data_source_send_send(struct wl_resource * resource_,const char * mime_type,int32_t fd)1960 wl_data_source_send_send(struct wl_resource *resource_, const char *mime_type, int32_t fd)
1961 {
1962 	wl_resource_post_event(resource_, WL_DATA_SOURCE_SEND, mime_type, fd);
1963 }
1964 
1965 /**
1966  * @ingroup iface_wl_data_source
1967  * Sends an cancelled event to the client owning the resource.
1968  * @param resource_ The client's resource
1969  */
1970 static inline void
wl_data_source_send_cancelled(struct wl_resource * resource_)1971 wl_data_source_send_cancelled(struct wl_resource *resource_)
1972 {
1973 	wl_resource_post_event(resource_, WL_DATA_SOURCE_CANCELLED);
1974 }
1975 
1976 /**
1977  * @ingroup iface_wl_data_source
1978  * Sends an dnd_drop_performed event to the client owning the resource.
1979  * @param resource_ The client's resource
1980  */
1981 static inline void
wl_data_source_send_dnd_drop_performed(struct wl_resource * resource_)1982 wl_data_source_send_dnd_drop_performed(struct wl_resource *resource_)
1983 {
1984 	wl_resource_post_event(resource_, WL_DATA_SOURCE_DND_DROP_PERFORMED);
1985 }
1986 
1987 /**
1988  * @ingroup iface_wl_data_source
1989  * Sends an dnd_finished event to the client owning the resource.
1990  * @param resource_ The client's resource
1991  */
1992 static inline void
wl_data_source_send_dnd_finished(struct wl_resource * resource_)1993 wl_data_source_send_dnd_finished(struct wl_resource *resource_)
1994 {
1995 	wl_resource_post_event(resource_, WL_DATA_SOURCE_DND_FINISHED);
1996 }
1997 
1998 /**
1999  * @ingroup iface_wl_data_source
2000  * Sends an action event to the client owning the resource.
2001  * @param resource_ The client's resource
2002  * @param dnd_action action selected by the compositor
2003  */
2004 static inline void
wl_data_source_send_action(struct wl_resource * resource_,uint32_t dnd_action)2005 wl_data_source_send_action(struct wl_resource *resource_, uint32_t dnd_action)
2006 {
2007 	wl_resource_post_event(resource_, WL_DATA_SOURCE_ACTION, dnd_action);
2008 }
2009 
2010 #ifndef WL_DATA_DEVICE_ERROR_ENUM
2011 #define WL_DATA_DEVICE_ERROR_ENUM
2012 enum wl_data_device_error {
2013 	/**
2014 	 * given wl_surface has another role
2015 	 */
2016 	WL_DATA_DEVICE_ERROR_ROLE = 0,
2017 };
2018 #endif /* WL_DATA_DEVICE_ERROR_ENUM */
2019 
2020 /**
2021  * @ingroup iface_wl_data_device
2022  * @struct wl_data_device_interface
2023  */
2024 struct wl_data_device_interface {
2025 	/**
2026 	 * start drag-and-drop operation
2027 	 *
2028 	 * This request asks the compositor to start a drag-and-drop
2029 	 * operation on behalf of the client.
2030 	 *
2031 	 * The source argument is the data source that provides the data
2032 	 * for the eventual data transfer. If source is NULL, enter, leave
2033 	 * and motion events are sent only to the client that initiated the
2034 	 * drag and the client is expected to handle the data passing
2035 	 * internally.
2036 	 *
2037 	 * The origin surface is the surface where the drag originates and
2038 	 * the client must have an active implicit grab that matches the
2039 	 * serial.
2040 	 *
2041 	 * The icon surface is an optional (can be NULL) surface that
2042 	 * provides an icon to be moved around with the cursor. Initially,
2043 	 * the top-left corner of the icon surface is placed at the cursor
2044 	 * hotspot, but subsequent wl_surface.attach request can move the
2045 	 * relative position. Attach requests must be confirmed with
2046 	 * wl_surface.commit as usual. The icon surface is given the role
2047 	 * of a drag-and-drop icon. If the icon surface already has another
2048 	 * role, it raises a protocol error.
2049 	 *
2050 	 * The current and pending input regions of the icon wl_surface are
2051 	 * cleared, and wl_surface.set_input_region is ignored until the
2052 	 * wl_surface is no longer used as the icon surface. When the use
2053 	 * as an icon ends, the current and pending input regions become
2054 	 * undefined, and the wl_surface is unmapped.
2055 	 * @param source data source for the eventual transfer
2056 	 * @param origin surface where the drag originates
2057 	 * @param icon drag-and-drop icon surface
2058 	 * @param serial serial number of the implicit grab on the origin
2059 	 */
2060 	void (*start_drag)(struct wl_client *client,
2061 			   struct wl_resource *resource,
2062 			   struct wl_resource *source,
2063 			   struct wl_resource *origin,
2064 			   struct wl_resource *icon,
2065 			   uint32_t serial);
2066 	/**
2067 	 * copy data to the selection
2068 	 *
2069 	 * This request asks the compositor to set the selection to the
2070 	 * data from the source on behalf of the client.
2071 	 *
2072 	 * To unset the selection, set the source to NULL.
2073 	 * @param source data source for the selection
2074 	 * @param serial serial number of the event that triggered this request
2075 	 */
2076 	void (*set_selection)(struct wl_client *client,
2077 			      struct wl_resource *resource,
2078 			      struct wl_resource *source,
2079 			      uint32_t serial);
2080 	/**
2081 	 * destroy data device
2082 	 *
2083 	 * This request destroys the data device.
2084 	 * @since 2
2085 	 */
2086 	void (*release)(struct wl_client *client,
2087 			struct wl_resource *resource);
2088 };
2089 
2090 #define WL_DATA_DEVICE_DATA_OFFER 0
2091 #define WL_DATA_DEVICE_ENTER 1
2092 #define WL_DATA_DEVICE_LEAVE 2
2093 #define WL_DATA_DEVICE_MOTION 3
2094 #define WL_DATA_DEVICE_DROP 4
2095 #define WL_DATA_DEVICE_SELECTION 5
2096 
2097 /**
2098  * @ingroup iface_wl_data_device
2099  */
2100 #define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1
2101 /**
2102  * @ingroup iface_wl_data_device
2103  */
2104 #define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1
2105 /**
2106  * @ingroup iface_wl_data_device
2107  */
2108 #define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1
2109 /**
2110  * @ingroup iface_wl_data_device
2111  */
2112 #define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1
2113 /**
2114  * @ingroup iface_wl_data_device
2115  */
2116 #define WL_DATA_DEVICE_DROP_SINCE_VERSION 1
2117 /**
2118  * @ingroup iface_wl_data_device
2119  */
2120 #define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1
2121 
2122 /**
2123  * @ingroup iface_wl_data_device
2124  */
2125 #define WL_DATA_DEVICE_START_DRAG_SINCE_VERSION 1
2126 /**
2127  * @ingroup iface_wl_data_device
2128  */
2129 #define WL_DATA_DEVICE_SET_SELECTION_SINCE_VERSION 1
2130 /**
2131  * @ingroup iface_wl_data_device
2132  */
2133 #define WL_DATA_DEVICE_RELEASE_SINCE_VERSION 2
2134 
2135 /**
2136  * @ingroup iface_wl_data_device
2137  * Sends an data_offer event to the client owning the resource.
2138  * @param resource_ The client's resource
2139  * @param id the new data_offer object
2140  */
2141 static inline void
wl_data_device_send_data_offer(struct wl_resource * resource_,struct wl_resource * id)2142 wl_data_device_send_data_offer(struct wl_resource *resource_, struct wl_resource *id)
2143 {
2144 	wl_resource_post_event(resource_, WL_DATA_DEVICE_DATA_OFFER, id);
2145 }
2146 
2147 /**
2148  * @ingroup iface_wl_data_device
2149  * Sends an enter event to the client owning the resource.
2150  * @param resource_ The client's resource
2151  * @param serial serial number of the enter event
2152  * @param surface client surface entered
2153  * @param x surface-local x coordinate
2154  * @param y surface-local y coordinate
2155  * @param id source data_offer object
2156  */
2157 static inline void
wl_data_device_send_enter(struct wl_resource * resource_,uint32_t serial,struct wl_resource * surface,wl_fixed_t x,wl_fixed_t y,struct wl_resource * id)2158 wl_data_device_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, wl_fixed_t x, wl_fixed_t y, struct wl_resource *id)
2159 {
2160 	wl_resource_post_event(resource_, WL_DATA_DEVICE_ENTER, serial, surface, x, y, id);
2161 }
2162 
2163 /**
2164  * @ingroup iface_wl_data_device
2165  * Sends an leave event to the client owning the resource.
2166  * @param resource_ The client's resource
2167  */
2168 static inline void
wl_data_device_send_leave(struct wl_resource * resource_)2169 wl_data_device_send_leave(struct wl_resource *resource_)
2170 {
2171 	wl_resource_post_event(resource_, WL_DATA_DEVICE_LEAVE);
2172 }
2173 
2174 /**
2175  * @ingroup iface_wl_data_device
2176  * Sends an motion event to the client owning the resource.
2177  * @param resource_ The client's resource
2178  * @param time timestamp with millisecond granularity
2179  * @param x surface-local x coordinate
2180  * @param y surface-local y coordinate
2181  */
2182 static inline void
wl_data_device_send_motion(struct wl_resource * resource_,uint32_t time,wl_fixed_t x,wl_fixed_t y)2183 wl_data_device_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixed_t x, wl_fixed_t y)
2184 {
2185 	wl_resource_post_event(resource_, WL_DATA_DEVICE_MOTION, time, x, y);
2186 }
2187 
2188 /**
2189  * @ingroup iface_wl_data_device
2190  * Sends an drop event to the client owning the resource.
2191  * @param resource_ The client's resource
2192  */
2193 static inline void
wl_data_device_send_drop(struct wl_resource * resource_)2194 wl_data_device_send_drop(struct wl_resource *resource_)
2195 {
2196 	wl_resource_post_event(resource_, WL_DATA_DEVICE_DROP);
2197 }
2198 
2199 /**
2200  * @ingroup iface_wl_data_device
2201  * Sends an selection event to the client owning the resource.
2202  * @param resource_ The client's resource
2203  * @param id selection data_offer object
2204  */
2205 static inline void
wl_data_device_send_selection(struct wl_resource * resource_,struct wl_resource * id)2206 wl_data_device_send_selection(struct wl_resource *resource_, struct wl_resource *id)
2207 {
2208 	wl_resource_post_event(resource_, WL_DATA_DEVICE_SELECTION, id);
2209 }
2210 
2211 #ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2212 #define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
2213 /**
2214  * @ingroup iface_wl_data_device_manager
2215  * drag and drop actions
2216  *
2217  * This is a bitmask of the available/preferred actions in a
2218  * drag-and-drop operation.
2219  *
2220  * In the compositor, the selected action is a result of matching the
2221  * actions offered by the source and destination sides.  "action" events
2222  * with a "none" action will be sent to both source and destination if
2223  * there is no match. All further checks will effectively happen on
2224  * (source actions ∩ destination actions).
2225  *
2226  * In addition, compositors may also pick different actions in
2227  * reaction to key modifiers being pressed. One common design that
2228  * is used in major toolkits (and the behavior recommended for
2229  * compositors) is:
2230  *
2231  * - If no modifiers are pressed, the first match (in bit order)
2232  * will be used.
2233  * - Pressing Shift selects "move", if enabled in the mask.
2234  * - Pressing Control selects "copy", if enabled in the mask.
2235  *
2236  * Behavior beyond that is considered implementation-dependent.
2237  * Compositors may for example bind other modifiers (like Alt/Meta)
2238  * or drags initiated with other buttons than BTN_LEFT to specific
2239  * actions (e.g. "ask").
2240  */
2241 enum wl_data_device_manager_dnd_action {
2242 	/**
2243 	 * no action
2244 	 */
2245 	WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
2246 	/**
2247 	 * copy action
2248 	 */
2249 	WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
2250 	/**
2251 	 * move action
2252 	 */
2253 	WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
2254 	/**
2255 	 * ask action
2256 	 */
2257 	WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
2258 };
2259 #endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
2260 
2261 /**
2262  * @ingroup iface_wl_data_device_manager
2263  * @struct wl_data_device_manager_interface
2264  */
2265 struct wl_data_device_manager_interface {
2266 	/**
2267 	 * create a new data source
2268 	 *
2269 	 * Create a new data source.
2270 	 * @param id data source to create
2271 	 */
2272 	void (*create_data_source)(struct wl_client *client,
2273 				   struct wl_resource *resource,
2274 				   uint32_t id);
2275 	/**
2276 	 * create a new data device
2277 	 *
2278 	 * Create a new data device for a given seat.
2279 	 * @param id data device to create
2280 	 * @param seat seat associated with the data device
2281 	 */
2282 	void (*get_data_device)(struct wl_client *client,
2283 				struct wl_resource *resource,
2284 				uint32_t id,
2285 				struct wl_resource *seat);
2286 };
2287 
2288 
2289 /**
2290  * @ingroup iface_wl_data_device_manager
2291  */
2292 #define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE_SINCE_VERSION 1
2293 /**
2294  * @ingroup iface_wl_data_device_manager
2295  */
2296 #define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE_SINCE_VERSION 1
2297 
2298 #ifndef WL_SHELL_ERROR_ENUM
2299 #define WL_SHELL_ERROR_ENUM
2300 enum wl_shell_error {
2301 	/**
2302 	 * given wl_surface has another role
2303 	 */
2304 	WL_SHELL_ERROR_ROLE = 0,
2305 };
2306 #endif /* WL_SHELL_ERROR_ENUM */
2307 
2308 /**
2309  * @ingroup iface_wl_shell
2310  * @struct wl_shell_interface
2311  */
2312 struct wl_shell_interface {
2313 	/**
2314 	 * create a shell surface from a surface
2315 	 *
2316 	 * Create a shell surface for an existing surface. This gives the
2317 	 * wl_surface the role of a shell surface. If the wl_surface
2318 	 * already has another role, it raises a protocol error.
2319 	 *
2320 	 * Only one shell surface can be associated with a given surface.
2321 	 * @param id shell surface to create
2322 	 * @param surface surface to be given the shell surface role
2323 	 */
2324 	void (*get_shell_surface)(struct wl_client *client,
2325 				  struct wl_resource *resource,
2326 				  uint32_t id,
2327 				  struct wl_resource *surface);
2328 };
2329 
2330 
2331 /**
2332  * @ingroup iface_wl_shell
2333  */
2334 #define WL_SHELL_GET_SHELL_SURFACE_SINCE_VERSION 1
2335 
2336 #ifndef WL_SHELL_SURFACE_RESIZE_ENUM
2337 #define WL_SHELL_SURFACE_RESIZE_ENUM
2338 /**
2339  * @ingroup iface_wl_shell_surface
2340  * edge values for resizing
2341  *
2342  * These values are used to indicate which edge of a surface
2343  * is being dragged in a resize operation. The server may
2344  * use this information to adapt its behavior, e.g. choose
2345  * an appropriate cursor image.
2346  */
2347 enum wl_shell_surface_resize {
2348 	/**
2349 	 * no edge
2350 	 */
2351 	WL_SHELL_SURFACE_RESIZE_NONE = 0,
2352 	/**
2353 	 * top edge
2354 	 */
2355 	WL_SHELL_SURFACE_RESIZE_TOP = 1,
2356 	/**
2357 	 * bottom edge
2358 	 */
2359 	WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
2360 	/**
2361 	 * left edge
2362 	 */
2363 	WL_SHELL_SURFACE_RESIZE_LEFT = 4,
2364 	/**
2365 	 * top and left edges
2366 	 */
2367 	WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
2368 	/**
2369 	 * bottom and left edges
2370 	 */
2371 	WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
2372 	/**
2373 	 * right edge
2374 	 */
2375 	WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
2376 	/**
2377 	 * top and right edges
2378 	 */
2379 	WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
2380 	/**
2381 	 * bottom and right edges
2382 	 */
2383 	WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
2384 };
2385 #endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
2386 
2387 #ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
2388 #define WL_SHELL_SURFACE_TRANSIENT_ENUM
2389 /**
2390  * @ingroup iface_wl_shell_surface
2391  * details of transient behaviour
2392  *
2393  * These flags specify details of the expected behaviour
2394  * of transient surfaces. Used in the set_transient request.
2395  */
2396 enum wl_shell_surface_transient {
2397 	/**
2398 	 * do not set keyboard focus
2399 	 */
2400 	WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
2401 };
2402 #endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
2403 
2404 #ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
2405 #define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
2406 /**
2407  * @ingroup iface_wl_shell_surface
2408  * different method to set the surface fullscreen
2409  *
2410  * Hints to indicate to the compositor how to deal with a conflict
2411  * between the dimensions of the surface and the dimensions of the
2412  * output. The compositor is free to ignore this parameter.
2413  */
2414 enum wl_shell_surface_fullscreen_method {
2415 	/**
2416 	 * no preference, apply default policy
2417 	 */
2418 	WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
2419 	/**
2420 	 * scale, preserve the surface's aspect ratio and center on output
2421 	 */
2422 	WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
2423 	/**
2424 	 * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
2425 	 */
2426 	WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
2427 	/**
2428 	 * no upscaling, center on output and add black borders to compensate size mismatch
2429 	 */
2430 	WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
2431 };
2432 #endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
2433 
2434 /**
2435  * @ingroup iface_wl_shell_surface
2436  * @struct wl_shell_surface_interface
2437  */
2438 struct wl_shell_surface_interface {
2439 	/**
2440 	 * respond to a ping event
2441 	 *
2442 	 * A client must respond to a ping event with a pong request or
2443 	 * the client may be deemed unresponsive.
2444 	 * @param serial serial number of the ping event
2445 	 */
2446 	void (*pong)(struct wl_client *client,
2447 		     struct wl_resource *resource,
2448 		     uint32_t serial);
2449 	/**
2450 	 * start an interactive move
2451 	 *
2452 	 * Start a pointer-driven move of the surface.
2453 	 *
2454 	 * This request must be used in response to a button press event.
2455 	 * The server may ignore move requests depending on the state of
2456 	 * the surface (e.g. fullscreen or maximized).
2457 	 * @param seat seat whose pointer is used
2458 	 * @param serial serial number of the implicit grab on the pointer
2459 	 */
2460 	void (*move)(struct wl_client *client,
2461 		     struct wl_resource *resource,
2462 		     struct wl_resource *seat,
2463 		     uint32_t serial);
2464 	/**
2465 	 * start an interactive resize
2466 	 *
2467 	 * Start a pointer-driven resizing of the surface.
2468 	 *
2469 	 * This request must be used in response to a button press event.
2470 	 * The server may ignore resize requests depending on the state of
2471 	 * the surface (e.g. fullscreen or maximized).
2472 	 * @param seat seat whose pointer is used
2473 	 * @param serial serial number of the implicit grab on the pointer
2474 	 * @param edges which edge or corner is being dragged
2475 	 */
2476 	void (*resize)(struct wl_client *client,
2477 		       struct wl_resource *resource,
2478 		       struct wl_resource *seat,
2479 		       uint32_t serial,
2480 		       uint32_t edges);
2481 	/**
2482 	 * make the surface a toplevel surface
2483 	 *
2484 	 * Map the surface as a toplevel surface.
2485 	 *
2486 	 * A toplevel surface is not fullscreen, maximized or transient.
2487 	 */
2488 	void (*set_toplevel)(struct wl_client *client,
2489 			     struct wl_resource *resource);
2490 	/**
2491 	 * make the surface a transient surface
2492 	 *
2493 	 * Map the surface relative to an existing surface.
2494 	 *
2495 	 * The x and y arguments specify the location of the upper left
2496 	 * corner of the surface relative to the upper left corner of the
2497 	 * parent surface, in surface-local coordinates.
2498 	 *
2499 	 * The flags argument controls details of the transient behaviour.
2500 	 * @param parent parent surface
2501 	 * @param x surface-local x coordinate
2502 	 * @param y surface-local y coordinate
2503 	 * @param flags transient surface behavior
2504 	 */
2505 	void (*set_transient)(struct wl_client *client,
2506 			      struct wl_resource *resource,
2507 			      struct wl_resource *parent,
2508 			      int32_t x,
2509 			      int32_t y,
2510 			      uint32_t flags);
2511 	/**
2512 	 * make the surface a fullscreen surface
2513 	 *
2514 	 * Map the surface as a fullscreen surface.
2515 	 *
2516 	 * If an output parameter is given then the surface will be made
2517 	 * fullscreen on that output. If the client does not specify the
2518 	 * output then the compositor will apply its policy - usually
2519 	 * choosing the output on which the surface has the biggest surface
2520 	 * area.
2521 	 *
2522 	 * The client may specify a method to resolve a size conflict
2523 	 * between the output size and the surface size - this is provided
2524 	 * through the method parameter.
2525 	 *
2526 	 * The framerate parameter is used only when the method is set to
2527 	 * "driver", to indicate the preferred framerate. A value of 0
2528 	 * indicates that the client does not care about framerate. The
2529 	 * framerate is specified in mHz, that is framerate of 60000 is
2530 	 * 60Hz.
2531 	 *
2532 	 * A method of "scale" or "driver" implies a scaling operation of
2533 	 * the surface, either via a direct scaling operation or a change
2534 	 * of the output mode. This will override any kind of output
2535 	 * scaling, so that mapping a surface with a buffer size equal to
2536 	 * the mode can fill the screen independent of buffer_scale.
2537 	 *
2538 	 * A method of "fill" means we don't scale up the buffer, however
2539 	 * any output scale is applied. This means that you may run into an
2540 	 * edge case where the application maps a buffer with the same size
2541 	 * of the output mode but buffer_scale 1 (thus making a surface
2542 	 * larger than the output). In this case it is allowed to downscale
2543 	 * the results to fit the screen.
2544 	 *
2545 	 * The compositor must reply to this request with a configure event
2546 	 * with the dimensions for the output on which the surface will be
2547 	 * made fullscreen.
2548 	 * @param method method for resolving size conflict
2549 	 * @param framerate framerate in mHz
2550 	 * @param output output on which the surface is to be fullscreen
2551 	 */
2552 	void (*set_fullscreen)(struct wl_client *client,
2553 			       struct wl_resource *resource,
2554 			       uint32_t method,
2555 			       uint32_t framerate,
2556 			       struct wl_resource *output);
2557 	/**
2558 	 * make the surface a popup surface
2559 	 *
2560 	 * Map the surface as a popup.
2561 	 *
2562 	 * A popup surface is a transient surface with an added pointer
2563 	 * grab.
2564 	 *
2565 	 * An existing implicit grab will be changed to owner-events mode,
2566 	 * and the popup grab will continue after the implicit grab ends
2567 	 * (i.e. releasing the mouse button does not cause the popup to be
2568 	 * unmapped).
2569 	 *
2570 	 * The popup grab continues until the window is destroyed or a
2571 	 * mouse button is pressed in any other client's window. A click in
2572 	 * any of the client's surfaces is reported as normal, however,
2573 	 * clicks in other clients' surfaces will be discarded and trigger
2574 	 * the callback.
2575 	 *
2576 	 * The x and y arguments specify the location of the upper left
2577 	 * corner of the surface relative to the upper left corner of the
2578 	 * parent surface, in surface-local coordinates.
2579 	 * @param seat seat whose pointer is used
2580 	 * @param serial serial number of the implicit grab on the pointer
2581 	 * @param parent parent surface
2582 	 * @param x surface-local x coordinate
2583 	 * @param y surface-local y coordinate
2584 	 * @param flags transient surface behavior
2585 	 */
2586 	void (*set_popup)(struct wl_client *client,
2587 			  struct wl_resource *resource,
2588 			  struct wl_resource *seat,
2589 			  uint32_t serial,
2590 			  struct wl_resource *parent,
2591 			  int32_t x,
2592 			  int32_t y,
2593 			  uint32_t flags);
2594 	/**
2595 	 * make the surface a maximized surface
2596 	 *
2597 	 * Map the surface as a maximized surface.
2598 	 *
2599 	 * If an output parameter is given then the surface will be
2600 	 * maximized on that output. If the client does not specify the
2601 	 * output then the compositor will apply its policy - usually
2602 	 * choosing the output on which the surface has the biggest surface
2603 	 * area.
2604 	 *
2605 	 * The compositor will reply with a configure event telling the
2606 	 * expected new surface size. The operation is completed on the
2607 	 * next buffer attach to this surface.
2608 	 *
2609 	 * A maximized surface typically fills the entire output it is
2610 	 * bound to, except for desktop elements such as panels. This is
2611 	 * the main difference between a maximized shell surface and a
2612 	 * fullscreen shell surface.
2613 	 *
2614 	 * The details depend on the compositor implementation.
2615 	 * @param output output on which the surface is to be maximized
2616 	 */
2617 	void (*set_maximized)(struct wl_client *client,
2618 			      struct wl_resource *resource,
2619 			      struct wl_resource *output);
2620 	/**
2621 	 * set surface title
2622 	 *
2623 	 * Set a short title for the surface.
2624 	 *
2625 	 * This string may be used to identify the surface in a task bar,
2626 	 * window list, or other user interface elements provided by the
2627 	 * compositor.
2628 	 *
2629 	 * The string must be encoded in UTF-8.
2630 	 * @param title surface title
2631 	 */
2632 	void (*set_title)(struct wl_client *client,
2633 			  struct wl_resource *resource,
2634 			  const char *title);
2635 	/**
2636 	 * set surface class
2637 	 *
2638 	 * Set a class for the surface.
2639 	 *
2640 	 * The surface class identifies the general class of applications
2641 	 * to which the surface belongs. A common convention is to use the
2642 	 * file name (or the full path if it is a non-standard location) of
2643 	 * the application's .desktop file as the class.
2644 	 * @param class_ surface class
2645 	 */
2646 	void (*set_class)(struct wl_client *client,
2647 			  struct wl_resource *resource,
2648 			  const char *class_);
2649 };
2650 
2651 #define WL_SHELL_SURFACE_PING 0
2652 #define WL_SHELL_SURFACE_CONFIGURE 1
2653 #define WL_SHELL_SURFACE_POPUP_DONE 2
2654 
2655 /**
2656  * @ingroup iface_wl_shell_surface
2657  */
2658 #define WL_SHELL_SURFACE_PING_SINCE_VERSION 1
2659 /**
2660  * @ingroup iface_wl_shell_surface
2661  */
2662 #define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1
2663 /**
2664  * @ingroup iface_wl_shell_surface
2665  */
2666 #define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1
2667 
2668 /**
2669  * @ingroup iface_wl_shell_surface
2670  */
2671 #define WL_SHELL_SURFACE_PONG_SINCE_VERSION 1
2672 /**
2673  * @ingroup iface_wl_shell_surface
2674  */
2675 #define WL_SHELL_SURFACE_MOVE_SINCE_VERSION 1
2676 /**
2677  * @ingroup iface_wl_shell_surface
2678  */
2679 #define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION 1
2680 /**
2681  * @ingroup iface_wl_shell_surface
2682  */
2683 #define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION 1
2684 /**
2685  * @ingroup iface_wl_shell_surface
2686  */
2687 #define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION 1
2688 /**
2689  * @ingroup iface_wl_shell_surface
2690  */
2691 #define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
2692 /**
2693  * @ingroup iface_wl_shell_surface
2694  */
2695 #define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION 1
2696 /**
2697  * @ingroup iface_wl_shell_surface
2698  */
2699 #define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
2700 /**
2701  * @ingroup iface_wl_shell_surface
2702  */
2703 #define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION 1
2704 /**
2705  * @ingroup iface_wl_shell_surface
2706  */
2707 #define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION 1
2708 
2709 /**
2710  * @ingroup iface_wl_shell_surface
2711  * Sends an ping event to the client owning the resource.
2712  * @param resource_ The client's resource
2713  * @param serial serial number of the ping
2714  */
2715 static inline void
wl_shell_surface_send_ping(struct wl_resource * resource_,uint32_t serial)2716 wl_shell_surface_send_ping(struct wl_resource *resource_, uint32_t serial)
2717 {
2718 	wl_resource_post_event(resource_, WL_SHELL_SURFACE_PING, serial);
2719 }
2720 
2721 /**
2722  * @ingroup iface_wl_shell_surface
2723  * Sends an configure event to the client owning the resource.
2724  * @param resource_ The client's resource
2725  * @param edges how the surface was resized
2726  * @param width new width of the surface
2727  * @param height new height of the surface
2728  */
2729 static inline void
wl_shell_surface_send_configure(struct wl_resource * resource_,uint32_t edges,int32_t width,int32_t height)2730 wl_shell_surface_send_configure(struct wl_resource *resource_, uint32_t edges, int32_t width, int32_t height)
2731 {
2732 	wl_resource_post_event(resource_, WL_SHELL_SURFACE_CONFIGURE, edges, width, height);
2733 }
2734 
2735 /**
2736  * @ingroup iface_wl_shell_surface
2737  * Sends an popup_done event to the client owning the resource.
2738  * @param resource_ The client's resource
2739  */
2740 static inline void
wl_shell_surface_send_popup_done(struct wl_resource * resource_)2741 wl_shell_surface_send_popup_done(struct wl_resource *resource_)
2742 {
2743 	wl_resource_post_event(resource_, WL_SHELL_SURFACE_POPUP_DONE);
2744 }
2745 
2746 #ifndef WL_SURFACE_ERROR_ENUM
2747 #define WL_SURFACE_ERROR_ENUM
2748 /**
2749  * @ingroup iface_wl_surface
2750  * wl_surface error values
2751  *
2752  * These errors can be emitted in response to wl_surface requests.
2753  */
2754 enum wl_surface_error {
2755 	/**
2756 	 * buffer scale value is invalid
2757 	 */
2758 	WL_SURFACE_ERROR_INVALID_SCALE = 0,
2759 	/**
2760 	 * buffer transform value is invalid
2761 	 */
2762 	WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
2763 };
2764 #endif /* WL_SURFACE_ERROR_ENUM */
2765 
2766 /**
2767  * @ingroup iface_wl_surface
2768  * @struct wl_surface_interface
2769  */
2770 struct wl_surface_interface {
2771 	/**
2772 	 * delete surface
2773 	 *
2774 	 * Deletes the surface and invalidates its object ID.
2775 	 */
2776 	void (*destroy)(struct wl_client *client,
2777 			struct wl_resource *resource);
2778 	/**
2779 	 * set the surface contents
2780 	 *
2781 	 * Set a buffer as the content of this surface.
2782 	 *
2783 	 * The new size of the surface is calculated based on the buffer
2784 	 * size transformed by the inverse buffer_transform and the inverse
2785 	 * buffer_scale. This means that the supplied buffer must be an
2786 	 * integer multiple of the buffer_scale.
2787 	 *
2788 	 * The x and y arguments specify the location of the new pending
2789 	 * buffer's upper left corner, relative to the current buffer's
2790 	 * upper left corner, in surface-local coordinates. In other words,
2791 	 * the x and y, combined with the new surface size define in which
2792 	 * directions the surface's size changes.
2793 	 *
2794 	 * Surface contents are double-buffered state, see
2795 	 * wl_surface.commit.
2796 	 *
2797 	 * The initial surface contents are void; there is no content.
2798 	 * wl_surface.attach assigns the given wl_buffer as the pending
2799 	 * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
2800 	 * surface contents, and the size of the surface becomes the size
2801 	 * calculated from the wl_buffer, as described above. After commit,
2802 	 * there is no pending buffer until the next attach.
2803 	 *
2804 	 * Committing a pending wl_buffer allows the compositor to read the
2805 	 * pixels in the wl_buffer. The compositor may access the pixels at
2806 	 * any time after the wl_surface.commit request. When the
2807 	 * compositor will not access the pixels anymore, it will send the
2808 	 * wl_buffer.release event. Only after receiving wl_buffer.release,
2809 	 * the client may reuse the wl_buffer. A wl_buffer that has been
2810 	 * attached and then replaced by another attach instead of
2811 	 * committed will not receive a release event, and is not used by
2812 	 * the compositor.
2813 	 *
2814 	 * If a pending wl_buffer has been committed to more than one
2815 	 * wl_surface, the delivery of wl_buffer.release events becomes
2816 	 * undefined. A well behaved client should not rely on
2817 	 * wl_buffer.release events in this case. Alternatively, a client
2818 	 * could create multiple wl_buffer objects from the same backing
2819 	 * storage or use wp_linux_buffer_release.
2820 	 *
2821 	 * Destroying the wl_buffer after wl_buffer.release does not change
2822 	 * the surface contents. However, if the client destroys the
2823 	 * wl_buffer before receiving the wl_buffer.release event, the
2824 	 * surface contents become undefined immediately.
2825 	 *
2826 	 * If wl_surface.attach is sent with a NULL wl_buffer, the
2827 	 * following wl_surface.commit will remove the surface content.
2828 	 * @param buffer buffer of surface contents
2829 	 * @param x surface-local x coordinate
2830 	 * @param y surface-local y coordinate
2831 	 */
2832 	void (*attach)(struct wl_client *client,
2833 		       struct wl_resource *resource,
2834 		       struct wl_resource *buffer,
2835 		       int32_t x,
2836 		       int32_t y);
2837 	/**
2838 	 * mark part of the surface damaged
2839 	 *
2840 	 * This request is used to describe the regions where the pending
2841 	 * buffer is different from the current surface contents, and where
2842 	 * the surface therefore needs to be repainted. The compositor
2843 	 * ignores the parts of the damage that fall outside of the
2844 	 * surface.
2845 	 *
2846 	 * Damage is double-buffered state, see wl_surface.commit.
2847 	 *
2848 	 * The damage rectangle is specified in surface-local coordinates,
2849 	 * where x and y specify the upper left corner of the damage
2850 	 * rectangle.
2851 	 *
2852 	 * The initial value for pending damage is empty: no damage.
2853 	 * wl_surface.damage adds pending damage: the new pending damage is
2854 	 * the union of old pending damage and the given rectangle.
2855 	 *
2856 	 * wl_surface.commit assigns pending damage as the current damage,
2857 	 * and clears pending damage. The server will clear the current
2858 	 * damage as it repaints the surface.
2859 	 *
2860 	 * Note! New clients should not use this request. Instead damage
2861 	 * can be posted with wl_surface.damage_buffer which uses buffer
2862 	 * coordinates instead of surface coordinates.
2863 	 * @param x surface-local x coordinate
2864 	 * @param y surface-local y coordinate
2865 	 * @param width width of damage rectangle
2866 	 * @param height height of damage rectangle
2867 	 */
2868 	void (*damage)(struct wl_client *client,
2869 		       struct wl_resource *resource,
2870 		       int32_t x,
2871 		       int32_t y,
2872 		       int32_t width,
2873 		       int32_t height);
2874 	/**
2875 	 * request a frame throttling hint
2876 	 *
2877 	 * Request a notification when it is a good time to start drawing
2878 	 * a new frame, by creating a frame callback. This is useful for
2879 	 * throttling redrawing operations, and driving animations.
2880 	 *
2881 	 * When a client is animating on a wl_surface, it can use the
2882 	 * 'frame' request to get notified when it is a good time to draw
2883 	 * and commit the next frame of animation. If the client commits an
2884 	 * update earlier than that, it is likely that some updates will
2885 	 * not make it to the display, and the client is wasting resources
2886 	 * by drawing too often.
2887 	 *
2888 	 * The frame request will take effect on the next
2889 	 * wl_surface.commit. The notification will only be posted for one
2890 	 * frame unless requested again. For a wl_surface, the
2891 	 * notifications are posted in the order the frame requests were
2892 	 * committed.
2893 	 *
2894 	 * The server must send the notifications so that a client will not
2895 	 * send excessive updates, while still allowing the highest
2896 	 * possible update rate for clients that wait for the reply before
2897 	 * drawing again. The server should give some time for the client
2898 	 * to draw and commit after sending the frame callback events to
2899 	 * let it hit the next output refresh.
2900 	 *
2901 	 * A server should avoid signaling the frame callbacks if the
2902 	 * surface is not visible in any way, e.g. the surface is
2903 	 * off-screen, or completely obscured by other opaque surfaces.
2904 	 *
2905 	 * The object returned by this request will be destroyed by the
2906 	 * compositor after the callback is fired and as such the client
2907 	 * must not attempt to use it after that point.
2908 	 *
2909 	 * The callback_data passed in the callback is the current time, in
2910 	 * milliseconds, with an undefined base.
2911 	 * @param callback callback object for the frame request
2912 	 */
2913 	void (*frame)(struct wl_client *client,
2914 		      struct wl_resource *resource,
2915 		      uint32_t callback);
2916 	/**
2917 	 * set opaque region
2918 	 *
2919 	 * This request sets the region of the surface that contains
2920 	 * opaque content.
2921 	 *
2922 	 * The opaque region is an optimization hint for the compositor
2923 	 * that lets it optimize the redrawing of content behind opaque
2924 	 * regions. Setting an opaque region is not required for correct
2925 	 * behaviour, but marking transparent content as opaque will result
2926 	 * in repaint artifacts.
2927 	 *
2928 	 * The opaque region is specified in surface-local coordinates.
2929 	 *
2930 	 * The compositor ignores the parts of the opaque region that fall
2931 	 * outside of the surface.
2932 	 *
2933 	 * Opaque region is double-buffered state, see wl_surface.commit.
2934 	 *
2935 	 * wl_surface.set_opaque_region changes the pending opaque region.
2936 	 * wl_surface.commit copies the pending region to the current
2937 	 * region. Otherwise, the pending and current regions are never
2938 	 * changed.
2939 	 *
2940 	 * The initial value for an opaque region is empty. Setting the
2941 	 * pending opaque region has copy semantics, and the wl_region
2942 	 * object can be destroyed immediately. A NULL wl_region causes the
2943 	 * pending opaque region to be set to empty.
2944 	 * @param region opaque region of the surface
2945 	 */
2946 	void (*set_opaque_region)(struct wl_client *client,
2947 				  struct wl_resource *resource,
2948 				  struct wl_resource *region);
2949 	/**
2950 	 * set input region
2951 	 *
2952 	 * This request sets the region of the surface that can receive
2953 	 * pointer and touch events.
2954 	 *
2955 	 * Input events happening outside of this region will try the next
2956 	 * surface in the server surface stack. The compositor ignores the
2957 	 * parts of the input region that fall outside of the surface.
2958 	 *
2959 	 * The input region is specified in surface-local coordinates.
2960 	 *
2961 	 * Input region is double-buffered state, see wl_surface.commit.
2962 	 *
2963 	 * wl_surface.set_input_region changes the pending input region.
2964 	 * wl_surface.commit copies the pending region to the current
2965 	 * region. Otherwise the pending and current regions are never
2966 	 * changed, except cursor and icon surfaces are special cases, see
2967 	 * wl_pointer.set_cursor and wl_data_device.start_drag.
2968 	 *
2969 	 * The initial value for an input region is infinite. That means
2970 	 * the whole surface will accept input. Setting the pending input
2971 	 * region has copy semantics, and the wl_region object can be
2972 	 * destroyed immediately. A NULL wl_region causes the input region
2973 	 * to be set to infinite.
2974 	 * @param region input region of the surface
2975 	 */
2976 	void (*set_input_region)(struct wl_client *client,
2977 				 struct wl_resource *resource,
2978 				 struct wl_resource *region);
2979 	/**
2980 	 * commit pending surface state
2981 	 *
2982 	 * Surface state (input, opaque, and damage regions, attached
2983 	 * buffers, etc.) is double-buffered. Protocol requests modify the
2984 	 * pending state, as opposed to the current state in use by the
2985 	 * compositor. A commit request atomically applies all pending
2986 	 * state, replacing the current state. After commit, the new
2987 	 * pending state is as documented for each related request.
2988 	 *
2989 	 * On commit, a pending wl_buffer is applied first, and all other
2990 	 * state second. This means that all coordinates in double-buffered
2991 	 * state are relative to the new wl_buffer coming into use, except
2992 	 * for wl_surface.attach itself. If there is no pending wl_buffer,
2993 	 * the coordinates are relative to the current surface contents.
2994 	 *
2995 	 * All requests that need a commit to become effective are
2996 	 * documented to affect double-buffered state.
2997 	 *
2998 	 * Other interfaces may add further double-buffered surface state.
2999 	 */
3000 	void (*commit)(struct wl_client *client,
3001 		       struct wl_resource *resource);
3002 	/**
3003 	 * sets the buffer transformation
3004 	 *
3005 	 * This request sets an optional transformation on how the
3006 	 * compositor interprets the contents of the buffer attached to the
3007 	 * surface. The accepted values for the transform parameter are the
3008 	 * values for wl_output.transform.
3009 	 *
3010 	 * Buffer transform is double-buffered state, see
3011 	 * wl_surface.commit.
3012 	 *
3013 	 * A newly created surface has its buffer transformation set to
3014 	 * normal.
3015 	 *
3016 	 * wl_surface.set_buffer_transform changes the pending buffer
3017 	 * transformation. wl_surface.commit copies the pending buffer
3018 	 * transformation to the current one. Otherwise, the pending and
3019 	 * current values are never changed.
3020 	 *
3021 	 * The purpose of this request is to allow clients to render
3022 	 * content according to the output transform, thus permitting the
3023 	 * compositor to use certain optimizations even if the display is
3024 	 * rotated. Using hardware overlays and scanning out a client
3025 	 * buffer for fullscreen surfaces are examples of such
3026 	 * optimizations. Those optimizations are highly dependent on the
3027 	 * compositor implementation, so the use of this request should be
3028 	 * considered on a case-by-case basis.
3029 	 *
3030 	 * Note that if the transform value includes 90 or 270 degree
3031 	 * rotation, the width of the buffer will become the surface height
3032 	 * and the height of the buffer will become the surface width.
3033 	 *
3034 	 * If transform is not one of the values from the
3035 	 * wl_output.transform enum the invalid_transform protocol error is
3036 	 * raised.
3037 	 * @param transform transform for interpreting buffer contents
3038 	 * @since 2
3039 	 */
3040 	void (*set_buffer_transform)(struct wl_client *client,
3041 				     struct wl_resource *resource,
3042 				     int32_t transform);
3043 	/**
3044 	 * sets the buffer scaling factor
3045 	 *
3046 	 * This request sets an optional scaling factor on how the
3047 	 * compositor interprets the contents of the buffer attached to the
3048 	 * window.
3049 	 *
3050 	 * Buffer scale is double-buffered state, see wl_surface.commit.
3051 	 *
3052 	 * A newly created surface has its buffer scale set to 1.
3053 	 *
3054 	 * wl_surface.set_buffer_scale changes the pending buffer scale.
3055 	 * wl_surface.commit copies the pending buffer scale to the current
3056 	 * one. Otherwise, the pending and current values are never
3057 	 * changed.
3058 	 *
3059 	 * The purpose of this request is to allow clients to supply higher
3060 	 * resolution buffer data for use on high resolution outputs. It is
3061 	 * intended that you pick the same buffer scale as the scale of the
3062 	 * output that the surface is displayed on. This means the
3063 	 * compositor can avoid scaling when rendering the surface on that
3064 	 * output.
3065 	 *
3066 	 * Note that if the scale is larger than 1, then you have to attach
3067 	 * a buffer that is larger (by a factor of scale in each dimension)
3068 	 * than the desired surface size.
3069 	 *
3070 	 * If scale is not positive the invalid_scale protocol error is
3071 	 * raised.
3072 	 * @param scale positive scale for interpreting buffer contents
3073 	 * @since 3
3074 	 */
3075 	void (*set_buffer_scale)(struct wl_client *client,
3076 				 struct wl_resource *resource,
3077 				 int32_t scale);
3078 	/**
3079 	 * mark part of the surface damaged using buffer coordinates
3080 	 *
3081 	 * This request is used to describe the regions where the pending
3082 	 * buffer is different from the current surface contents, and where
3083 	 * the surface therefore needs to be repainted. The compositor
3084 	 * ignores the parts of the damage that fall outside of the
3085 	 * surface.
3086 	 *
3087 	 * Damage is double-buffered state, see wl_surface.commit.
3088 	 *
3089 	 * The damage rectangle is specified in buffer coordinates, where x
3090 	 * and y specify the upper left corner of the damage rectangle.
3091 	 *
3092 	 * The initial value for pending damage is empty: no damage.
3093 	 * wl_surface.damage_buffer adds pending damage: the new pending
3094 	 * damage is the union of old pending damage and the given
3095 	 * rectangle.
3096 	 *
3097 	 * wl_surface.commit assigns pending damage as the current damage,
3098 	 * and clears pending damage. The server will clear the current
3099 	 * damage as it repaints the surface.
3100 	 *
3101 	 * This request differs from wl_surface.damage in only one way - it
3102 	 * takes damage in buffer coordinates instead of surface-local
3103 	 * coordinates. While this generally is more intuitive than surface
3104 	 * coordinates, it is especially desirable when using wp_viewport
3105 	 * or when a drawing library (like EGL) is unaware of buffer scale
3106 	 * and buffer transform.
3107 	 *
3108 	 * Note: Because buffer transformation changes and damage requests
3109 	 * may be interleaved in the protocol stream, it is impossible to
3110 	 * determine the actual mapping between surface and buffer damage
3111 	 * until wl_surface.commit time. Therefore, compositors wishing to
3112 	 * take both kinds of damage into account will have to accumulate
3113 	 * damage from the two requests separately and only transform from
3114 	 * one to the other after receiving the wl_surface.commit.
3115 	 * @param x buffer-local x coordinate
3116 	 * @param y buffer-local y coordinate
3117 	 * @param width width of damage rectangle
3118 	 * @param height height of damage rectangle
3119 	 * @since 4
3120 	 */
3121 	void (*damage_buffer)(struct wl_client *client,
3122 			      struct wl_resource *resource,
3123 			      int32_t x,
3124 			      int32_t y,
3125 			      int32_t width,
3126 			      int32_t height);
3127 };
3128 
3129 #define WL_SURFACE_ENTER 0
3130 #define WL_SURFACE_LEAVE 1
3131 
3132 /**
3133  * @ingroup iface_wl_surface
3134  */
3135 #define WL_SURFACE_ENTER_SINCE_VERSION 1
3136 /**
3137  * @ingroup iface_wl_surface
3138  */
3139 #define WL_SURFACE_LEAVE_SINCE_VERSION 1
3140 
3141 /**
3142  * @ingroup iface_wl_surface
3143  */
3144 #define WL_SURFACE_DESTROY_SINCE_VERSION 1
3145 /**
3146  * @ingroup iface_wl_surface
3147  */
3148 #define WL_SURFACE_ATTACH_SINCE_VERSION 1
3149 /**
3150  * @ingroup iface_wl_surface
3151  */
3152 #define WL_SURFACE_DAMAGE_SINCE_VERSION 1
3153 /**
3154  * @ingroup iface_wl_surface
3155  */
3156 #define WL_SURFACE_FRAME_SINCE_VERSION 1
3157 /**
3158  * @ingroup iface_wl_surface
3159  */
3160 #define WL_SURFACE_SET_OPAQUE_REGION_SINCE_VERSION 1
3161 /**
3162  * @ingroup iface_wl_surface
3163  */
3164 #define WL_SURFACE_SET_INPUT_REGION_SINCE_VERSION 1
3165 /**
3166  * @ingroup iface_wl_surface
3167  */
3168 #define WL_SURFACE_COMMIT_SINCE_VERSION 1
3169 /**
3170  * @ingroup iface_wl_surface
3171  */
3172 #define WL_SURFACE_SET_BUFFER_TRANSFORM_SINCE_VERSION 2
3173 /**
3174  * @ingroup iface_wl_surface
3175  */
3176 #define WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION 3
3177 /**
3178  * @ingroup iface_wl_surface
3179  */
3180 #define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION 4
3181 
3182 /**
3183  * @ingroup iface_wl_surface
3184  * Sends an enter event to the client owning the resource.
3185  * @param resource_ The client's resource
3186  * @param output output entered by the surface
3187  */
3188 static inline void
wl_surface_send_enter(struct wl_resource * resource_,struct wl_resource * output)3189 wl_surface_send_enter(struct wl_resource *resource_, struct wl_resource *output)
3190 {
3191 	wl_resource_post_event(resource_, WL_SURFACE_ENTER, output);
3192 }
3193 
3194 /**
3195  * @ingroup iface_wl_surface
3196  * Sends an leave event to the client owning the resource.
3197  * @param resource_ The client's resource
3198  * @param output output left by the surface
3199  */
3200 static inline void
wl_surface_send_leave(struct wl_resource * resource_,struct wl_resource * output)3201 wl_surface_send_leave(struct wl_resource *resource_, struct wl_resource *output)
3202 {
3203 	wl_resource_post_event(resource_, WL_SURFACE_LEAVE, output);
3204 }
3205 
3206 #ifndef WL_SEAT_CAPABILITY_ENUM
3207 #define WL_SEAT_CAPABILITY_ENUM
3208 /**
3209  * @ingroup iface_wl_seat
3210  * seat capability bitmask
3211  *
3212  * This is a bitmask of capabilities this seat has; if a member is
3213  * set, then it is present on the seat.
3214  */
3215 enum wl_seat_capability {
3216 	/**
3217 	 * the seat has pointer devices
3218 	 */
3219 	WL_SEAT_CAPABILITY_POINTER = 1,
3220 	/**
3221 	 * the seat has one or more keyboards
3222 	 */
3223 	WL_SEAT_CAPABILITY_KEYBOARD = 2,
3224 	/**
3225 	 * the seat has touch devices
3226 	 */
3227 	WL_SEAT_CAPABILITY_TOUCH = 4,
3228 };
3229 #endif /* WL_SEAT_CAPABILITY_ENUM */
3230 
3231 /**
3232  * @ingroup iface_wl_seat
3233  * @struct wl_seat_interface
3234  */
3235 struct wl_seat_interface {
3236 	/**
3237 	 * return pointer object
3238 	 *
3239 	 * The ID provided will be initialized to the wl_pointer
3240 	 * interface for this seat.
3241 	 *
3242 	 * This request only takes effect if the seat has the pointer
3243 	 * capability, or has had the pointer capability in the past. It is
3244 	 * a protocol violation to issue this request on a seat that has
3245 	 * never had the pointer capability.
3246 	 * @param id seat pointer
3247 	 */
3248 	void (*get_pointer)(struct wl_client *client,
3249 			    struct wl_resource *resource,
3250 			    uint32_t id);
3251 	/**
3252 	 * return keyboard object
3253 	 *
3254 	 * The ID provided will be initialized to the wl_keyboard
3255 	 * interface for this seat.
3256 	 *
3257 	 * This request only takes effect if the seat has the keyboard
3258 	 * capability, or has had the keyboard capability in the past. It
3259 	 * is a protocol violation to issue this request on a seat that has
3260 	 * never had the keyboard capability.
3261 	 * @param id seat keyboard
3262 	 */
3263 	void (*get_keyboard)(struct wl_client *client,
3264 			     struct wl_resource *resource,
3265 			     uint32_t id);
3266 	/**
3267 	 * return touch object
3268 	 *
3269 	 * The ID provided will be initialized to the wl_touch interface
3270 	 * for this seat.
3271 	 *
3272 	 * This request only takes effect if the seat has the touch
3273 	 * capability, or has had the touch capability in the past. It is a
3274 	 * protocol violation to issue this request on a seat that has
3275 	 * never had the touch capability.
3276 	 * @param id seat touch interface
3277 	 */
3278 	void (*get_touch)(struct wl_client *client,
3279 			  struct wl_resource *resource,
3280 			  uint32_t id);
3281 	/**
3282 	 * release the seat object
3283 	 *
3284 	 * Using this request a client can tell the server that it is not
3285 	 * going to use the seat object anymore.
3286 	 * @since 5
3287 	 */
3288 	void (*release)(struct wl_client *client,
3289 			struct wl_resource *resource);
3290 };
3291 
3292 #define WL_SEAT_CAPABILITIES 0
3293 #define WL_SEAT_NAME 1
3294 
3295 /**
3296  * @ingroup iface_wl_seat
3297  */
3298 #define WL_SEAT_CAPABILITIES_SINCE_VERSION 1
3299 /**
3300  * @ingroup iface_wl_seat
3301  */
3302 #define WL_SEAT_NAME_SINCE_VERSION 2
3303 
3304 /**
3305  * @ingroup iface_wl_seat
3306  */
3307 #define WL_SEAT_GET_POINTER_SINCE_VERSION 1
3308 /**
3309  * @ingroup iface_wl_seat
3310  */
3311 #define WL_SEAT_GET_KEYBOARD_SINCE_VERSION 1
3312 /**
3313  * @ingroup iface_wl_seat
3314  */
3315 #define WL_SEAT_GET_TOUCH_SINCE_VERSION 1
3316 /**
3317  * @ingroup iface_wl_seat
3318  */
3319 #define WL_SEAT_RELEASE_SINCE_VERSION 5
3320 
3321 /**
3322  * @ingroup iface_wl_seat
3323  * Sends an capabilities event to the client owning the resource.
3324  * @param resource_ The client's resource
3325  * @param capabilities capabilities of the seat
3326  */
3327 static inline void
wl_seat_send_capabilities(struct wl_resource * resource_,uint32_t capabilities)3328 wl_seat_send_capabilities(struct wl_resource *resource_, uint32_t capabilities)
3329 {
3330 	wl_resource_post_event(resource_, WL_SEAT_CAPABILITIES, capabilities);
3331 }
3332 
3333 /**
3334  * @ingroup iface_wl_seat
3335  * Sends an name event to the client owning the resource.
3336  * @param resource_ The client's resource
3337  * @param name seat identifier
3338  */
3339 static inline void
wl_seat_send_name(struct wl_resource * resource_,const char * name)3340 wl_seat_send_name(struct wl_resource *resource_, const char *name)
3341 {
3342 	wl_resource_post_event(resource_, WL_SEAT_NAME, name);
3343 }
3344 
3345 #ifndef WL_POINTER_ERROR_ENUM
3346 #define WL_POINTER_ERROR_ENUM
3347 enum wl_pointer_error {
3348 	/**
3349 	 * given wl_surface has another role
3350 	 */
3351 	WL_POINTER_ERROR_ROLE = 0,
3352 };
3353 #endif /* WL_POINTER_ERROR_ENUM */
3354 
3355 #ifndef WL_POINTER_BUTTON_STATE_ENUM
3356 #define WL_POINTER_BUTTON_STATE_ENUM
3357 /**
3358  * @ingroup iface_wl_pointer
3359  * physical button state
3360  *
3361  * Describes the physical state of a button that produced the button
3362  * event.
3363  */
3364 enum wl_pointer_button_state {
3365 	/**
3366 	 * the button is not pressed
3367 	 */
3368 	WL_POINTER_BUTTON_STATE_RELEASED = 0,
3369 	/**
3370 	 * the button is pressed
3371 	 */
3372 	WL_POINTER_BUTTON_STATE_PRESSED = 1,
3373 };
3374 #endif /* WL_POINTER_BUTTON_STATE_ENUM */
3375 
3376 #ifndef WL_POINTER_AXIS_ENUM
3377 #define WL_POINTER_AXIS_ENUM
3378 /**
3379  * @ingroup iface_wl_pointer
3380  * axis types
3381  *
3382  * Describes the axis types of scroll events.
3383  */
3384 enum wl_pointer_axis {
3385 	/**
3386 	 * vertical axis
3387 	 */
3388 	WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
3389 	/**
3390 	 * horizontal axis
3391 	 */
3392 	WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
3393 };
3394 #endif /* WL_POINTER_AXIS_ENUM */
3395 
3396 #ifndef WL_POINTER_AXIS_SOURCE_ENUM
3397 #define WL_POINTER_AXIS_SOURCE_ENUM
3398 /**
3399  * @ingroup iface_wl_pointer
3400  * axis source types
3401  *
3402  * Describes the source types for axis events. This indicates to the
3403  * client how an axis event was physically generated; a client may
3404  * adjust the user interface accordingly. For example, scroll events
3405  * from a "finger" source may be in a smooth coordinate space with
3406  * kinetic scrolling whereas a "wheel" source may be in discrete steps
3407  * of a number of lines.
3408  *
3409  * The "continuous" axis source is a device generating events in a
3410  * continuous coordinate space, but using something other than a
3411  * finger. One example for this source is button-based scrolling where
3412  * the vertical motion of a device is converted to scroll events while
3413  * a button is held down.
3414  *
3415  * The "wheel tilt" axis source indicates that the actual device is a
3416  * wheel but the scroll event is not caused by a rotation but a
3417  * (usually sideways) tilt of the wheel.
3418  */
3419 enum wl_pointer_axis_source {
3420 	/**
3421 	 * a physical wheel rotation
3422 	 */
3423 	WL_POINTER_AXIS_SOURCE_WHEEL = 0,
3424 	/**
3425 	 * finger on a touch surface
3426 	 */
3427 	WL_POINTER_AXIS_SOURCE_FINGER = 1,
3428 	/**
3429 	 * continuous coordinate space
3430 	 */
3431 	WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
3432 	/**
3433 	 * a physical wheel tilt
3434 	 * @since 6
3435 	 */
3436 	WL_POINTER_AXIS_SOURCE_WHEEL_TILT = 3,
3437 };
3438 /**
3439  * @ingroup iface_wl_pointer
3440  */
3441 #define WL_POINTER_AXIS_SOURCE_WHEEL_TILT_SINCE_VERSION 6
3442 #endif /* WL_POINTER_AXIS_SOURCE_ENUM */
3443 
3444 /**
3445  * @ingroup iface_wl_pointer
3446  * @struct wl_pointer_interface
3447  */
3448 struct wl_pointer_interface {
3449 	/**
3450 	 * set the pointer surface
3451 	 *
3452 	 * Set the pointer surface, i.e., the surface that contains the
3453 	 * pointer image (cursor). This request gives the surface the role
3454 	 * of a cursor. If the surface already has another role, it raises
3455 	 * a protocol error.
3456 	 *
3457 	 * The cursor actually changes only if the pointer focus for this
3458 	 * device is one of the requesting client's surfaces or the surface
3459 	 * parameter is the current pointer surface. If there was a
3460 	 * previous surface set with this request it is replaced. If
3461 	 * surface is NULL, the pointer image is hidden.
3462 	 *
3463 	 * The parameters hotspot_x and hotspot_y define the position of
3464 	 * the pointer surface relative to the pointer location. Its
3465 	 * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
3466 	 * where (x, y) are the coordinates of the pointer location, in
3467 	 * surface-local coordinates.
3468 	 *
3469 	 * On surface.attach requests to the pointer surface, hotspot_x and
3470 	 * hotspot_y are decremented by the x and y parameters passed to
3471 	 * the request. Attach must be confirmed by wl_surface.commit as
3472 	 * usual.
3473 	 *
3474 	 * The hotspot can also be updated by passing the currently set
3475 	 * pointer surface to this request with new values for hotspot_x
3476 	 * and hotspot_y.
3477 	 *
3478 	 * The current and pending input regions of the wl_surface are
3479 	 * cleared, and wl_surface.set_input_region is ignored until the
3480 	 * wl_surface is no longer used as the cursor. When the use as a
3481 	 * cursor ends, the current and pending input regions become
3482 	 * undefined, and the wl_surface is unmapped.
3483 	 * @param serial serial number of the enter event
3484 	 * @param surface pointer surface
3485 	 * @param hotspot_x surface-local x coordinate
3486 	 * @param hotspot_y surface-local y coordinate
3487 	 */
3488 	void (*set_cursor)(struct wl_client *client,
3489 			   struct wl_resource *resource,
3490 			   uint32_t serial,
3491 			   struct wl_resource *surface,
3492 			   int32_t hotspot_x,
3493 			   int32_t hotspot_y);
3494 	/**
3495 	 * release the pointer object
3496 	 *
3497 	 * Using this request a client can tell the server that it is not
3498 	 * going to use the pointer object anymore.
3499 	 *
3500 	 * This request destroys the pointer proxy object, so clients must
3501 	 * not call wl_pointer_destroy() after using this request.
3502 	 * @since 3
3503 	 */
3504 	void (*release)(struct wl_client *client,
3505 			struct wl_resource *resource);
3506 };
3507 
3508 #define WL_POINTER_ENTER 0
3509 #define WL_POINTER_LEAVE 1
3510 #define WL_POINTER_MOTION 2
3511 #define WL_POINTER_BUTTON 3
3512 #define WL_POINTER_AXIS 4
3513 #define WL_POINTER_FRAME 5
3514 #define WL_POINTER_AXIS_SOURCE 6
3515 #define WL_POINTER_AXIS_STOP 7
3516 #define WL_POINTER_AXIS_DISCRETE 8
3517 
3518 /**
3519  * @ingroup iface_wl_pointer
3520  */
3521 #define WL_POINTER_ENTER_SINCE_VERSION 1
3522 /**
3523  * @ingroup iface_wl_pointer
3524  */
3525 #define WL_POINTER_LEAVE_SINCE_VERSION 1
3526 /**
3527  * @ingroup iface_wl_pointer
3528  */
3529 #define WL_POINTER_MOTION_SINCE_VERSION 1
3530 /**
3531  * @ingroup iface_wl_pointer
3532  */
3533 #define WL_POINTER_BUTTON_SINCE_VERSION 1
3534 /**
3535  * @ingroup iface_wl_pointer
3536  */
3537 #define WL_POINTER_AXIS_SINCE_VERSION 1
3538 /**
3539  * @ingroup iface_wl_pointer
3540  */
3541 #define WL_POINTER_FRAME_SINCE_VERSION 5
3542 /**
3543  * @ingroup iface_wl_pointer
3544  */
3545 #define WL_POINTER_AXIS_SOURCE_SINCE_VERSION 5
3546 /**
3547  * @ingroup iface_wl_pointer
3548  */
3549 #define WL_POINTER_AXIS_STOP_SINCE_VERSION 5
3550 /**
3551  * @ingroup iface_wl_pointer
3552  */
3553 #define WL_POINTER_AXIS_DISCRETE_SINCE_VERSION 5
3554 
3555 /**
3556  * @ingroup iface_wl_pointer
3557  */
3558 #define WL_POINTER_SET_CURSOR_SINCE_VERSION 1
3559 /**
3560  * @ingroup iface_wl_pointer
3561  */
3562 #define WL_POINTER_RELEASE_SINCE_VERSION 3
3563 
3564 /**
3565  * @ingroup iface_wl_pointer
3566  * Sends an enter event to the client owning the resource.
3567  * @param resource_ The client's resource
3568  * @param serial serial number of the enter event
3569  * @param surface surface entered by the pointer
3570  * @param surface_x surface-local x coordinate
3571  * @param surface_y surface-local y coordinate
3572  */
3573 static inline void
wl_pointer_send_enter(struct wl_resource * resource_,uint32_t serial,struct wl_resource * surface,wl_fixed_t surface_x,wl_fixed_t surface_y)3574 wl_pointer_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, wl_fixed_t surface_x, wl_fixed_t surface_y)
3575 {
3576 	wl_resource_post_event(resource_, WL_POINTER_ENTER, serial, surface, surface_x, surface_y);
3577 }
3578 
3579 /**
3580  * @ingroup iface_wl_pointer
3581  * Sends an leave event to the client owning the resource.
3582  * @param resource_ The client's resource
3583  * @param serial serial number of the leave event
3584  * @param surface surface left by the pointer
3585  */
3586 static inline void
wl_pointer_send_leave(struct wl_resource * resource_,uint32_t serial,struct wl_resource * surface)3587 wl_pointer_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface)
3588 {
3589 	wl_resource_post_event(resource_, WL_POINTER_LEAVE, serial, surface);
3590 }
3591 
3592 /**
3593  * @ingroup iface_wl_pointer
3594  * Sends an motion event to the client owning the resource.
3595  * @param resource_ The client's resource
3596  * @param time timestamp with millisecond granularity
3597  * @param surface_x surface-local x coordinate
3598  * @param surface_y surface-local y coordinate
3599  */
3600 static inline void
wl_pointer_send_motion(struct wl_resource * resource_,uint32_t time,wl_fixed_t surface_x,wl_fixed_t surface_y)3601 wl_pointer_send_motion(struct wl_resource *resource_, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y)
3602 {
3603 	wl_resource_post_event(resource_, WL_POINTER_MOTION, time, surface_x, surface_y);
3604 }
3605 
3606 /**
3607  * @ingroup iface_wl_pointer
3608  * Sends an button event to the client owning the resource.
3609  * @param resource_ The client's resource
3610  * @param serial serial number of the button event
3611  * @param time timestamp with millisecond granularity
3612  * @param button button that produced the event
3613  * @param state physical state of the button
3614  */
3615 static inline void
wl_pointer_send_button(struct wl_resource * resource_,uint32_t serial,uint32_t time,uint32_t button,uint32_t state)3616 wl_pointer_send_button(struct wl_resource *resource_, uint32_t serial, uint32_t time, uint32_t button, uint32_t state)
3617 {
3618 	wl_resource_post_event(resource_, WL_POINTER_BUTTON, serial, time, button, state);
3619 }
3620 
3621 /**
3622  * @ingroup iface_wl_pointer
3623  * Sends an axis event to the client owning the resource.
3624  * @param resource_ The client's resource
3625  * @param time timestamp with millisecond granularity
3626  * @param axis axis type
3627  * @param value length of vector in surface-local coordinate space
3628  */
3629 static inline void
wl_pointer_send_axis(struct wl_resource * resource_,uint32_t time,uint32_t axis,wl_fixed_t value)3630 wl_pointer_send_axis(struct wl_resource *resource_, uint32_t time, uint32_t axis, wl_fixed_t value)
3631 {
3632 	wl_resource_post_event(resource_, WL_POINTER_AXIS, time, axis, value);
3633 }
3634 
3635 /**
3636  * @ingroup iface_wl_pointer
3637  * Sends an frame event to the client owning the resource.
3638  * @param resource_ The client's resource
3639  */
3640 static inline void
wl_pointer_send_frame(struct wl_resource * resource_)3641 wl_pointer_send_frame(struct wl_resource *resource_)
3642 {
3643 	wl_resource_post_event(resource_, WL_POINTER_FRAME);
3644 }
3645 
3646 /**
3647  * @ingroup iface_wl_pointer
3648  * Sends an axis_source event to the client owning the resource.
3649  * @param resource_ The client's resource
3650  * @param axis_source source of the axis event
3651  */
3652 static inline void
wl_pointer_send_axis_source(struct wl_resource * resource_,uint32_t axis_source)3653 wl_pointer_send_axis_source(struct wl_resource *resource_, uint32_t axis_source)
3654 {
3655 	wl_resource_post_event(resource_, WL_POINTER_AXIS_SOURCE, axis_source);
3656 }
3657 
3658 /**
3659  * @ingroup iface_wl_pointer
3660  * Sends an axis_stop event to the client owning the resource.
3661  * @param resource_ The client's resource
3662  * @param time timestamp with millisecond granularity
3663  * @param axis the axis stopped with this event
3664  */
3665 static inline void
wl_pointer_send_axis_stop(struct wl_resource * resource_,uint32_t time,uint32_t axis)3666 wl_pointer_send_axis_stop(struct wl_resource *resource_, uint32_t time, uint32_t axis)
3667 {
3668 	wl_resource_post_event(resource_, WL_POINTER_AXIS_STOP, time, axis);
3669 }
3670 
3671 /**
3672  * @ingroup iface_wl_pointer
3673  * Sends an axis_discrete event to the client owning the resource.
3674  * @param resource_ The client's resource
3675  * @param axis axis type
3676  * @param discrete number of steps
3677  */
3678 static inline void
wl_pointer_send_axis_discrete(struct wl_resource * resource_,uint32_t axis,int32_t discrete)3679 wl_pointer_send_axis_discrete(struct wl_resource *resource_, uint32_t axis, int32_t discrete)
3680 {
3681 	wl_resource_post_event(resource_, WL_POINTER_AXIS_DISCRETE, axis, discrete);
3682 }
3683 
3684 #ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
3685 #define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
3686 /**
3687  * @ingroup iface_wl_keyboard
3688  * keyboard mapping format
3689  *
3690  * This specifies the format of the keymap provided to the
3691  * client with the wl_keyboard.keymap event.
3692  */
3693 enum wl_keyboard_keymap_format {
3694 	/**
3695 	 * no keymap; client must understand how to interpret the raw keycode
3696 	 */
3697 	WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
3698 	/**
3699 	 * libxkbcommon compatible; to determine the xkb keycode, clients must add 8 to the key event keycode
3700 	 */
3701 	WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
3702 };
3703 #endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
3704 
3705 #ifndef WL_KEYBOARD_KEY_STATE_ENUM
3706 #define WL_KEYBOARD_KEY_STATE_ENUM
3707 /**
3708  * @ingroup iface_wl_keyboard
3709  * physical key state
3710  *
3711  * Describes the physical state of a key that produced the key event.
3712  */
3713 enum wl_keyboard_key_state {
3714 	/**
3715 	 * key is not pressed
3716 	 */
3717 	WL_KEYBOARD_KEY_STATE_RELEASED = 0,
3718 	/**
3719 	 * key is pressed
3720 	 */
3721 	WL_KEYBOARD_KEY_STATE_PRESSED = 1,
3722 };
3723 #endif /* WL_KEYBOARD_KEY_STATE_ENUM */
3724 
3725 /**
3726  * @ingroup iface_wl_keyboard
3727  * @struct wl_keyboard_interface
3728  */
3729 struct wl_keyboard_interface {
3730 	/**
3731 	 * release the keyboard object
3732 	 *
3733 	 *
3734 	 * @since 3
3735 	 */
3736 	void (*release)(struct wl_client *client,
3737 			struct wl_resource *resource);
3738 };
3739 
3740 #define WL_KEYBOARD_KEYMAP 0
3741 #define WL_KEYBOARD_ENTER 1
3742 #define WL_KEYBOARD_LEAVE 2
3743 #define WL_KEYBOARD_KEY 3
3744 #define WL_KEYBOARD_MODIFIERS 4
3745 #define WL_KEYBOARD_REPEAT_INFO 5
3746 
3747 /**
3748  * @ingroup iface_wl_keyboard
3749  */
3750 #define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1
3751 /**
3752  * @ingroup iface_wl_keyboard
3753  */
3754 #define WL_KEYBOARD_ENTER_SINCE_VERSION 1
3755 /**
3756  * @ingroup iface_wl_keyboard
3757  */
3758 #define WL_KEYBOARD_LEAVE_SINCE_VERSION 1
3759 /**
3760  * @ingroup iface_wl_keyboard
3761  */
3762 #define WL_KEYBOARD_KEY_SINCE_VERSION 1
3763 /**
3764  * @ingroup iface_wl_keyboard
3765  */
3766 #define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1
3767 /**
3768  * @ingroup iface_wl_keyboard
3769  */
3770 #define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4
3771 
3772 /**
3773  * @ingroup iface_wl_keyboard
3774  */
3775 #define WL_KEYBOARD_RELEASE_SINCE_VERSION 3
3776 
3777 /**
3778  * @ingroup iface_wl_keyboard
3779  * Sends an keymap event to the client owning the resource.
3780  * @param resource_ The client's resource
3781  * @param format keymap format
3782  * @param fd keymap file descriptor
3783  * @param size keymap size, in bytes
3784  */
3785 static inline void
wl_keyboard_send_keymap(struct wl_resource * resource_,uint32_t format,int32_t fd,uint32_t size)3786 wl_keyboard_send_keymap(struct wl_resource *resource_, uint32_t format, int32_t fd, uint32_t size)
3787 {
3788 	wl_resource_post_event(resource_, WL_KEYBOARD_KEYMAP, format, fd, size);
3789 }
3790 
3791 /**
3792  * @ingroup iface_wl_keyboard
3793  * Sends an enter event to the client owning the resource.
3794  * @param resource_ The client's resource
3795  * @param serial serial number of the enter event
3796  * @param surface surface gaining keyboard focus
3797  * @param keys the currently pressed keys
3798  */
3799 static inline void
wl_keyboard_send_enter(struct wl_resource * resource_,uint32_t serial,struct wl_resource * surface,struct wl_array * keys)3800 wl_keyboard_send_enter(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface, struct wl_array *keys)
3801 {
3802 	wl_resource_post_event(resource_, WL_KEYBOARD_ENTER, serial, surface, keys);
3803 }
3804 
3805 /**
3806  * @ingroup iface_wl_keyboard
3807  * Sends an leave event to the client owning the resource.
3808  * @param resource_ The client's resource
3809  * @param serial serial number of the leave event
3810  * @param surface surface that lost keyboard focus
3811  */
3812 static inline void
wl_keyboard_send_leave(struct wl_resource * resource_,uint32_t serial,struct wl_resource * surface)3813 wl_keyboard_send_leave(struct wl_resource *resource_, uint32_t serial, struct wl_resource *surface)
3814 {
3815 	wl_resource_post_event(resource_, WL_KEYBOARD_LEAVE, serial, surface);
3816 }
3817 
3818 /**
3819  * @ingroup iface_wl_keyboard
3820  * Sends an key event to the client owning the resource.
3821  * @param resource_ The client's resource
3822  * @param serial serial number of the key event
3823  * @param time timestamp with millisecond granularity
3824  * @param key key that produced the event
3825  * @param state physical state of the key
3826  */
3827 static inline void
wl_keyboard_send_key(struct wl_resource * resource_,uint32_t serial,uint32_t time,uint32_t key,uint32_t state)3828 wl_keyboard_send_key(struct wl_resource *resource_, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
3829 {
3830 	wl_resource_post_event(resource_, WL_KEYBOARD_KEY, serial, time, key, state);
3831 }
3832 
3833 /**
3834  * @ingroup iface_wl_keyboard
3835  * Sends an modifiers event to the client owning the resource.
3836  * @param resource_ The client's resource
3837  * @param serial serial number of the modifiers event
3838  * @param mods_depressed depressed modifiers
3839  * @param mods_latched latched modifiers
3840  * @param mods_locked locked modifiers
3841  * @param group keyboard layout
3842  */
3843 static inline void
wl_keyboard_send_modifiers(struct wl_resource * resource_,uint32_t serial,uint32_t mods_depressed,uint32_t mods_latched,uint32_t mods_locked,uint32_t group)3844 wl_keyboard_send_modifiers(struct wl_resource *resource_, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
3845 {
3846 	wl_resource_post_event(resource_, WL_KEYBOARD_MODIFIERS, serial, mods_depressed, mods_latched, mods_locked, group);
3847 }
3848 
3849 /**
3850  * @ingroup iface_wl_keyboard
3851  * Sends an repeat_info event to the client owning the resource.
3852  * @param resource_ The client's resource
3853  * @param rate the rate of repeating keys in characters per second
3854  * @param delay delay in milliseconds since key down until repeating starts
3855  */
3856 static inline void
wl_keyboard_send_repeat_info(struct wl_resource * resource_,int32_t rate,int32_t delay)3857 wl_keyboard_send_repeat_info(struct wl_resource *resource_, int32_t rate, int32_t delay)
3858 {
3859 	wl_resource_post_event(resource_, WL_KEYBOARD_REPEAT_INFO, rate, delay);
3860 }
3861 
3862 /**
3863  * @ingroup iface_wl_touch
3864  * @struct wl_touch_interface
3865  */
3866 struct wl_touch_interface {
3867 	/**
3868 	 * release the touch object
3869 	 *
3870 	 *
3871 	 * @since 3
3872 	 */
3873 	void (*release)(struct wl_client *client,
3874 			struct wl_resource *resource);
3875 };
3876 
3877 #define WL_TOUCH_DOWN 0
3878 #define WL_TOUCH_UP 1
3879 #define WL_TOUCH_MOTION 2
3880 #define WL_TOUCH_FRAME 3
3881 #define WL_TOUCH_CANCEL 4
3882 #define WL_TOUCH_SHAPE 5
3883 #define WL_TOUCH_ORIENTATION 6
3884 
3885 /**
3886  * @ingroup iface_wl_touch
3887  */
3888 #define WL_TOUCH_DOWN_SINCE_VERSION 1
3889 /**
3890  * @ingroup iface_wl_touch
3891  */
3892 #define WL_TOUCH_UP_SINCE_VERSION 1
3893 /**
3894  * @ingroup iface_wl_touch
3895  */
3896 #define WL_TOUCH_MOTION_SINCE_VERSION 1
3897 /**
3898  * @ingroup iface_wl_touch
3899  */
3900 #define WL_TOUCH_FRAME_SINCE_VERSION 1
3901 /**
3902  * @ingroup iface_wl_touch
3903  */
3904 #define WL_TOUCH_CANCEL_SINCE_VERSION 1
3905 /**
3906  * @ingroup iface_wl_touch
3907  */
3908 #define WL_TOUCH_SHAPE_SINCE_VERSION 6
3909 /**
3910  * @ingroup iface_wl_touch
3911  */
3912 #define WL_TOUCH_ORIENTATION_SINCE_VERSION 6
3913 
3914 /**
3915  * @ingroup iface_wl_touch
3916  */
3917 #define WL_TOUCH_RELEASE_SINCE_VERSION 3
3918 
3919 /**
3920  * @ingroup iface_wl_touch
3921  * Sends an down event to the client owning the resource.
3922  * @param resource_ The client's resource
3923  * @param serial serial number of the touch down event
3924  * @param time timestamp with millisecond granularity
3925  * @param surface surface touched
3926  * @param id the unique ID of this touch point
3927  * @param x surface-local x coordinate
3928  * @param y surface-local y coordinate
3929  */
3930 static inline void
wl_touch_send_down(struct wl_resource * resource_,uint32_t serial,uint32_t time,struct wl_resource * surface,int32_t id,wl_fixed_t x,wl_fixed_t y)3931 wl_touch_send_down(struct wl_resource *resource_, uint32_t serial, uint32_t time, struct wl_resource *surface, int32_t id, wl_fixed_t x, wl_fixed_t y)
3932 {
3933 	wl_resource_post_event(resource_, WL_TOUCH_DOWN, serial, time, surface, id, x, y);
3934 }
3935 
3936 /**
3937  * @ingroup iface_wl_touch
3938  * Sends an up event to the client owning the resource.
3939  * @param resource_ The client's resource
3940  * @param serial serial number of the touch up event
3941  * @param time timestamp with millisecond granularity
3942  * @param id the unique ID of this touch point
3943  */
3944 static inline void
wl_touch_send_up(struct wl_resource * resource_,uint32_t serial,uint32_t time,int32_t id)3945 wl_touch_send_up(struct wl_resource *resource_, uint32_t serial, uint32_t time, int32_t id)
3946 {
3947 	wl_resource_post_event(resource_, WL_TOUCH_UP, serial, time, id);
3948 }
3949 
3950 /**
3951  * @ingroup iface_wl_touch
3952  * Sends an motion event to the client owning the resource.
3953  * @param resource_ The client's resource
3954  * @param time timestamp with millisecond granularity
3955  * @param id the unique ID of this touch point
3956  * @param x surface-local x coordinate
3957  * @param y surface-local y coordinate
3958  */
3959 static inline void
wl_touch_send_motion(struct wl_resource * resource_,uint32_t time,int32_t id,wl_fixed_t x,wl_fixed_t y)3960 wl_touch_send_motion(struct wl_resource *resource_, uint32_t time, int32_t id, wl_fixed_t x, wl_fixed_t y)
3961 {
3962 	wl_resource_post_event(resource_, WL_TOUCH_MOTION, time, id, x, y);
3963 }
3964 
3965 /**
3966  * @ingroup iface_wl_touch
3967  * Sends an frame event to the client owning the resource.
3968  * @param resource_ The client's resource
3969  */
3970 static inline void
wl_touch_send_frame(struct wl_resource * resource_)3971 wl_touch_send_frame(struct wl_resource *resource_)
3972 {
3973 	wl_resource_post_event(resource_, WL_TOUCH_FRAME);
3974 }
3975 
3976 /**
3977  * @ingroup iface_wl_touch
3978  * Sends an cancel event to the client owning the resource.
3979  * @param resource_ The client's resource
3980  */
3981 static inline void
wl_touch_send_cancel(struct wl_resource * resource_)3982 wl_touch_send_cancel(struct wl_resource *resource_)
3983 {
3984 	wl_resource_post_event(resource_, WL_TOUCH_CANCEL);
3985 }
3986 
3987 /**
3988  * @ingroup iface_wl_touch
3989  * Sends an shape event to the client owning the resource.
3990  * @param resource_ The client's resource
3991  * @param id the unique ID of this touch point
3992  * @param major length of the major axis in surface-local coordinates
3993  * @param minor length of the minor axis in surface-local coordinates
3994  */
3995 static inline void
wl_touch_send_shape(struct wl_resource * resource_,int32_t id,wl_fixed_t major,wl_fixed_t minor)3996 wl_touch_send_shape(struct wl_resource *resource_, int32_t id, wl_fixed_t major, wl_fixed_t minor)
3997 {
3998 	wl_resource_post_event(resource_, WL_TOUCH_SHAPE, id, major, minor);
3999 }
4000 
4001 /**
4002  * @ingroup iface_wl_touch
4003  * Sends an orientation event to the client owning the resource.
4004  * @param resource_ The client's resource
4005  * @param id the unique ID of this touch point
4006  * @param orientation angle between major axis and positive surface y-axis in degrees
4007  */
4008 static inline void
wl_touch_send_orientation(struct wl_resource * resource_,int32_t id,wl_fixed_t orientation)4009 wl_touch_send_orientation(struct wl_resource *resource_, int32_t id, wl_fixed_t orientation)
4010 {
4011 	wl_resource_post_event(resource_, WL_TOUCH_ORIENTATION, id, orientation);
4012 }
4013 
4014 #ifndef WL_OUTPUT_SUBPIXEL_ENUM
4015 #define WL_OUTPUT_SUBPIXEL_ENUM
4016 /**
4017  * @ingroup iface_wl_output
4018  * subpixel geometry information
4019  *
4020  * This enumeration describes how the physical
4021  * pixels on an output are laid out.
4022  */
4023 enum wl_output_subpixel {
4024 	/**
4025 	 * unknown geometry
4026 	 */
4027 	WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
4028 	/**
4029 	 * no geometry
4030 	 */
4031 	WL_OUTPUT_SUBPIXEL_NONE = 1,
4032 	/**
4033 	 * horizontal RGB
4034 	 */
4035 	WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
4036 	/**
4037 	 * horizontal BGR
4038 	 */
4039 	WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
4040 	/**
4041 	 * vertical RGB
4042 	 */
4043 	WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
4044 	/**
4045 	 * vertical BGR
4046 	 */
4047 	WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
4048 };
4049 #endif /* WL_OUTPUT_SUBPIXEL_ENUM */
4050 
4051 #ifndef WL_OUTPUT_TRANSFORM_ENUM
4052 #define WL_OUTPUT_TRANSFORM_ENUM
4053 /**
4054  * @ingroup iface_wl_output
4055  * transform from framebuffer to output
4056  *
4057  * This describes the transform that a compositor will apply to a
4058  * surface to compensate for the rotation or mirroring of an
4059  * output device.
4060  *
4061  * The flipped values correspond to an initial flip around a
4062  * vertical axis followed by rotation.
4063  *
4064  * The purpose is mainly to allow clients to render accordingly and
4065  * tell the compositor, so that for fullscreen surfaces, the
4066  * compositor will still be able to scan out directly from client
4067  * surfaces.
4068  */
4069 enum wl_output_transform {
4070 	/**
4071 	 * no transform
4072 	 */
4073 	WL_OUTPUT_TRANSFORM_NORMAL = 0,
4074 	/**
4075 	 * 90 degrees counter-clockwise
4076 	 */
4077 	WL_OUTPUT_TRANSFORM_90 = 1,
4078 	/**
4079 	 * 180 degrees counter-clockwise
4080 	 */
4081 	WL_OUTPUT_TRANSFORM_180 = 2,
4082 	/**
4083 	 * 270 degrees counter-clockwise
4084 	 */
4085 	WL_OUTPUT_TRANSFORM_270 = 3,
4086 	/**
4087 	 * 180 degree flip around a vertical axis
4088 	 */
4089 	WL_OUTPUT_TRANSFORM_FLIPPED = 4,
4090 	/**
4091 	 * flip and rotate 90 degrees counter-clockwise
4092 	 */
4093 	WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
4094 	/**
4095 	 * flip and rotate 180 degrees counter-clockwise
4096 	 */
4097 	WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
4098 	/**
4099 	 * flip and rotate 270 degrees counter-clockwise
4100 	 */
4101 	WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
4102 };
4103 #endif /* WL_OUTPUT_TRANSFORM_ENUM */
4104 
4105 #ifndef WL_OUTPUT_MODE_ENUM
4106 #define WL_OUTPUT_MODE_ENUM
4107 /**
4108  * @ingroup iface_wl_output
4109  * mode information
4110  *
4111  * These flags describe properties of an output mode.
4112  * They are used in the flags bitfield of the mode event.
4113  */
4114 enum wl_output_mode {
4115 	/**
4116 	 * indicates this is the current mode
4117 	 */
4118 	WL_OUTPUT_MODE_CURRENT = 0x1,
4119 	/**
4120 	 * indicates this is the preferred mode
4121 	 */
4122 	WL_OUTPUT_MODE_PREFERRED = 0x2,
4123 };
4124 #endif /* WL_OUTPUT_MODE_ENUM */
4125 
4126 /**
4127  * @ingroup iface_wl_output
4128  * @struct wl_output_interface
4129  */
4130 struct wl_output_interface {
4131 	/**
4132 	 * release the output object
4133 	 *
4134 	 * Using this request a client can tell the server that it is not
4135 	 * going to use the output object anymore.
4136 	 * @since 3
4137 	 */
4138 	void (*release)(struct wl_client *client,
4139 			struct wl_resource *resource);
4140 };
4141 
4142 #define WL_OUTPUT_GEOMETRY 0
4143 #define WL_OUTPUT_MODE 1
4144 #define WL_OUTPUT_DONE 2
4145 #define WL_OUTPUT_SCALE 3
4146 
4147 /**
4148  * @ingroup iface_wl_output
4149  */
4150 #define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1
4151 /**
4152  * @ingroup iface_wl_output
4153  */
4154 #define WL_OUTPUT_MODE_SINCE_VERSION 1
4155 /**
4156  * @ingroup iface_wl_output
4157  */
4158 #define WL_OUTPUT_DONE_SINCE_VERSION 2
4159 /**
4160  * @ingroup iface_wl_output
4161  */
4162 #define WL_OUTPUT_SCALE_SINCE_VERSION 2
4163 
4164 /**
4165  * @ingroup iface_wl_output
4166  */
4167 #define WL_OUTPUT_RELEASE_SINCE_VERSION 3
4168 
4169 /**
4170  * @ingroup iface_wl_output
4171  * Sends an geometry event to the client owning the resource.
4172  * @param resource_ The client's resource
4173  * @param x x position within the global compositor space
4174  * @param y y position within the global compositor space
4175  * @param physical_width width in millimeters of the output
4176  * @param physical_height height in millimeters of the output
4177  * @param subpixel subpixel orientation of the output
4178  * @param make textual description of the manufacturer
4179  * @param model textual description of the model
4180  * @param transform transform that maps framebuffer to output
4181  */
4182 static inline void
wl_output_send_geometry(struct wl_resource * resource_,int32_t x,int32_t y,int32_t physical_width,int32_t physical_height,int32_t subpixel,const char * make,const char * model,int32_t transform)4183 wl_output_send_geometry(struct wl_resource *resource_, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char *make, const char *model, int32_t transform)
4184 {
4185 	wl_resource_post_event(resource_, WL_OUTPUT_GEOMETRY, x, y, physical_width, physical_height, subpixel, make, model, transform);
4186 }
4187 
4188 /**
4189  * @ingroup iface_wl_output
4190  * Sends an mode event to the client owning the resource.
4191  * @param resource_ The client's resource
4192  * @param flags bitfield of mode flags
4193  * @param width width of the mode in hardware units
4194  * @param height height of the mode in hardware units
4195  * @param refresh vertical refresh rate in mHz
4196  */
4197 static inline void
wl_output_send_mode(struct wl_resource * resource_,uint32_t flags,int32_t width,int32_t height,int32_t refresh)4198 wl_output_send_mode(struct wl_resource *resource_, uint32_t flags, int32_t width, int32_t height, int32_t refresh)
4199 {
4200 	wl_resource_post_event(resource_, WL_OUTPUT_MODE, flags, width, height, refresh);
4201 }
4202 
4203 /**
4204  * @ingroup iface_wl_output
4205  * Sends an done event to the client owning the resource.
4206  * @param resource_ The client's resource
4207  */
4208 static inline void
wl_output_send_done(struct wl_resource * resource_)4209 wl_output_send_done(struct wl_resource *resource_)
4210 {
4211 	wl_resource_post_event(resource_, WL_OUTPUT_DONE);
4212 }
4213 
4214 /**
4215  * @ingroup iface_wl_output
4216  * Sends an scale event to the client owning the resource.
4217  * @param resource_ The client's resource
4218  * @param factor scaling factor of output
4219  */
4220 static inline void
wl_output_send_scale(struct wl_resource * resource_,int32_t factor)4221 wl_output_send_scale(struct wl_resource *resource_, int32_t factor)
4222 {
4223 	wl_resource_post_event(resource_, WL_OUTPUT_SCALE, factor);
4224 }
4225 
4226 /**
4227  * @ingroup iface_wl_region
4228  * @struct wl_region_interface
4229  */
4230 struct wl_region_interface {
4231 	/**
4232 	 * destroy region
4233 	 *
4234 	 * Destroy the region. This will invalidate the object ID.
4235 	 */
4236 	void (*destroy)(struct wl_client *client,
4237 			struct wl_resource *resource);
4238 	/**
4239 	 * add rectangle to region
4240 	 *
4241 	 * Add the specified rectangle to the region.
4242 	 * @param x region-local x coordinate
4243 	 * @param y region-local y coordinate
4244 	 * @param width rectangle width
4245 	 * @param height rectangle height
4246 	 */
4247 	void (*add)(struct wl_client *client,
4248 		    struct wl_resource *resource,
4249 		    int32_t x,
4250 		    int32_t y,
4251 		    int32_t width,
4252 		    int32_t height);
4253 	/**
4254 	 * subtract rectangle from region
4255 	 *
4256 	 * Subtract the specified rectangle from the region.
4257 	 * @param x region-local x coordinate
4258 	 * @param y region-local y coordinate
4259 	 * @param width rectangle width
4260 	 * @param height rectangle height
4261 	 */
4262 	void (*subtract)(struct wl_client *client,
4263 			 struct wl_resource *resource,
4264 			 int32_t x,
4265 			 int32_t y,
4266 			 int32_t width,
4267 			 int32_t height);
4268 };
4269 
4270 
4271 /**
4272  * @ingroup iface_wl_region
4273  */
4274 #define WL_REGION_DESTROY_SINCE_VERSION 1
4275 /**
4276  * @ingroup iface_wl_region
4277  */
4278 #define WL_REGION_ADD_SINCE_VERSION 1
4279 /**
4280  * @ingroup iface_wl_region
4281  */
4282 #define WL_REGION_SUBTRACT_SINCE_VERSION 1
4283 
4284 #ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
4285 #define WL_SUBCOMPOSITOR_ERROR_ENUM
4286 enum wl_subcompositor_error {
4287 	/**
4288 	 * the to-be sub-surface is invalid
4289 	 */
4290 	WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
4291 };
4292 #endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
4293 
4294 /**
4295  * @ingroup iface_wl_subcompositor
4296  * @struct wl_subcompositor_interface
4297  */
4298 struct wl_subcompositor_interface {
4299 	/**
4300 	 * unbind from the subcompositor interface
4301 	 *
4302 	 * Informs the server that the client will not be using this
4303 	 * protocol object anymore. This does not affect any other objects,
4304 	 * wl_subsurface objects included.
4305 	 */
4306 	void (*destroy)(struct wl_client *client,
4307 			struct wl_resource *resource);
4308 	/**
4309 	 * give a surface the role sub-surface
4310 	 *
4311 	 * Create a sub-surface interface for the given surface, and
4312 	 * associate it with the given parent surface. This turns a plain
4313 	 * wl_surface into a sub-surface.
4314 	 *
4315 	 * The to-be sub-surface must not already have another role, and it
4316 	 * must not have an existing wl_subsurface object. Otherwise a
4317 	 * protocol error is raised.
4318 	 *
4319 	 * Adding sub-surfaces to a parent is a double-buffered operation
4320 	 * on the parent (see wl_surface.commit). The effect of adding a
4321 	 * sub-surface becomes visible on the next time the state of the
4322 	 * parent surface is applied.
4323 	 *
4324 	 * This request modifies the behaviour of wl_surface.commit request
4325 	 * on the sub-surface, see the documentation on wl_subsurface
4326 	 * interface.
4327 	 * @param id the new sub-surface object ID
4328 	 * @param surface the surface to be turned into a sub-surface
4329 	 * @param parent the parent surface
4330 	 */
4331 	void (*get_subsurface)(struct wl_client *client,
4332 			       struct wl_resource *resource,
4333 			       uint32_t id,
4334 			       struct wl_resource *surface,
4335 			       struct wl_resource *parent);
4336 };
4337 
4338 
4339 /**
4340  * @ingroup iface_wl_subcompositor
4341  */
4342 #define WL_SUBCOMPOSITOR_DESTROY_SINCE_VERSION 1
4343 /**
4344  * @ingroup iface_wl_subcompositor
4345  */
4346 #define WL_SUBCOMPOSITOR_GET_SUBSURFACE_SINCE_VERSION 1
4347 
4348 #ifndef WL_SUBSURFACE_ERROR_ENUM
4349 #define WL_SUBSURFACE_ERROR_ENUM
4350 enum wl_subsurface_error {
4351 	/**
4352 	 * wl_surface is not a sibling or the parent
4353 	 */
4354 	WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
4355 };
4356 #endif /* WL_SUBSURFACE_ERROR_ENUM */
4357 
4358 /**
4359  * @ingroup iface_wl_subsurface
4360  * @struct wl_subsurface_interface
4361  */
4362 struct wl_subsurface_interface {
4363 	/**
4364 	 * remove sub-surface interface
4365 	 *
4366 	 * The sub-surface interface is removed from the wl_surface
4367 	 * object that was turned into a sub-surface with a
4368 	 * wl_subcompositor.get_subsurface request. The wl_surface's
4369 	 * association to the parent is deleted, and the wl_surface loses
4370 	 * its role as a sub-surface. The wl_surface is unmapped
4371 	 * immediately.
4372 	 */
4373 	void (*destroy)(struct wl_client *client,
4374 			struct wl_resource *resource);
4375 	/**
4376 	 * reposition the sub-surface
4377 	 *
4378 	 * This schedules a sub-surface position change. The sub-surface
4379 	 * will be moved so that its origin (top left corner pixel) will be
4380 	 * at the location x, y of the parent surface coordinate system.
4381 	 * The coordinates are not restricted to the parent surface area.
4382 	 * Negative values are allowed.
4383 	 *
4384 	 * The scheduled coordinates will take effect whenever the state of
4385 	 * the parent surface is applied. When this happens depends on
4386 	 * whether the parent surface is in synchronized mode or not. See
4387 	 * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
4388 	 *
4389 	 * If more than one set_position request is invoked by the client
4390 	 * before the commit of the parent surface, the position of a new
4391 	 * request always replaces the scheduled position from any previous
4392 	 * request.
4393 	 *
4394 	 * The initial position is 0, 0.
4395 	 * @param x x coordinate in the parent surface
4396 	 * @param y y coordinate in the parent surface
4397 	 */
4398 	void (*set_position)(struct wl_client *client,
4399 			     struct wl_resource *resource,
4400 			     int32_t x,
4401 			     int32_t y);
4402 	/**
4403 	 * restack the sub-surface
4404 	 *
4405 	 * This sub-surface is taken from the stack, and put back just
4406 	 * above the reference surface, changing the z-order of the
4407 	 * sub-surfaces. The reference surface must be one of the sibling
4408 	 * surfaces, or the parent surface. Using any other surface,
4409 	 * including this sub-surface, will cause a protocol error.
4410 	 *
4411 	 * The z-order is double-buffered. Requests are handled in order
4412 	 * and applied immediately to a pending state. The final pending
4413 	 * state is copied to the active state the next time the state of
4414 	 * the parent surface is applied. When this happens depends on
4415 	 * whether the parent surface is in synchronized mode or not. See
4416 	 * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
4417 	 *
4418 	 * A new sub-surface is initially added as the top-most in the
4419 	 * stack of its siblings and parent.
4420 	 * @param sibling the reference surface
4421 	 */
4422 	void (*place_above)(struct wl_client *client,
4423 			    struct wl_resource *resource,
4424 			    struct wl_resource *sibling);
4425 	/**
4426 	 * restack the sub-surface
4427 	 *
4428 	 * The sub-surface is placed just below the reference surface.
4429 	 * See wl_subsurface.place_above.
4430 	 * @param sibling the reference surface
4431 	 */
4432 	void (*place_below)(struct wl_client *client,
4433 			    struct wl_resource *resource,
4434 			    struct wl_resource *sibling);
4435 	/**
4436 	 * set sub-surface to synchronized mode
4437 	 *
4438 	 * Change the commit behaviour of the sub-surface to synchronized
4439 	 * mode, also described as the parent dependent mode.
4440 	 *
4441 	 * In synchronized mode, wl_surface.commit on a sub-surface will
4442 	 * accumulate the committed state in a cache, but the state will
4443 	 * not be applied and hence will not change the compositor output.
4444 	 * The cached state is applied to the sub-surface immediately after
4445 	 * the parent surface's state is applied. This ensures atomic
4446 	 * updates of the parent and all its synchronized sub-surfaces.
4447 	 * Applying the cached state will invalidate the cache, so further
4448 	 * parent surface commits do not (re-)apply old state.
4449 	 *
4450 	 * See wl_subsurface for the recursive effect of this mode.
4451 	 */
4452 	void (*set_sync)(struct wl_client *client,
4453 			 struct wl_resource *resource);
4454 	/**
4455 	 * set sub-surface to desynchronized mode
4456 	 *
4457 	 * Change the commit behaviour of the sub-surface to
4458 	 * desynchronized mode, also described as independent or freely
4459 	 * running mode.
4460 	 *
4461 	 * In desynchronized mode, wl_surface.commit on a sub-surface will
4462 	 * apply the pending state directly, without caching, as happens
4463 	 * normally with a wl_surface. Calling wl_surface.commit on the
4464 	 * parent surface has no effect on the sub-surface's wl_surface
4465 	 * state. This mode allows a sub-surface to be updated on its own.
4466 	 *
4467 	 * If cached state exists when wl_surface.commit is called in
4468 	 * desynchronized mode, the pending state is added to the cached
4469 	 * state, and applied as a whole. This invalidates the cache.
4470 	 *
4471 	 * Note: even if a sub-surface is set to desynchronized, a parent
4472 	 * sub-surface may override it to behave as synchronized. For
4473 	 * details, see wl_subsurface.
4474 	 *
4475 	 * If a surface's parent surface behaves as desynchronized, then
4476 	 * the cached state is applied on set_desync.
4477 	 */
4478 	void (*set_desync)(struct wl_client *client,
4479 			   struct wl_resource *resource);
4480 };
4481 
4482 
4483 /**
4484  * @ingroup iface_wl_subsurface
4485  */
4486 #define WL_SUBSURFACE_DESTROY_SINCE_VERSION 1
4487 /**
4488  * @ingroup iface_wl_subsurface
4489  */
4490 #define WL_SUBSURFACE_SET_POSITION_SINCE_VERSION 1
4491 /**
4492  * @ingroup iface_wl_subsurface
4493  */
4494 #define WL_SUBSURFACE_PLACE_ABOVE_SINCE_VERSION 1
4495 /**
4496  * @ingroup iface_wl_subsurface
4497  */
4498 #define WL_SUBSURFACE_PLACE_BELOW_SINCE_VERSION 1
4499 /**
4500  * @ingroup iface_wl_subsurface
4501  */
4502 #define WL_SUBSURFACE_SET_SYNC_SINCE_VERSION 1
4503 /**
4504  * @ingroup iface_wl_subsurface
4505  */
4506 #define WL_SUBSURFACE_SET_DESYNC_SINCE_VERSION 1
4507 
4508 #ifdef  __cplusplus
4509 }
4510 #endif
4511 
4512 #endif
4513