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

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