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