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

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