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