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

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