VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/wlInclude/wayland-client-protocol.h@ 102772

Last change on this file since 102772 was 101677, checked in by vboxsync, 13 months ago

Additions: Wayland: Add generated code and dynamic loader desc for libwayland-client, bugref:10194.

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette