Debian Codegraph @

wayland/qtwayland-dev/5.15.1/QtWaylandClient/private/wayland-wayland-client-protocol.h

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