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