Warning: That file was not part of the compilation database. It may have many parsing errors.

1/*
2 * Copyright © 2008-2011 Kristian Høgsberg
3 * Copyright © 2010-2011 Intel Corporation
4 * Copyright © 2012-2013 Collabora, Ltd.
5 *
6 * Permission to use, copy, modify, distribute, and sell this
7 * software and its documentation for any purpose is hereby granted
8 * without fee, provided that the above copyright notice appear in
9 * all copies and that both that copyright notice and this permission
10 * notice appear in supporting documentation, and that the name of
11 * the copyright holders not be used in advertising or publicity
12 * pertaining to distribution of the software without specific,
13 * written prior permission. The copyright holders make no
14 * representations about the suitability of this software for any
15 * purpose. It is provided "as is" without express or implied
16 * warranty.
17 *
18 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
19 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
20 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
22 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
23 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
24 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
25 * THIS SOFTWARE.
26 */
27
28#ifndef WAYLAND_CLIENT_PROTOCOL_H
29#define WAYLAND_CLIENT_PROTOCOL_H
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
35#include <stdint.h>
36#include <stddef.h>
37#include "wayland-client.h"
38
39struct wl_client;
40struct wl_resource;
41
42struct wl_display;
43struct wl_registry;
44struct wl_callback;
45struct wl_compositor;
46struct wl_shm_pool;
47struct wl_shm;
48struct wl_buffer;
49struct wl_data_offer;
50struct wl_data_source;
51struct wl_data_device;
52struct wl_data_device_manager;
53struct wl_shell;
54struct wl_shell_surface;
55struct wl_surface;
56struct wl_seat;
57struct wl_pointer;
58struct wl_keyboard;
59struct wl_touch;
60struct wl_output;
61struct wl_region;
62struct wl_subcompositor;
63struct wl_subsurface;
64
65extern const struct wl_interface wl_display_interface;
66extern const struct wl_interface wl_registry_interface;
67extern const struct wl_interface wl_callback_interface;
68extern const struct wl_interface wl_compositor_interface;
69extern const struct wl_interface wl_shm_pool_interface;
70extern const struct wl_interface wl_shm_interface;
71extern const struct wl_interface wl_buffer_interface;
72extern const struct wl_interface wl_data_offer_interface;
73extern const struct wl_interface wl_data_source_interface;
74extern const struct wl_interface wl_data_device_interface;
75extern const struct wl_interface wl_data_device_manager_interface;
76extern const struct wl_interface wl_shell_interface;
77extern const struct wl_interface wl_shell_surface_interface;
78extern const struct wl_interface wl_surface_interface;
79extern const struct wl_interface wl_seat_interface;
80extern const struct wl_interface wl_pointer_interface;
81extern const struct wl_interface wl_keyboard_interface;
82extern const struct wl_interface wl_touch_interface;
83extern const struct wl_interface wl_output_interface;
84extern const struct wl_interface wl_region_interface;
85extern const struct wl_interface wl_subcompositor_interface;
86extern const struct wl_interface wl_subsurface_interface;
87
88#ifndef WL_DISPLAY_ERROR_ENUM
89#define WL_DISPLAY_ERROR_ENUM
90/**
91 * wl_display_error - global error values
92 * @WL_DISPLAY_ERROR_INVALID_OBJECT: server couldn't find object
93 * @WL_DISPLAY_ERROR_INVALID_METHOD: method doesn't exist on the
94 * specified interface
95 * @WL_DISPLAY_ERROR_NO_MEMORY: server is out of memory
96 *
97 * These errors are global and can be emitted in response to any server
98 * request.
99 */
100enum wl_display_error {
101 WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
102 WL_DISPLAY_ERROR_INVALID_METHOD = 1,
103 WL_DISPLAY_ERROR_NO_MEMORY = 2,
104};
105#endif /* WL_DISPLAY_ERROR_ENUM */
106
107/**
108 * wl_display - core global object
109 * @error: fatal error event
110 * @delete_id: acknowledge object ID deletion
111 *
112 * The core global object. This is a special singleton object. It is used
113 * for internal Wayland protocol features.
114 */
115struct wl_display_listener {
116 /**
117 * error - fatal error event
118 * @object_id: (none)
119 * @code: (none)
120 * @message: (none)
121 *
122 * The error event is sent out when a fatal (non-recoverable)
123 * error has occurred. The object_id argument is the object where
124 * the error occurred, most often in response to a request to that
125 * object. The code identifies the error and is defined by the
126 * object interface. As such, each interface defines its own set of
127 * error codes. The message is an brief description of the error,
128 * for (debugging) convenience.
129 */
130 void (*error)(void *data,
131 struct wl_display *wl_display,
132 void *object_id,
133 uint32_t code,
134 const char *message);
135 /**
136 * delete_id - acknowledge object ID deletion
137 * @id: (none)
138 *
139 * This event is used internally by the object ID management
140 * logic. When a client deletes an object, the server will send
141 * this event to acknowledge that it has seen the delete request.
142 * When the client receive this event, it will know that it can
143 * safely reuse the object ID.
144 */
145 void (*delete_id)(void *data,
146 struct wl_display *wl_display,
147 uint32_t id);
148};
149
150static inline int
151wl_display_add_listener(struct wl_display *wl_display,
152 const struct wl_display_listener *listener, void *data)
153{
154 return wl_proxy_add_listener((struct wl_proxy *) wl_display,
155 (void (**)(void)) listener, data);
156}
157
158#define WL_DISPLAY_SYNC 0
159#define WL_DISPLAY_GET_REGISTRY 1
160
161static inline void
162wl_display_set_user_data(struct wl_display *wl_display, void *user_data)
163{
164 wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data);
165}
166
167static inline void *
168wl_display_get_user_data(struct wl_display *wl_display)
169{
170 return wl_proxy_get_user_data((struct wl_proxy *) wl_display);
171}
172
173static inline struct wl_callback *
174wl_display_sync(struct wl_display *wl_display)
175{
176 struct wl_proxy *callback;
177
178 callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display,
179 WL_DISPLAY_SYNC, &wl_callback_interface, NULL);
180
181 return (struct wl_callback *) callback;
182}
183
184static inline struct wl_registry *
185wl_display_get_registry(struct wl_display *wl_display)
186{
187 struct wl_proxy *registry;
188
189 registry = wl_proxy_marshal_constructor((struct wl_proxy *) wl_display,
190 WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, NULL);
191
192 return (struct wl_registry *) registry;
193}
194
195/**
196 * wl_registry - global registry object
197 * @global: announce global object
198 * @global_remove: announce removal of global object
199 *
200 * The global registry object. The server has a number of global objects
201 * that are available to all clients. These objects typically represent an
202 * actual object in the server (for example, an input device) or they are
203 * singleton objects that provide extension functionality.
204 *
205 * When a client creates a registry object, the registry object will emit a
206 * global event for each global currently in the registry. Globals come and
207 * go as a result of device or monitor hotplugs, reconfiguration or other
208 * events, and the registry will send out global and global_remove events
209 * to keep the client up to date with the changes. To mark the end of the
210 * initial burst of events, the client can use the wl_display.sync request
211 * immediately after calling wl_display.get_registry.
212 *
213 * A client can bind to a global object by using the bind request. This
214 * creates a client-side handle that lets the object emit events to the
215 * client and lets the client invoke requests on the object.
216 */
217struct wl_registry_listener {
218 /**
219 * global - announce global object
220 * @name: (none)
221 * @interface: (none)
222 * @version: (none)
223 *
224 * Notify the client of global objects.
225 *
226 * The event notifies the client that a global object with the
227 * given name is now available, and it implements the given version
228 * of the given interface.
229 */
230 void (*global)(void *data,
231 struct wl_registry *wl_registry,
232 uint32_t name,
233 const char *interface,
234 uint32_t version);
235 /**
236 * global_remove - announce removal of global object
237 * @name: (none)
238 *
239 * Notify the client of removed global objects.
240 *
241 * This event notifies the client that the global identified by
242 * name is no longer available. If the client bound to the global
243 * using the bind request, the client should now destroy that
244 * object.
245 *
246 * The object remains valid and requests to the object will be
247 * ignored until the client destroys it, to avoid races between the
248 * global going away and a client sending a request to it.
249 */
250 void (*global_remove)(void *data,
251 struct wl_registry *wl_registry,
252 uint32_t name);
253};
254
255static inline int
256wl_registry_add_listener(struct wl_registry *wl_registry,
257 const struct wl_registry_listener *listener, void *data)
258{
259 return wl_proxy_add_listener((struct wl_proxy *) wl_registry,
260 (void (**)(void)) listener, data);
261}
262
263#define WL_REGISTRY_BIND 0
264
265static inline void
266wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data)
267{
268 wl_proxy_set_user_data((struct wl_proxy *) wl_registry, user_data);
269}
270
271static inline void *
272wl_registry_get_user_data(struct wl_registry *wl_registry)
273{
274 return wl_proxy_get_user_data((struct wl_proxy *) wl_registry);
275}
276
277static inline void
278wl_registry_destroy(struct wl_registry *wl_registry)
279{
280 wl_proxy_destroy((struct wl_proxy *) wl_registry);
281}
282
283static inline void *
284wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
285{
286 struct wl_proxy *id;
287
288 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_registry,
289 WL_REGISTRY_BIND, interface, name, interface->name, version, NULL);
290
291 return (void *) id;
292}
293
294/**
295 * wl_callback - callback object
296 * @done: done event
297 *
298 * Clients can handle the 'done' event to get notified when the related
299 * request is done.
300 */
301struct wl_callback_listener {
302 /**
303 * done - done event
304 * @callback_data: request-specific data for the wl_callback
305 *
306 * Notify the client when the related request is done.
307 */
308 void (*done)(void *data,
309 struct wl_callback *wl_callback,
310 uint32_t callback_data);
311};
312
313static inline int
314wl_callback_add_listener(struct wl_callback *wl_callback,
315 const struct wl_callback_listener *listener, void *data)
316{
317 return wl_proxy_add_listener((struct wl_proxy *) wl_callback,
318 (void (**)(void)) listener, data);
319}
320
321static inline void
322wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data)
323{
324 wl_proxy_set_user_data((struct wl_proxy *) wl_callback, user_data);
325}
326
327static inline void *
328wl_callback_get_user_data(struct wl_callback *wl_callback)
329{
330 return wl_proxy_get_user_data((struct wl_proxy *) wl_callback);
331}
332
333static inline void
334wl_callback_destroy(struct wl_callback *wl_callback)
335{
336 wl_proxy_destroy((struct wl_proxy *) wl_callback);
337}
338
339#define WL_COMPOSITOR_CREATE_SURFACE 0
340#define WL_COMPOSITOR_CREATE_REGION 1
341
342static inline void
343wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data)
344{
345 wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data);
346}
347
348static inline void *
349wl_compositor_get_user_data(struct wl_compositor *wl_compositor)
350{
351 return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor);
352}
353
354static inline void
355wl_compositor_destroy(struct wl_compositor *wl_compositor)
356{
357 wl_proxy_destroy((struct wl_proxy *) wl_compositor);
358}
359
360static inline struct wl_surface *
361wl_compositor_create_surface(struct wl_compositor *wl_compositor)
362{
363 struct wl_proxy *id;
364
365 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor,
366 WL_COMPOSITOR_CREATE_SURFACE, &wl_surface_interface, NULL);
367
368 return (struct wl_surface *) id;
369}
370
371static inline struct wl_region *
372wl_compositor_create_region(struct wl_compositor *wl_compositor)
373{
374 struct wl_proxy *id;
375
376 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_compositor,
377 WL_COMPOSITOR_CREATE_REGION, &wl_region_interface, NULL);
378
379 return (struct wl_region *) id;
380}
381
382#define WL_SHM_POOL_CREATE_BUFFER 0
383#define WL_SHM_POOL_DESTROY 1
384#define WL_SHM_POOL_RESIZE 2
385
386static inline void
387wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data)
388{
389 wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
390}
391
392static inline void *
393wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool)
394{
395 return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
396}
397
398static inline struct wl_buffer *
399wl_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)
400{
401 struct wl_proxy *id;
402
403 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm_pool,
404 WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, NULL, offset, width, height, stride, format);
405
406 return (struct wl_buffer *) id;
407}
408
409static inline void
410wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool)
411{
412 wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
413 WL_SHM_POOL_DESTROY);
414
415 wl_proxy_destroy((struct wl_proxy *) wl_shm_pool);
416}
417
418static inline void
419wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size)
420{
421 wl_proxy_marshal((struct wl_proxy *) wl_shm_pool,
422 WL_SHM_POOL_RESIZE, size);
423}
424
425#ifndef WL_SHM_ERROR_ENUM
426#define WL_SHM_ERROR_ENUM
427/**
428 * wl_shm_error - wl_shm error values
429 * @WL_SHM_ERROR_INVALID_FORMAT: buffer format is not known
430 * @WL_SHM_ERROR_INVALID_STRIDE: invalid size or stride during pool or
431 * buffer creation
432 * @WL_SHM_ERROR_INVALID_FD: mmapping the file descriptor failed
433 *
434 * These errors can be emitted in response to wl_shm requests.
435 */
436enum wl_shm_error {
437 WL_SHM_ERROR_INVALID_FORMAT = 0,
438 WL_SHM_ERROR_INVALID_STRIDE = 1,
439 WL_SHM_ERROR_INVALID_FD = 2,
440};
441#endif /* WL_SHM_ERROR_ENUM */
442
443#ifndef WL_SHM_FORMAT_ENUM
444#define WL_SHM_FORMAT_ENUM
445/**
446 * wl_shm_format - pixel formats
447 * @WL_SHM_FORMAT_ARGB8888: 32-bit ARGB format
448 * @WL_SHM_FORMAT_XRGB8888: 32-bit RGB format
449 * @WL_SHM_FORMAT_C8: (none)
450 * @WL_SHM_FORMAT_RGB332: (none)
451 * @WL_SHM_FORMAT_BGR233: (none)
452 * @WL_SHM_FORMAT_XRGB4444: (none)
453 * @WL_SHM_FORMAT_XBGR4444: (none)
454 * @WL_SHM_FORMAT_RGBX4444: (none)
455 * @WL_SHM_FORMAT_BGRX4444: (none)
456 * @WL_SHM_FORMAT_ARGB4444: (none)
457 * @WL_SHM_FORMAT_ABGR4444: (none)
458 * @WL_SHM_FORMAT_RGBA4444: (none)
459 * @WL_SHM_FORMAT_BGRA4444: (none)
460 * @WL_SHM_FORMAT_XRGB1555: (none)
461 * @WL_SHM_FORMAT_XBGR1555: (none)
462 * @WL_SHM_FORMAT_RGBX5551: (none)
463 * @WL_SHM_FORMAT_BGRX5551: (none)
464 * @WL_SHM_FORMAT_ARGB1555: (none)
465 * @WL_SHM_FORMAT_ABGR1555: (none)
466 * @WL_SHM_FORMAT_RGBA5551: (none)
467 * @WL_SHM_FORMAT_BGRA5551: (none)
468 * @WL_SHM_FORMAT_RGB565: (none)
469 * @WL_SHM_FORMAT_BGR565: (none)
470 * @WL_SHM_FORMAT_RGB888: (none)
471 * @WL_SHM_FORMAT_BGR888: (none)
472 * @WL_SHM_FORMAT_XBGR8888: (none)
473 * @WL_SHM_FORMAT_RGBX8888: (none)
474 * @WL_SHM_FORMAT_BGRX8888: (none)
475 * @WL_SHM_FORMAT_ABGR8888: (none)
476 * @WL_SHM_FORMAT_RGBA8888: (none)
477 * @WL_SHM_FORMAT_BGRA8888: (none)
478 * @WL_SHM_FORMAT_XRGB2101010: (none)
479 * @WL_SHM_FORMAT_XBGR2101010: (none)
480 * @WL_SHM_FORMAT_RGBX1010102: (none)
481 * @WL_SHM_FORMAT_BGRX1010102: (none)
482 * @WL_SHM_FORMAT_ARGB2101010: (none)
483 * @WL_SHM_FORMAT_ABGR2101010: (none)
484 * @WL_SHM_FORMAT_RGBA1010102: (none)
485 * @WL_SHM_FORMAT_BGRA1010102: (none)
486 * @WL_SHM_FORMAT_YUYV: (none)
487 * @WL_SHM_FORMAT_YVYU: (none)
488 * @WL_SHM_FORMAT_UYVY: (none)
489 * @WL_SHM_FORMAT_VYUY: (none)
490 * @WL_SHM_FORMAT_AYUV: (none)
491 * @WL_SHM_FORMAT_NV12: (none)
492 * @WL_SHM_FORMAT_NV21: (none)
493 * @WL_SHM_FORMAT_NV16: (none)
494 * @WL_SHM_FORMAT_NV61: (none)
495 * @WL_SHM_FORMAT_YUV410: (none)
496 * @WL_SHM_FORMAT_YVU410: (none)
497 * @WL_SHM_FORMAT_YUV411: (none)
498 * @WL_SHM_FORMAT_YVU411: (none)
499 * @WL_SHM_FORMAT_YUV420: (none)
500 * @WL_SHM_FORMAT_YVU420: (none)
501 * @WL_SHM_FORMAT_YUV422: (none)
502 * @WL_SHM_FORMAT_YVU422: (none)
503 * @WL_SHM_FORMAT_YUV444: (none)
504 * @WL_SHM_FORMAT_YVU444: (none)
505 *
506 * This describes the memory layout of an individual pixel.
507 *
508 * All renderers should support argb8888 and xrgb8888 but any other formats
509 * are optional and may not be supported by the particular renderer in use.
510 */
511enum wl_shm_format {
512 WL_SHM_FORMAT_ARGB8888 = 0,
513 WL_SHM_FORMAT_XRGB8888 = 1,
514 WL_SHM_FORMAT_C8 = 0x20203843,
515 WL_SHM_FORMAT_RGB332 = 0x38424752,
516 WL_SHM_FORMAT_BGR233 = 0x38524742,
517 WL_SHM_FORMAT_XRGB4444 = 0x32315258,
518 WL_SHM_FORMAT_XBGR4444 = 0x32314258,
519 WL_SHM_FORMAT_RGBX4444 = 0x32315852,
520 WL_SHM_FORMAT_BGRX4444 = 0x32315842,
521 WL_SHM_FORMAT_ARGB4444 = 0x32315241,
522 WL_SHM_FORMAT_ABGR4444 = 0x32314241,
523 WL_SHM_FORMAT_RGBA4444 = 0x32314152,
524 WL_SHM_FORMAT_BGRA4444 = 0x32314142,
525 WL_SHM_FORMAT_XRGB1555 = 0x35315258,
526 WL_SHM_FORMAT_XBGR1555 = 0x35314258,
527 WL_SHM_FORMAT_RGBX5551 = 0x35315852,
528 WL_SHM_FORMAT_BGRX5551 = 0x35315842,
529 WL_SHM_FORMAT_ARGB1555 = 0x35315241,
530 WL_SHM_FORMAT_ABGR1555 = 0x35314241,
531 WL_SHM_FORMAT_RGBA5551 = 0x35314152,
532 WL_SHM_FORMAT_BGRA5551 = 0x35314142,
533 WL_SHM_FORMAT_RGB565 = 0x36314752,
534 WL_SHM_FORMAT_BGR565 = 0x36314742,
535 WL_SHM_FORMAT_RGB888 = 0x34324752,
536 WL_SHM_FORMAT_BGR888 = 0x34324742,
537 WL_SHM_FORMAT_XBGR8888 = 0x34324258,
538 WL_SHM_FORMAT_RGBX8888 = 0x34325852,
539 WL_SHM_FORMAT_BGRX8888 = 0x34325842,
540 WL_SHM_FORMAT_ABGR8888 = 0x34324241,
541 WL_SHM_FORMAT_RGBA8888 = 0x34324152,
542 WL_SHM_FORMAT_BGRA8888 = 0x34324142,
543 WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
544 WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
545 WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
546 WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
547 WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
548 WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
549 WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
550 WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
551 WL_SHM_FORMAT_YUYV = 0x56595559,
552 WL_SHM_FORMAT_YVYU = 0x55595659,
553 WL_SHM_FORMAT_UYVY = 0x59565955,
554 WL_SHM_FORMAT_VYUY = 0x59555956,
555 WL_SHM_FORMAT_AYUV = 0x56555941,
556 WL_SHM_FORMAT_NV12 = 0x3231564e,
557 WL_SHM_FORMAT_NV21 = 0x3132564e,
558 WL_SHM_FORMAT_NV16 = 0x3631564e,
559 WL_SHM_FORMAT_NV61 = 0x3136564e,
560 WL_SHM_FORMAT_YUV410 = 0x39565559,
561 WL_SHM_FORMAT_YVU410 = 0x39555659,
562 WL_SHM_FORMAT_YUV411 = 0x31315559,
563 WL_SHM_FORMAT_YVU411 = 0x31315659,
564 WL_SHM_FORMAT_YUV420 = 0x32315559,
565 WL_SHM_FORMAT_YVU420 = 0x32315659,
566 WL_SHM_FORMAT_YUV422 = 0x36315559,
567 WL_SHM_FORMAT_YVU422 = 0x36315659,
568 WL_SHM_FORMAT_YUV444 = 0x34325559,
569 WL_SHM_FORMAT_YVU444 = 0x34325659,
570};
571#endif /* WL_SHM_FORMAT_ENUM */
572
573/**
574 * wl_shm - shared memory support
575 * @format: pixel format description
576 *
577 * A global singleton object that provides support for shared memory.
578 *
579 * Clients can create wl_shm_pool objects using the create_pool request.
580 *
581 * At connection setup time, the wl_shm object emits one or more format
582 * events to inform clients about the valid pixel formats that can be used
583 * for buffers.
584 */
585struct wl_shm_listener {
586 /**
587 * format - pixel format description
588 * @format: (none)
589 *
590 * Informs the client about a valid pixel format that can be used
591 * for buffers. Known formats include argb8888 and xrgb8888.
592 */
593 void (*format)(void *data,
594 struct wl_shm *wl_shm,
595 uint32_t format);
596};
597
598static inline int
599wl_shm_add_listener(struct wl_shm *wl_shm,
600 const struct wl_shm_listener *listener, void *data)
601{
602 return wl_proxy_add_listener((struct wl_proxy *) wl_shm,
603 (void (**)(void)) listener, data);
604}
605
606#define WL_SHM_CREATE_POOL 0
607
608static inline void
609wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data)
610{
611 wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data);
612}
613
614static inline void *
615wl_shm_get_user_data(struct wl_shm *wl_shm)
616{
617 return wl_proxy_get_user_data((struct wl_proxy *) wl_shm);
618}
619
620static inline void
621wl_shm_destroy(struct wl_shm *wl_shm)
622{
623 wl_proxy_destroy((struct wl_proxy *) wl_shm);
624}
625
626static inline struct wl_shm_pool *
627wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size)
628{
629 struct wl_proxy *id;
630
631 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shm,
632 WL_SHM_CREATE_POOL, &wl_shm_pool_interface, NULL, fd, size);
633
634 return (struct wl_shm_pool *) id;
635}
636
637/**
638 * wl_buffer - content for a wl_surface
639 * @release: compositor releases buffer
640 *
641 * A buffer provides the content for a wl_surface. Buffers are created
642 * through factory interfaces such as wl_drm, wl_shm or similar. It has a
643 * width and a height and can be attached to a wl_surface, but the
644 * mechanism by which a client provides and updates the contents is defined
645 * by the buffer factory interface.
646 */
647struct wl_buffer_listener {
648 /**
649 * release - compositor releases buffer
650 *
651 * Sent when this wl_buffer is no longer used by the compositor.
652 * The client is now free to re-use or destroy this buffer and its
653 * backing storage.
654 *
655 * If a client receives a release event before the frame callback
656 * requested in the same wl_surface.commit that attaches this
657 * wl_buffer to a surface, then the client is immediately free to
658 * re-use the buffer and its backing storage, and does not need a
659 * second buffer for the next surface content update. Typically
660 * this is possible, when the compositor maintains a copy of the
661 * wl_surface contents, e.g. as a GL texture. This is an important
662 * optimization for GL(ES) compositors with wl_shm clients.
663 */
664 void (*release)(void *data,
665 struct wl_buffer *wl_buffer);
666};
667
668static inline int
669wl_buffer_add_listener(struct wl_buffer *wl_buffer,
670 const struct wl_buffer_listener *listener, void *data)
671{
672 return wl_proxy_add_listener((struct wl_proxy *) wl_buffer,
673 (void (**)(void)) listener, data);
674}
675
676#define WL_BUFFER_DESTROY 0
677
678static inline void
679wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data)
680{
681 wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data);
682}
683
684static inline void *
685wl_buffer_get_user_data(struct wl_buffer *wl_buffer)
686{
687 return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer);
688}
689
690static inline void
691wl_buffer_destroy(struct wl_buffer *wl_buffer)
692{
693 wl_proxy_marshal((struct wl_proxy *) wl_buffer,
694 WL_BUFFER_DESTROY);
695
696 wl_proxy_destroy((struct wl_proxy *) wl_buffer);
697}
698
699/**
700 * wl_data_offer - offer to transfer data
701 * @offer: advertise offered mime type
702 *
703 * A wl_data_offer represents a piece of data offered for transfer by
704 * another client (the source client). It is used by the copy-and-paste and
705 * drag-and-drop mechanisms. The offer describes the different mime types
706 * that the data can be converted to and provides the mechanism for
707 * transferring the data directly from the source client.
708 */
709struct wl_data_offer_listener {
710 /**
711 * offer - advertise offered mime type
712 * @mime_type: (none)
713 *
714 * Sent immediately after creating the wl_data_offer object. One
715 * event per offered mime type.
716 */
717 void (*offer)(void *data,
718 struct wl_data_offer *wl_data_offer,
719 const char *mime_type);
720};
721
722static inline int
723wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer,
724 const struct wl_data_offer_listener *listener, void *data)
725{
726 return wl_proxy_add_listener((struct wl_proxy *) wl_data_offer,
727 (void (**)(void)) listener, data);
728}
729
730#define WL_DATA_OFFER_ACCEPT 0
731#define WL_DATA_OFFER_RECEIVE 1
732#define WL_DATA_OFFER_DESTROY 2
733
734static inline void
735wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data)
736{
737 wl_proxy_set_user_data((struct wl_proxy *) wl_data_offer, user_data);
738}
739
740static inline void *
741wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer)
742{
743 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_offer);
744}
745
746static inline void
747wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const char *mime_type)
748{
749 wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
750 WL_DATA_OFFER_ACCEPT, serial, mime_type);
751}
752
753static inline void
754wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type, int32_t fd)
755{
756 wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
757 WL_DATA_OFFER_RECEIVE, mime_type, fd);
758}
759
760static inline void
761wl_data_offer_destroy(struct wl_data_offer *wl_data_offer)
762{
763 wl_proxy_marshal((struct wl_proxy *) wl_data_offer,
764 WL_DATA_OFFER_DESTROY);
765
766 wl_proxy_destroy((struct wl_proxy *) wl_data_offer);
767}
768
769/**
770 * wl_data_source - offer to transfer data
771 * @target: a target accepts an offered mime type
772 * @send: send the data
773 * @cancelled: selection was cancelled
774 *
775 * The wl_data_source object is the source side of a wl_data_offer. It is
776 * created by the source client in a data transfer and provides a way to
777 * describe the offered data and a way to respond to requests to transfer
778 * the data.
779 */
780struct wl_data_source_listener {
781 /**
782 * target - a target accepts an offered mime type
783 * @mime_type: (none)
784 *
785 * Sent when a target accepts pointer_focus or motion events. If
786 * a target does not accept any of the offered types, type is NULL.
787 *
788 * Used for feedback during drag-and-drop.
789 */
790 void (*target)(void *data,
791 struct wl_data_source *wl_data_source,
792 const char *mime_type);
793 /**
794 * send - send the data
795 * @mime_type: (none)
796 * @fd: (none)
797 *
798 * Request for data from the client. Send the data as the
799 * specified mime type over the passed file descriptor, then close
800 * it.
801 */
802 void (*send)(void *data,
803 struct wl_data_source *wl_data_source,
804 const char *mime_type,
805 int32_t fd);
806 /**
807 * cancelled - selection was cancelled
808 *
809 * This data source has been replaced by another data source. The
810 * client should clean up and destroy this data source.
811 */
812 void (*cancelled)(void *data,
813 struct wl_data_source *wl_data_source);
814};
815
816static inline int
817wl_data_source_add_listener(struct wl_data_source *wl_data_source,
818 const struct wl_data_source_listener *listener, void *data)
819{
820 return wl_proxy_add_listener((struct wl_proxy *) wl_data_source,
821 (void (**)(void)) listener, data);
822}
823
824#define WL_DATA_SOURCE_OFFER 0
825#define WL_DATA_SOURCE_DESTROY 1
826
827static inline void
828wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_data)
829{
830 wl_proxy_set_user_data((struct wl_proxy *) wl_data_source, user_data);
831}
832
833static inline void *
834wl_data_source_get_user_data(struct wl_data_source *wl_data_source)
835{
836 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_source);
837}
838
839static inline void
840wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_type)
841{
842 wl_proxy_marshal((struct wl_proxy *) wl_data_source,
843 WL_DATA_SOURCE_OFFER, mime_type);
844}
845
846static inline void
847wl_data_source_destroy(struct wl_data_source *wl_data_source)
848{
849 wl_proxy_marshal((struct wl_proxy *) wl_data_source,
850 WL_DATA_SOURCE_DESTROY);
851
852 wl_proxy_destroy((struct wl_proxy *) wl_data_source);
853}
854
855/**
856 * wl_data_device - data transfer device
857 * @data_offer: introduce a new wl_data_offer
858 * @enter: initiate drag-and-drop session
859 * @leave: end drag-and-drop session
860 * @motion: drag-and-drop session motion
861 * @drop: end drag-and-drag session successfully
862 * @selection: advertise new selection
863 *
864 * There is one wl_data_device per seat which can be obtained from the
865 * global wl_data_device_manager singleton.
866 *
867 * A wl_data_device provides access to inter-client data transfer
868 * mechanisms such as copy-and-paste and drag-and-drop.
869 */
870struct wl_data_device_listener {
871 /**
872 * data_offer - introduce a new wl_data_offer
873 * @id: (none)
874 *
875 * The data_offer event introduces a new wl_data_offer object,
876 * which will subsequently be used in either the data_device.enter
877 * event (for drag-and-drop) or the data_device.selection event
878 * (for selections). Immediately following the
879 * data_device_data_offer event, the new data_offer object will
880 * send out data_offer.offer events to describe the mime types it
881 * offers.
882 */
883 void (*data_offer)(void *data,
884 struct wl_data_device *wl_data_device,
885 struct wl_data_offer *id);
886 /**
887 * enter - initiate drag-and-drop session
888 * @serial: (none)
889 * @surface: (none)
890 * @x: (none)
891 * @y: (none)
892 * @id: (none)
893 *
894 * This event is sent when an active drag-and-drop pointer enters
895 * a surface owned by the client. The position of the pointer at
896 * enter time is provided by the x and y arguments, in surface
897 * local coordinates.
898 */
899 void (*enter)(void *data,
900 struct wl_data_device *wl_data_device,
901 uint32_t serial,
902 struct wl_surface *surface,
903 wl_fixed_t x,
904 wl_fixed_t y,
905 struct wl_data_offer *id);
906 /**
907 * leave - end drag-and-drop session
908 *
909 * This event is sent when the drag-and-drop pointer leaves the
910 * surface and the session ends. The client must destroy the
911 * wl_data_offer introduced at enter time at this point.
912 */
913 void (*leave)(void *data,
914 struct wl_data_device *wl_data_device);
915 /**
916 * motion - drag-and-drop session motion
917 * @time: timestamp with millisecond granularity
918 * @x: (none)
919 * @y: (none)
920 *
921 * This event is sent when the drag-and-drop pointer moves within
922 * the currently focused surface. The new position of the pointer
923 * is provided by the x and y arguments, in surface local
924 * coordinates.
925 */
926 void (*motion)(void *data,
927 struct wl_data_device *wl_data_device,
928 uint32_t time,
929 wl_fixed_t x,
930 wl_fixed_t y);
931 /**
932 * drop - end drag-and-drag session successfully
933 *
934 * The event is sent when a drag-and-drop operation is ended
935 * because the implicit grab is removed.
936 */
937 void (*drop)(void *data,
938 struct wl_data_device *wl_data_device);
939 /**
940 * selection - advertise new selection
941 * @id: (none)
942 *
943 * The selection event is sent out to notify the client of a new
944 * wl_data_offer for the selection for this device. The
945 * data_device.data_offer and the data_offer.offer events are sent
946 * out immediately before this event to introduce the data offer
947 * object. The selection event is sent to a client immediately
948 * before receiving keyboard focus and when a new selection is set
949 * while the client has keyboard focus. The data_offer is valid
950 * until a new data_offer or NULL is received or until the client
951 * loses keyboard focus.
952 */
953 void (*selection)(void *data,
954 struct wl_data_device *wl_data_device,
955 struct wl_data_offer *id);
956};
957
958static inline int
959wl_data_device_add_listener(struct wl_data_device *wl_data_device,
960 const struct wl_data_device_listener *listener, void *data)
961{
962 return wl_proxy_add_listener((struct wl_proxy *) wl_data_device,
963 (void (**)(void)) listener, data);
964}
965
966#define WL_DATA_DEVICE_START_DRAG 0
967#define WL_DATA_DEVICE_SET_SELECTION 1
968
969static inline void
970wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_data)
971{
972 wl_proxy_set_user_data((struct wl_proxy *) wl_data_device, user_data);
973}
974
975static inline void *
976wl_data_device_get_user_data(struct wl_data_device *wl_data_device)
977{
978 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device);
979}
980
981static inline void
982wl_data_device_destroy(struct wl_data_device *wl_data_device)
983{
984 wl_proxy_destroy((struct wl_proxy *) wl_data_device);
985}
986
987static inline void
988wl_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)
989{
990 wl_proxy_marshal((struct wl_proxy *) wl_data_device,
991 WL_DATA_DEVICE_START_DRAG, source, origin, icon, serial);
992}
993
994static inline void
995wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_data_source *source, uint32_t serial)
996{
997 wl_proxy_marshal((struct wl_proxy *) wl_data_device,
998 WL_DATA_DEVICE_SET_SELECTION, source, serial);
999}
1000
1001#define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0
1002#define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1
1003
1004static inline void
1005wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_device_manager, void *user_data)
1006{
1007 wl_proxy_set_user_data((struct wl_proxy *) wl_data_device_manager, user_data);
1008}
1009
1010static inline void *
1011wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_device_manager)
1012{
1013 return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device_manager);
1014}
1015
1016static inline void
1017wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_manager)
1018{
1019 wl_proxy_destroy((struct wl_proxy *) wl_data_device_manager);
1020}
1021
1022static inline struct wl_data_source *
1023wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data_device_manager)
1024{
1025 struct wl_proxy *id;
1026
1027 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_manager,
1028 WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, &wl_data_source_interface, NULL);
1029
1030 return (struct wl_data_source *) id;
1031}
1032
1033static inline struct wl_data_device *
1034wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_device_manager, struct wl_seat *seat)
1035{
1036 struct wl_proxy *id;
1037
1038 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_data_device_manager,
1039 WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, &wl_data_device_interface, NULL, seat);
1040
1041 return (struct wl_data_device *) id;
1042}
1043
1044#define WL_SHELL_GET_SHELL_SURFACE 0
1045
1046static inline void
1047wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data)
1048{
1049 wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data);
1050}
1051
1052static inline void *
1053wl_shell_get_user_data(struct wl_shell *wl_shell)
1054{
1055 return wl_proxy_get_user_data((struct wl_proxy *) wl_shell);
1056}
1057
1058static inline void
1059wl_shell_destroy(struct wl_shell *wl_shell)
1060{
1061 wl_proxy_destroy((struct wl_proxy *) wl_shell);
1062}
1063
1064static inline struct wl_shell_surface *
1065wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
1066{
1067 struct wl_proxy *id;
1068
1069 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_shell,
1070 WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface, NULL, surface);
1071
1072 return (struct wl_shell_surface *) id;
1073}
1074
1075#ifndef WL_SHELL_SURFACE_RESIZE_ENUM
1076#define WL_SHELL_SURFACE_RESIZE_ENUM
1077/**
1078 * wl_shell_surface_resize - edge values for resizing
1079 * @WL_SHELL_SURFACE_RESIZE_NONE: (none)
1080 * @WL_SHELL_SURFACE_RESIZE_TOP: (none)
1081 * @WL_SHELL_SURFACE_RESIZE_BOTTOM: (none)
1082 * @WL_SHELL_SURFACE_RESIZE_LEFT: (none)
1083 * @WL_SHELL_SURFACE_RESIZE_TOP_LEFT: (none)
1084 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT: (none)
1085 * @WL_SHELL_SURFACE_RESIZE_RIGHT: (none)
1086 * @WL_SHELL_SURFACE_RESIZE_TOP_RIGHT: (none)
1087 * @WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT: (none)
1088 *
1089 * These values are used to indicate which edge of a surface is being
1090 * dragged in a resize operation. The server may use this information to
1091 * adapt its behavior, e.g. choose an appropriate cursor image.
1092 */
1093enum wl_shell_surface_resize {
1094 WL_SHELL_SURFACE_RESIZE_NONE = 0,
1095 WL_SHELL_SURFACE_RESIZE_TOP = 1,
1096 WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
1097 WL_SHELL_SURFACE_RESIZE_LEFT = 4,
1098 WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
1099 WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
1100 WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
1101 WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
1102 WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
1103};
1104#endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
1105
1106#ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
1107#define WL_SHELL_SURFACE_TRANSIENT_ENUM
1108/**
1109 * wl_shell_surface_transient - details of transient behaviour
1110 * @WL_SHELL_SURFACE_TRANSIENT_INACTIVE: do not set keyboard focus
1111 *
1112 * These flags specify details of the expected behaviour of transient
1113 * surfaces. Used in the set_transient request.
1114 */
1115enum wl_shell_surface_transient {
1116 WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
1117};
1118#endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
1119
1120#ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
1121#define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
1122/**
1123 * wl_shell_surface_fullscreen_method - different method to set the
1124 * surface fullscreen
1125 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT: no preference, apply
1126 * default policy
1127 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE: scale, preserve the
1128 * surface's aspect ratio and center on output
1129 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER: switch output mode to the
1130 * smallest mode that can fit the surface, add black borders to compensate
1131 * size mismatch
1132 * @WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL: no upscaling, center on
1133 * output and add black borders to compensate size mismatch
1134 *
1135 * Hints to indicate to the compositor how to deal with a conflict
1136 * between the dimensions of the surface and the dimensions of the output.
1137 * The compositor is free to ignore this parameter.
1138 */
1139enum wl_shell_surface_fullscreen_method {
1140 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
1141 WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
1142 WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
1143 WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
1144};
1145#endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
1146
1147/**
1148 * wl_shell_surface - desktop-style metadata interface
1149 * @ping: ping client
1150 * @configure: suggest resize
1151 * @popup_done: popup interaction is done
1152 *
1153 * An interface that may be implemented by a wl_surface, for
1154 * implementations that provide a desktop-style user interface.
1155 *
1156 * It provides requests to treat surfaces like toplevel, fullscreen or
1157 * popup windows, move, resize or maximize them, associate metadata like
1158 * title and class, etc.
1159 *
1160 * On the server side the object is automatically destroyed when the
1161 * related wl_surface is destroyed. On client side,
1162 * wl_shell_surface_destroy() must be called before destroying the
1163 * wl_surface object.
1164 */
1165struct wl_shell_surface_listener {
1166 /**
1167 * ping - ping client
1168 * @serial: (none)
1169 *
1170 * Ping a client to check if it is receiving events and sending
1171 * requests. A client is expected to reply with a pong request.
1172 */
1173 void (*ping)(void *data,
1174 struct wl_shell_surface *wl_shell_surface,
1175 uint32_t serial);
1176 /**
1177 * configure - suggest resize
1178 * @edges: (none)
1179 * @width: (none)
1180 * @height: (none)
1181 *
1182 * The configure event asks the client to resize its surface.
1183 *
1184 * The size is a hint, in the sense that the client is free to
1185 * ignore it if it doesn't resize, pick a smaller size (to satisfy
1186 * aspect ratio or resize in steps of NxM pixels).
1187 *
1188 * The edges parameter provides a hint about how the surface was
1189 * resized. The client may use this information to decide how to
1190 * adjust its content to the new size (e.g. a scrolling area might
1191 * adjust its content position to leave the viewable content
1192 * unmoved).
1193 *
1194 * The client is free to dismiss all but the last configure event
1195 * it received.
1196 *
1197 * The width and height arguments specify the size of the window in
1198 * surface local coordinates.
1199 */
1200 void (*configure)(void *data,
1201 struct wl_shell_surface *wl_shell_surface,
1202 uint32_t edges,
1203 int32_t width,
1204 int32_t height);
1205 /**
1206 * popup_done - popup interaction is done
1207 *
1208 * The popup_done event is sent out when a popup grab is broken,
1209 * that is, when the user clicks a surface that doesn't belong to
1210 * the client owning the popup surface.
1211 */
1212 void (*popup_done)(void *data,
1213 struct wl_shell_surface *wl_shell_surface);
1214};
1215
1216static inline int
1217wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface,
1218 const struct wl_shell_surface_listener *listener, void *data)
1219{
1220 return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface,
1221 (void (**)(void)) listener, data);
1222}
1223
1224#define WL_SHELL_SURFACE_PONG 0
1225#define WL_SHELL_SURFACE_MOVE 1
1226#define WL_SHELL_SURFACE_RESIZE 2
1227#define WL_SHELL_SURFACE_SET_TOPLEVEL 3
1228#define WL_SHELL_SURFACE_SET_TRANSIENT 4
1229#define WL_SHELL_SURFACE_SET_FULLSCREEN 5
1230#define WL_SHELL_SURFACE_SET_POPUP 6
1231#define WL_SHELL_SURFACE_SET_MAXIMIZED 7
1232#define WL_SHELL_SURFACE_SET_TITLE 8
1233#define WL_SHELL_SURFACE_SET_CLASS 9
1234
1235static inline void
1236wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
1237{
1238 wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data);
1239}
1240
1241static inline void *
1242wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface)
1243{
1244 return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface);
1245}
1246
1247static inline void
1248wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
1249{
1250 wl_proxy_destroy((struct wl_proxy *) wl_shell_surface);
1251}
1252
1253static inline void
1254wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
1255{
1256 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1257 WL_SHELL_SURFACE_PONG, serial);
1258}
1259
1260static inline void
1261wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
1262{
1263 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1264 WL_SHELL_SURFACE_MOVE, seat, serial);
1265}
1266
1267static inline void
1268wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
1269{
1270 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1271 WL_SHELL_SURFACE_RESIZE, seat, serial, edges);
1272}
1273
1274static inline void
1275wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
1276{
1277 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1278 WL_SHELL_SURFACE_SET_TOPLEVEL);
1279}
1280
1281static inline void
1282wl_shell_surface_set_transient(struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
1283{
1284 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1285 WL_SHELL_SURFACE_SET_TRANSIENT, parent, x, y, flags);
1286}
1287
1288static inline void
1289wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
1290{
1291 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1292 WL_SHELL_SURFACE_SET_FULLSCREEN, method, framerate, output);
1293}
1294
1295static inline void
1296wl_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)
1297{
1298 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1299 WL_SHELL_SURFACE_SET_POPUP, seat, serial, parent, x, y, flags);
1300}
1301
1302static inline void
1303wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
1304{
1305 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1306 WL_SHELL_SURFACE_SET_MAXIMIZED, output);
1307}
1308
1309static inline void
1310wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
1311{
1312 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1313 WL_SHELL_SURFACE_SET_TITLE, title);
1314}
1315
1316static inline void
1317wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
1318{
1319 wl_proxy_marshal((struct wl_proxy *) wl_shell_surface,
1320 WL_SHELL_SURFACE_SET_CLASS, class_);
1321}
1322
1323/**
1324 * wl_surface - an onscreen surface
1325 * @enter: surface enters an output
1326 * @leave: surface leaves an output
1327 *
1328 * A surface is a rectangular area that is displayed on the screen. It
1329 * has a location, size and pixel contents.
1330 *
1331 * The size of a surface (and relative positions on it) is described in
1332 * surface local coordinates, which may differ from the buffer local
1333 * coordinates of the pixel content, in case a buffer_transform or a
1334 * buffer_scale is used.
1335 *
1336 * Surfaces are also used for some special purposes, e.g. as cursor images
1337 * for pointers, drag icons, etc.
1338 */
1339struct wl_surface_listener {
1340 /**
1341 * enter - surface enters an output
1342 * @output: (none)
1343 *
1344 * This is emitted whenever a surface's creation, movement, or
1345 * resizing results in some part of it being within the scanout
1346 * region of an output.
1347 *
1348 * Note that a surface may be overlapping with zero or more
1349 * outputs.
1350 */
1351 void (*enter)(void *data,
1352 struct wl_surface *wl_surface,
1353 struct wl_output *output);
1354 /**
1355 * leave - surface leaves an output
1356 * @output: (none)
1357 *
1358 * This is emitted whenever a surface's creation, movement, or
1359 * resizing results in it no longer having any part of it within
1360 * the scanout region of an output.
1361 */
1362 void (*leave)(void *data,
1363 struct wl_surface *wl_surface,
1364 struct wl_output *output);
1365};
1366
1367static inline int
1368wl_surface_add_listener(struct wl_surface *wl_surface,
1369 const struct wl_surface_listener *listener, void *data)
1370{
1371 return wl_proxy_add_listener((struct wl_proxy *) wl_surface,
1372 (void (**)(void)) listener, data);
1373}
1374
1375#define WL_SURFACE_DESTROY 0
1376#define WL_SURFACE_ATTACH 1
1377#define WL_SURFACE_DAMAGE 2
1378#define WL_SURFACE_FRAME 3
1379#define WL_SURFACE_SET_OPAQUE_REGION 4
1380#define WL_SURFACE_SET_INPUT_REGION 5
1381#define WL_SURFACE_COMMIT 6
1382#define WL_SURFACE_SET_BUFFER_TRANSFORM 7
1383#define WL_SURFACE_SET_BUFFER_SCALE 8
1384
1385static inline void
1386wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
1387{
1388 wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data);
1389}
1390
1391static inline void *
1392wl_surface_get_user_data(struct wl_surface *wl_surface)
1393{
1394 return wl_proxy_get_user_data((struct wl_proxy *) wl_surface);
1395}
1396
1397static inline void
1398wl_surface_destroy(struct wl_surface *wl_surface)
1399{
1400 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1401 WL_SURFACE_DESTROY);
1402
1403 wl_proxy_destroy((struct wl_proxy *) wl_surface);
1404}
1405
1406static inline void
1407wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
1408{
1409 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1410 WL_SURFACE_ATTACH, buffer, x, y);
1411}
1412
1413static inline void
1414wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
1415{
1416 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1417 WL_SURFACE_DAMAGE, x, y, width, height);
1418}
1419
1420static inline struct wl_callback *
1421wl_surface_frame(struct wl_surface *wl_surface)
1422{
1423 struct wl_proxy *callback;
1424
1425 callback = wl_proxy_marshal_constructor((struct wl_proxy *) wl_surface,
1426 WL_SURFACE_FRAME, &wl_callback_interface, NULL);
1427
1428 return (struct wl_callback *) callback;
1429}
1430
1431static inline void
1432wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
1433{
1434 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1435 WL_SURFACE_SET_OPAQUE_REGION, region);
1436}
1437
1438static inline void
1439wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *region)
1440{
1441 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1442 WL_SURFACE_SET_INPUT_REGION, region);
1443}
1444
1445static inline void
1446wl_surface_commit(struct wl_surface *wl_surface)
1447{
1448 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1449 WL_SURFACE_COMMIT);
1450}
1451
1452static inline void
1453wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform)
1454{
1455 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1456 WL_SURFACE_SET_BUFFER_TRANSFORM, transform);
1457}
1458
1459static inline void
1460wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
1461{
1462 wl_proxy_marshal((struct wl_proxy *) wl_surface,
1463 WL_SURFACE_SET_BUFFER_SCALE, scale);
1464}
1465
1466#ifndef WL_SEAT_CAPABILITY_ENUM
1467#define WL_SEAT_CAPABILITY_ENUM
1468/**
1469 * wl_seat_capability - seat capability bitmask
1470 * @WL_SEAT_CAPABILITY_POINTER: The seat has pointer devices
1471 * @WL_SEAT_CAPABILITY_KEYBOARD: The seat has one or more keyboards
1472 * @WL_SEAT_CAPABILITY_TOUCH: The seat has touch devices
1473 *
1474 * This is a bitmask of capabilities this seat has; if a member is set,
1475 * then it is present on the seat.
1476 */
1477enum wl_seat_capability {
1478 WL_SEAT_CAPABILITY_POINTER = 1,
1479 WL_SEAT_CAPABILITY_KEYBOARD = 2,
1480 WL_SEAT_CAPABILITY_TOUCH = 4,
1481};
1482#endif /* WL_SEAT_CAPABILITY_ENUM */
1483
1484/**
1485 * wl_seat - group of input devices
1486 * @capabilities: seat capabilities changed
1487 * @name: unique identifier for this seat
1488 *
1489 * A seat is a group of keyboards, pointer and touch devices. This object
1490 * is published as a global during start up, or when such a device is hot
1491 * plugged. A seat typically has a pointer and maintains a keyboard focus
1492 * and a pointer focus.
1493 */
1494struct wl_seat_listener {
1495 /**
1496 * capabilities - seat capabilities changed
1497 * @capabilities: (none)
1498 *
1499 * This is emitted whenever a seat gains or loses the pointer,
1500 * keyboard or touch capabilities. The argument is a capability
1501 * enum containing the complete set of capabilities this seat has.
1502 */
1503 void (*capabilities)(void *data,
1504 struct wl_seat *wl_seat,
1505 uint32_t capabilities);
1506 /**
1507 * name - unique identifier for this seat
1508 * @name: (none)
1509 *
1510 * In a multiseat configuration this can be used by the client to
1511 * help identify which physical devices the seat represents. Based
1512 * on the seat configuration used by the compositor.
1513 * @since: 2
1514 */
1515 void (*name)(void *data,
1516 struct wl_seat *wl_seat,
1517 const char *name);
1518};
1519
1520static inline int
1521wl_seat_add_listener(struct wl_seat *wl_seat,
1522 const struct wl_seat_listener *listener, void *data)
1523{
1524 return wl_proxy_add_listener((struct wl_proxy *) wl_seat,
1525 (void (**)(void)) listener, data);
1526}
1527
1528#define WL_SEAT_GET_POINTER 0
1529#define WL_SEAT_GET_KEYBOARD 1
1530#define WL_SEAT_GET_TOUCH 2
1531
1532static inline void
1533wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data)
1534{
1535 wl_proxy_set_user_data((struct wl_proxy *) wl_seat, user_data);
1536}
1537
1538static inline void *
1539wl_seat_get_user_data(struct wl_seat *wl_seat)
1540{
1541 return wl_proxy_get_user_data((struct wl_proxy *) wl_seat);
1542}
1543
1544static inline void
1545wl_seat_destroy(struct wl_seat *wl_seat)
1546{
1547 wl_proxy_destroy((struct wl_proxy *) wl_seat);
1548}
1549
1550static inline struct wl_pointer *
1551wl_seat_get_pointer(struct wl_seat *wl_seat)
1552{
1553 struct wl_proxy *id;
1554
1555 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
1556 WL_SEAT_GET_POINTER, &wl_pointer_interface, NULL);
1557
1558 return (struct wl_pointer *) id;
1559}
1560
1561static inline struct wl_keyboard *
1562wl_seat_get_keyboard(struct wl_seat *wl_seat)
1563{
1564 struct wl_proxy *id;
1565
1566 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
1567 WL_SEAT_GET_KEYBOARD, &wl_keyboard_interface, NULL);
1568
1569 return (struct wl_keyboard *) id;
1570}
1571
1572static inline struct wl_touch *
1573wl_seat_get_touch(struct wl_seat *wl_seat)
1574{
1575 struct wl_proxy *id;
1576
1577 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_seat,
1578 WL_SEAT_GET_TOUCH, &wl_touch_interface, NULL);
1579
1580 return (struct wl_touch *) id;
1581}
1582
1583#ifndef WL_POINTER_BUTTON_STATE_ENUM
1584#define WL_POINTER_BUTTON_STATE_ENUM
1585/**
1586 * wl_pointer_button_state - physical button state
1587 * @WL_POINTER_BUTTON_STATE_RELEASED: The button is not pressed
1588 * @WL_POINTER_BUTTON_STATE_PRESSED: The button is pressed
1589 *
1590 * Describes the physical state of a button which provoked the button
1591 * event.
1592 */
1593enum wl_pointer_button_state {
1594 WL_POINTER_BUTTON_STATE_RELEASED = 0,
1595 WL_POINTER_BUTTON_STATE_PRESSED = 1,
1596};
1597#endif /* WL_POINTER_BUTTON_STATE_ENUM */
1598
1599#ifndef WL_POINTER_AXIS_ENUM
1600#define WL_POINTER_AXIS_ENUM
1601/**
1602 * wl_pointer_axis - axis types
1603 * @WL_POINTER_AXIS_VERTICAL_SCROLL: (none)
1604 * @WL_POINTER_AXIS_HORIZONTAL_SCROLL: (none)
1605 *
1606 * Describes the axis types of scroll events.
1607 */
1608enum wl_pointer_axis {
1609 WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
1610 WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
1611};
1612#endif /* WL_POINTER_AXIS_ENUM */
1613
1614/**
1615 * wl_pointer - pointer input device
1616 * @enter: enter event
1617 * @leave: leave event
1618 * @motion: pointer motion event
1619 * @button: pointer button event
1620 * @axis: axis event
1621 *
1622 * The wl_pointer interface represents one or more input devices, such as
1623 * mice, which control the pointer location and pointer_focus of a seat.
1624 *
1625 * The wl_pointer interface generates motion, enter and leave events for
1626 * the surfaces that the pointer is located over, and button and axis
1627 * events for button presses, button releases and scrolling.
1628 */
1629struct wl_pointer_listener {
1630 /**
1631 * enter - enter event
1632 * @serial: (none)
1633 * @surface: (none)
1634 * @surface_x: x coordinate in surface-relative coordinates
1635 * @surface_y: y coordinate in surface-relative coordinates
1636 *
1637 * Notification that this seat's pointer is focused on a certain
1638 * surface.
1639 *
1640 * When an seat's focus enters a surface, the pointer image is
1641 * undefined and a client should respond to this event by setting
1642 * an appropriate pointer image with the set_cursor request.
1643 */
1644 void (*enter)(void *data,
1645 struct wl_pointer *wl_pointer,
1646 uint32_t serial,
1647 struct wl_surface *surface,
1648 wl_fixed_t surface_x,
1649 wl_fixed_t surface_y);
1650 /**
1651 * leave - leave event
1652 * @serial: (none)
1653 * @surface: (none)
1654 *
1655 * Notification that this seat's pointer is no longer focused on
1656 * a certain surface.
1657 *
1658 * The leave notification is sent before the enter notification for
1659 * the new focus.
1660 */
1661 void (*leave)(void *data,
1662 struct wl_pointer *wl_pointer,
1663 uint32_t serial,
1664 struct wl_surface *surface);
1665 /**
1666 * motion - pointer motion event
1667 * @time: timestamp with millisecond granularity
1668 * @surface_x: x coordinate in surface-relative coordinates
1669 * @surface_y: y coordinate in surface-relative coordinates
1670 *
1671 * Notification of pointer location change. The arguments
1672 * surface_x and surface_y are the location relative to the focused
1673 * surface.
1674 */
1675 void (*motion)(void *data,
1676 struct wl_pointer *wl_pointer,
1677 uint32_t time,
1678 wl_fixed_t surface_x,
1679 wl_fixed_t surface_y);
1680 /**
1681 * button - pointer button event
1682 * @serial: (none)
1683 * @time: timestamp with millisecond granularity
1684 * @button: (none)
1685 * @state: (none)
1686 *
1687 * Mouse button click and release notifications.
1688 *
1689 * The location of the click is given by the last motion or enter
1690 * event. The time argument is a timestamp with millisecond
1691 * granularity, with an undefined base.
1692 */
1693 void (*button)(void *data,
1694 struct wl_pointer *wl_pointer,
1695 uint32_t serial,
1696 uint32_t time,
1697 uint32_t button,
1698 uint32_t state);
1699 /**
1700 * axis - axis event
1701 * @time: timestamp with millisecond granularity
1702 * @axis: (none)
1703 * @value: (none)
1704 *
1705 * Scroll and other axis notifications.
1706 *
1707 * For scroll events (vertical and horizontal scroll axes), the
1708 * value parameter is the length of a vector along the specified
1709 * axis in a coordinate space identical to those of motion events,
1710 * representing a relative movement along the specified axis.
1711 *
1712 * For devices that support movements non-parallel to axes multiple
1713 * axis events will be emitted.
1714 *
1715 * When applicable, for example for touch pads, the server can
1716 * choose to emit scroll events where the motion vector is
1717 * equivalent to a motion event vector.
1718 *
1719 * When applicable, clients can transform its view relative to the
1720 * scroll distance.
1721 */
1722 void (*axis)(void *data,
1723 struct wl_pointer *wl_pointer,
1724 uint32_t time,
1725 uint32_t axis,
1726 wl_fixed_t value);
1727};
1728
1729static inline int
1730wl_pointer_add_listener(struct wl_pointer *wl_pointer,
1731 const struct wl_pointer_listener *listener, void *data)
1732{
1733 return wl_proxy_add_listener((struct wl_proxy *) wl_pointer,
1734 (void (**)(void)) listener, data);
1735}
1736
1737#define WL_POINTER_SET_CURSOR 0
1738#define WL_POINTER_RELEASE 1
1739
1740static inline void
1741wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data)
1742{
1743 wl_proxy_set_user_data((struct wl_proxy *) wl_pointer, user_data);
1744}
1745
1746static inline void *
1747wl_pointer_get_user_data(struct wl_pointer *wl_pointer)
1748{
1749 return wl_proxy_get_user_data((struct wl_proxy *) wl_pointer);
1750}
1751
1752static inline void
1753wl_pointer_destroy(struct wl_pointer *wl_pointer)
1754{
1755 wl_proxy_destroy((struct wl_proxy *) wl_pointer);
1756}
1757
1758static inline void
1759wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
1760{
1761 wl_proxy_marshal((struct wl_proxy *) wl_pointer,
1762 WL_POINTER_SET_CURSOR, serial, surface, hotspot_x, hotspot_y);
1763}
1764
1765static inline void
1766wl_pointer_release(struct wl_pointer *wl_pointer)
1767{
1768 wl_proxy_marshal((struct wl_proxy *) wl_pointer,
1769 WL_POINTER_RELEASE);
1770
1771 wl_proxy_destroy((struct wl_proxy *) wl_pointer);
1772}
1773
1774#ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
1775#define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
1776/**
1777 * wl_keyboard_keymap_format - keyboard mapping format
1778 * @WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP: no keymap; client must
1779 * understand how to interpret the raw keycode
1780 * @WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1: libxkbcommon compatible; to
1781 * determine the xkb keycode, clients must add 8 to the key event keycode
1782 *
1783 * This specifies the format of the keymap provided to the client with
1784 * the wl_keyboard.keymap event.
1785 */
1786enum wl_keyboard_keymap_format {
1787 WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
1788 WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
1789};
1790#endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
1791
1792#ifndef WL_KEYBOARD_KEY_STATE_ENUM
1793#define WL_KEYBOARD_KEY_STATE_ENUM
1794/**
1795 * wl_keyboard_key_state - physical key state
1796 * @WL_KEYBOARD_KEY_STATE_RELEASED: key is not pressed
1797 * @WL_KEYBOARD_KEY_STATE_PRESSED: key is pressed
1798 *
1799 * Describes the physical state of a key which provoked the key event.
1800 */
1801enum wl_keyboard_key_state {
1802 WL_KEYBOARD_KEY_STATE_RELEASED = 0,
1803 WL_KEYBOARD_KEY_STATE_PRESSED = 1,
1804};
1805#endif /* WL_KEYBOARD_KEY_STATE_ENUM */
1806
1807/**
1808 * wl_keyboard - keyboard input device
1809 * @keymap: keyboard mapping
1810 * @enter: enter event
1811 * @leave: leave event
1812 * @key: key event
1813 * @modifiers: modifier and group state
1814 *
1815 * The wl_keyboard interface represents one or more keyboards associated
1816 * with a seat.
1817 */
1818struct wl_keyboard_listener {
1819 /**
1820 * keymap - keyboard mapping
1821 * @format: (none)
1822 * @fd: (none)
1823 * @size: (none)
1824 *
1825 * This event provides a file descriptor to the client which can
1826 * be memory-mapped to provide a keyboard mapping description.
1827 */
1828 void (*keymap)(void *data,
1829 struct wl_keyboard *wl_keyboard,
1830 uint32_t format,
1831 int32_t fd,
1832 uint32_t size);
1833 /**
1834 * enter - enter event
1835 * @serial: (none)
1836 * @surface: (none)
1837 * @keys: the currently pressed keys
1838 *
1839 * Notification that this seat's keyboard focus is on a certain
1840 * surface.
1841 */
1842 void (*enter)(void *data,
1843 struct wl_keyboard *wl_keyboard,
1844 uint32_t serial,
1845 struct wl_surface *surface,
1846 struct wl_array *keys);
1847 /**
1848 * leave - leave event
1849 * @serial: (none)
1850 * @surface: (none)
1851 *
1852 * Notification that this seat's keyboard focus is no longer on a
1853 * certain surface.
1854 *
1855 * The leave notification is sent before the enter notification for
1856 * the new focus.
1857 */
1858 void (*leave)(void *data,
1859 struct wl_keyboard *wl_keyboard,
1860 uint32_t serial,
1861 struct wl_surface *surface);
1862 /**
1863 * key - key event
1864 * @serial: (none)
1865 * @time: timestamp with millisecond granularity
1866 * @key: (none)
1867 * @state: (none)
1868 *
1869 * A key was pressed or released. The time argument is a
1870 * timestamp with millisecond granularity, with an undefined base.
1871 */
1872 void (*key)(void *data,
1873 struct wl_keyboard *wl_keyboard,
1874 uint32_t serial,
1875 uint32_t time,
1876 uint32_t key,
1877 uint32_t state);
1878 /**
1879 * modifiers - modifier and group state
1880 * @serial: (none)
1881 * @mods_depressed: (none)
1882 * @mods_latched: (none)
1883 * @mods_locked: (none)
1884 * @group: (none)
1885 *
1886 * Notifies clients that the modifier and/or group state has
1887 * changed, and it should update its local state.
1888 */
1889 void (*modifiers)(void *data,
1890 struct wl_keyboard *wl_keyboard,
1891 uint32_t serial,
1892 uint32_t mods_depressed,
1893 uint32_t mods_latched,
1894 uint32_t mods_locked,
1895 uint32_t group);
1896};
1897
1898static inline int
1899wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard,
1900 const struct wl_keyboard_listener *listener, void *data)
1901{
1902 return wl_proxy_add_listener((struct wl_proxy *) wl_keyboard,
1903 (void (**)(void)) listener, data);
1904}
1905
1906#define WL_KEYBOARD_RELEASE 0
1907
1908static inline void
1909wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data)
1910{
1911 wl_proxy_set_user_data((struct wl_proxy *) wl_keyboard, user_data);
1912}
1913
1914static inline void *
1915wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard)
1916{
1917 return wl_proxy_get_user_data((struct wl_proxy *) wl_keyboard);
1918}
1919
1920static inline void
1921wl_keyboard_destroy(struct wl_keyboard *wl_keyboard)
1922{
1923 wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
1924}
1925
1926static inline void
1927wl_keyboard_release(struct wl_keyboard *wl_keyboard)
1928{
1929 wl_proxy_marshal((struct wl_proxy *) wl_keyboard,
1930 WL_KEYBOARD_RELEASE);
1931
1932 wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
1933}
1934
1935/**
1936 * wl_touch - touchscreen input device
1937 * @down: touch down event and beginning of a touch sequence
1938 * @up: end of a touch event sequence
1939 * @motion: update of touch point coordinates
1940 * @frame: end of touch frame event
1941 * @cancel: touch session cancelled
1942 *
1943 * The wl_touch interface represents a touchscreen associated with a
1944 * seat.
1945 *
1946 * Touch interactions can consist of one or more contacts. For each
1947 * contact, a series of events is generated, starting with a down event,
1948 * followed by zero or more motion events, and ending with an up event.
1949 * Events relating to the same contact point can be identified by the ID of
1950 * the sequence.
1951 */
1952struct wl_touch_listener {
1953 /**
1954 * down - touch down event and beginning of a touch sequence
1955 * @serial: (none)
1956 * @time: timestamp with millisecond granularity
1957 * @surface: (none)
1958 * @id: the unique ID of this touch point
1959 * @x: x coordinate in surface-relative coordinates
1960 * @y: y coordinate in surface-relative coordinates
1961 *
1962 * A new touch point has appeared on the surface. This touch
1963 * point is assigned a unique @id. Future events from this
1964 * touchpoint reference this ID. The ID ceases to be valid after a
1965 * touch up event and may be re-used in the future.
1966 */
1967 void (*down)(void *data,
1968 struct wl_touch *wl_touch,
1969 uint32_t serial,
1970 uint32_t time,
1971 struct wl_surface *surface,
1972 int32_t id,
1973 wl_fixed_t x,
1974 wl_fixed_t y);
1975 /**
1976 * up - end of a touch event sequence
1977 * @serial: (none)
1978 * @time: timestamp with millisecond granularity
1979 * @id: the unique ID of this touch point
1980 *
1981 * The touch point has disappeared. No further events will be
1982 * sent for this touchpoint and the touch point's ID is released
1983 * and may be re-used in a future touch down event.
1984 */
1985 void (*up)(void *data,
1986 struct wl_touch *wl_touch,
1987 uint32_t serial,
1988 uint32_t time,
1989 int32_t id);
1990 /**
1991 * motion - update of touch point coordinates
1992 * @time: timestamp with millisecond granularity
1993 * @id: the unique ID of this touch point
1994 * @x: x coordinate in surface-relative coordinates
1995 * @y: y coordinate in surface-relative coordinates
1996 *
1997 * A touchpoint has changed coordinates.
1998 */
1999 void (*motion)(void *data,
2000 struct wl_touch *wl_touch,
2001 uint32_t time,
2002 int32_t id,
2003 wl_fixed_t x,
2004 wl_fixed_t y);
2005 /**
2006 * frame - end of touch frame event
2007 *
2008 * Indicates the end of a contact point list.
2009 */
2010 void (*frame)(void *data,
2011 struct wl_touch *wl_touch);
2012 /**
2013 * cancel - touch session cancelled
2014 *
2015 * Sent if the compositor decides the touch stream is a global
2016 * gesture. No further events are sent to the clients from that
2017 * particular gesture. Touch cancellation applies to all touch
2018 * points currently active on this client's surface. The client is
2019 * responsible for finalizing the touch points, future touch points
2020 * on this surface may re-use the touch point ID.
2021 */
2022 void (*cancel)(void *data,
2023 struct wl_touch *wl_touch);
2024};
2025
2026static inline int
2027wl_touch_add_listener(struct wl_touch *wl_touch,
2028 const struct wl_touch_listener *listener, void *data)
2029{
2030 return wl_proxy_add_listener((struct wl_proxy *) wl_touch,
2031 (void (**)(void)) listener, data);
2032}
2033
2034#define WL_TOUCH_RELEASE 0
2035
2036static inline void
2037wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data)
2038{
2039 wl_proxy_set_user_data((struct wl_proxy *) wl_touch, user_data);
2040}
2041
2042static inline void *
2043wl_touch_get_user_data(struct wl_touch *wl_touch)
2044{
2045 return wl_proxy_get_user_data((struct wl_proxy *) wl_touch);
2046}
2047
2048static inline void
2049wl_touch_destroy(struct wl_touch *wl_touch)
2050{
2051 wl_proxy_destroy((struct wl_proxy *) wl_touch);
2052}
2053
2054static inline void
2055wl_touch_release(struct wl_touch *wl_touch)
2056{
2057 wl_proxy_marshal((struct wl_proxy *) wl_touch,
2058 WL_TOUCH_RELEASE);
2059
2060 wl_proxy_destroy((struct wl_proxy *) wl_touch);
2061}
2062
2063#ifndef WL_OUTPUT_SUBPIXEL_ENUM
2064#define WL_OUTPUT_SUBPIXEL_ENUM
2065/**
2066 * wl_output_subpixel - subpixel geometry information
2067 * @WL_OUTPUT_SUBPIXEL_UNKNOWN: (none)
2068 * @WL_OUTPUT_SUBPIXEL_NONE: (none)
2069 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB: (none)
2070 * @WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR: (none)
2071 * @WL_OUTPUT_SUBPIXEL_VERTICAL_RGB: (none)
2072 * @WL_OUTPUT_SUBPIXEL_VERTICAL_BGR: (none)
2073 *
2074 * This enumeration describes how the physical pixels on an output are
2075 * layed out.
2076 */
2077enum wl_output_subpixel {
2078 WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
2079 WL_OUTPUT_SUBPIXEL_NONE = 1,
2080 WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
2081 WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
2082 WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
2083 WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
2084};
2085#endif /* WL_OUTPUT_SUBPIXEL_ENUM */
2086
2087#ifndef WL_OUTPUT_TRANSFORM_ENUM
2088#define WL_OUTPUT_TRANSFORM_ENUM
2089/**
2090 * wl_output_transform - transform from framebuffer to output
2091 * @WL_OUTPUT_TRANSFORM_NORMAL: (none)
2092 * @WL_OUTPUT_TRANSFORM_90: (none)
2093 * @WL_OUTPUT_TRANSFORM_180: (none)
2094 * @WL_OUTPUT_TRANSFORM_270: (none)
2095 * @WL_OUTPUT_TRANSFORM_FLIPPED: (none)
2096 * @WL_OUTPUT_TRANSFORM_FLIPPED_90: (none)
2097 * @WL_OUTPUT_TRANSFORM_FLIPPED_180: (none)
2098 * @WL_OUTPUT_TRANSFORM_FLIPPED_270: (none)
2099 *
2100 * This describes the transform that a compositor will apply to a surface
2101 * to compensate for the rotation or mirroring of an output device.
2102 *
2103 * The flipped values correspond to an initial flip around a vertical axis
2104 * followed by rotation.
2105 *
2106 * The purpose is mainly to allow clients render accordingly and tell the
2107 * compositor, so that for fullscreen surfaces, the compositor will still
2108 * be able to scan out directly from client surfaces.
2109 */
2110enum wl_output_transform {
2111 WL_OUTPUT_TRANSFORM_NORMAL = 0,
2112 WL_OUTPUT_TRANSFORM_90 = 1,
2113 WL_OUTPUT_TRANSFORM_180 = 2,
2114 WL_OUTPUT_TRANSFORM_270 = 3,
2115 WL_OUTPUT_TRANSFORM_FLIPPED = 4,
2116 WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
2117 WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
2118 WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
2119};
2120#endif /* WL_OUTPUT_TRANSFORM_ENUM */
2121
2122#ifndef WL_OUTPUT_MODE_ENUM
2123#define WL_OUTPUT_MODE_ENUM
2124/**
2125 * wl_output_mode - mode information
2126 * @WL_OUTPUT_MODE_CURRENT: indicates this is the current mode
2127 * @WL_OUTPUT_MODE_PREFERRED: indicates this is the preferred mode
2128 *
2129 * These flags describe properties of an output mode. They are used in
2130 * the flags bitfield of the mode event.
2131 */
2132enum wl_output_mode {
2133 WL_OUTPUT_MODE_CURRENT = 0x1,
2134 WL_OUTPUT_MODE_PREFERRED = 0x2,
2135};
2136#endif /* WL_OUTPUT_MODE_ENUM */
2137
2138/**
2139 * wl_output - compositor output region
2140 * @geometry: properties of the output
2141 * @mode: advertise available modes for the output
2142 * @done: sent all information about output
2143 * @scale: output scaling properties
2144 *
2145 * An output describes part of the compositor geometry. The compositor
2146 * works in the 'compositor coordinate system' and an output corresponds to
2147 * rectangular area in that space that is actually visible. This typically
2148 * corresponds to a monitor that displays part of the compositor space.
2149 * This object is published as global during start up, or when a monitor is
2150 * hotplugged.
2151 */
2152struct wl_output_listener {
2153 /**
2154 * geometry - properties of the output
2155 * @x: x position within the global compositor space
2156 * @y: y position within the global compositor space
2157 * @physical_width: width in millimeters of the output
2158 * @physical_height: height in millimeters of the output
2159 * @subpixel: subpixel orientation of the output
2160 * @make: textual description of the manufacturer
2161 * @model: textual description of the model
2162 * @transform: transform that maps framebuffer to output
2163 *
2164 * The geometry event describes geometric properties of the
2165 * output. The event is sent when binding to the output object and
2166 * whenever any of the properties change.
2167 */
2168 void (*geometry)(void *data,
2169 struct wl_output *wl_output,
2170 int32_t x,
2171 int32_t y,
2172 int32_t physical_width,
2173 int32_t physical_height,
2174 int32_t subpixel,
2175 const char *make,
2176 const char *model,
2177 int32_t transform);
2178 /**
2179 * mode - advertise available modes for the output
2180 * @flags: bitfield of mode flags
2181 * @width: width of the mode in hardware units
2182 * @height: height of the mode in hardware units
2183 * @refresh: vertical refresh rate in mHz
2184 *
2185 * The mode event describes an available mode for the output.
2186 *
2187 * The event is sent when binding to the output object and there
2188 * will always be one mode, the current mode. The event is sent
2189 * again if an output changes mode, for the mode that is now
2190 * current. In other words, the current mode is always the last
2191 * mode that was received with the current flag set.
2192 *
2193 * The size of a mode is given in physical hardware units of the
2194 * output device. This is not necessarily the same as the output
2195 * size in the global compositor space. For instance, the output
2196 * may be scaled, as described in wl_output.scale, or transformed ,
2197 * as described in wl_output.transform.
2198 */
2199 void (*mode)(void *data,
2200 struct wl_output *wl_output,
2201 uint32_t flags,
2202 int32_t width,
2203 int32_t height,
2204 int32_t refresh);
2205 /**
2206 * done - sent all information about output
2207 *
2208 * This event is sent after all other properties has been sent
2209 * after binding to the output object and after any other property
2210 * changes done after that. This allows changes to the output
2211 * properties to be seen as atomic, even if they happen via
2212 * multiple events.
2213 * @since: 2
2214 */
2215 void (*done)(void *data,
2216 struct wl_output *wl_output);
2217 /**
2218 * scale - output scaling properties
2219 * @factor: scaling factor of output
2220 *
2221 * This event contains scaling geometry information that is not
2222 * in the geometry event. It may be sent after binding the output
2223 * object or if the output scale changes later. If it is not sent,
2224 * the client should assume a scale of 1.
2225 *
2226 * A scale larger than 1 means that the compositor will
2227 * automatically scale surface buffers by this amount when
2228 * rendering. This is used for very high resolution displays where
2229 * applications rendering at the native resolution would be too
2230 * small to be legible.
2231 *
2232 * It is intended that scaling aware clients track the current
2233 * output of a surface, and if it is on a scaled output it should
2234 * use wl_surface.set_buffer_scale with the scale of the output.
2235 * That way the compositor can avoid scaling the surface, and the
2236 * client can supply a higher detail image.
2237 * @since: 2
2238 */
2239 void (*scale)(void *data,
2240 struct wl_output *wl_output,
2241 int32_t factor);
2242};
2243
2244static inline int
2245wl_output_add_listener(struct wl_output *wl_output,
2246 const struct wl_output_listener *listener, void *data)
2247{
2248 return wl_proxy_add_listener((struct wl_proxy *) wl_output,
2249 (void (**)(void)) listener, data);
2250}
2251
2252static inline void
2253wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
2254{
2255 wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data);
2256}
2257
2258static inline void *
2259wl_output_get_user_data(struct wl_output *wl_output)
2260{
2261 return wl_proxy_get_user_data((struct wl_proxy *) wl_output);
2262}
2263
2264static inline void
2265wl_output_destroy(struct wl_output *wl_output)
2266{
2267 wl_proxy_destroy((struct wl_proxy *) wl_output);
2268}
2269
2270#define WL_REGION_DESTROY 0
2271#define WL_REGION_ADD 1
2272#define WL_REGION_SUBTRACT 2
2273
2274static inline void
2275wl_region_set_user_data(struct wl_region *wl_region, void *user_data)
2276{
2277 wl_proxy_set_user_data((struct wl_proxy *) wl_region, user_data);
2278}
2279
2280static inline void *
2281wl_region_get_user_data(struct wl_region *wl_region)
2282{
2283 return wl_proxy_get_user_data((struct wl_proxy *) wl_region);
2284}
2285
2286static inline void
2287wl_region_destroy(struct wl_region *wl_region)
2288{
2289 wl_proxy_marshal((struct wl_proxy *) wl_region,
2290 WL_REGION_DESTROY);
2291
2292 wl_proxy_destroy((struct wl_proxy *) wl_region);
2293}
2294
2295static inline void
2296wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
2297{
2298 wl_proxy_marshal((struct wl_proxy *) wl_region,
2299 WL_REGION_ADD, x, y, width, height);
2300}
2301
2302static inline void
2303wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
2304{
2305 wl_proxy_marshal((struct wl_proxy *) wl_region,
2306 WL_REGION_SUBTRACT, x, y, width, height);
2307}
2308
2309#ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
2310#define WL_SUBCOMPOSITOR_ERROR_ENUM
2311enum wl_subcompositor_error {
2312 WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
2313};
2314#endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
2315
2316#define WL_SUBCOMPOSITOR_DESTROY 0
2317#define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
2318
2319static inline void
2320wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
2321{
2322 wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data);
2323}
2324
2325static inline void *
2326wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
2327{
2328 return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor);
2329}
2330
2331static inline void
2332wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
2333{
2334 wl_proxy_marshal((struct wl_proxy *) wl_subcompositor,
2335 WL_SUBCOMPOSITOR_DESTROY);
2336
2337 wl_proxy_destroy((struct wl_proxy *) wl_subcompositor);
2338}
2339
2340static inline struct wl_subsurface *
2341wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
2342{
2343 struct wl_proxy *id;
2344
2345 id = wl_proxy_marshal_constructor((struct wl_proxy *) wl_subcompositor,
2346 WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interface, NULL, surface, parent);
2347
2348 return (struct wl_subsurface *) id;
2349}
2350
2351#ifndef WL_SUBSURFACE_ERROR_ENUM
2352#define WL_SUBSURFACE_ERROR_ENUM
2353enum wl_subsurface_error {
2354 WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
2355};
2356#endif /* WL_SUBSURFACE_ERROR_ENUM */
2357
2358#define WL_SUBSURFACE_DESTROY 0
2359#define WL_SUBSURFACE_SET_POSITION 1
2360#define WL_SUBSURFACE_PLACE_ABOVE 2
2361#define WL_SUBSURFACE_PLACE_BELOW 3
2362#define WL_SUBSURFACE_SET_SYNC 4
2363#define WL_SUBSURFACE_SET_DESYNC 5
2364
2365static inline void
2366wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
2367{
2368 wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data);
2369}
2370
2371static inline void *
2372wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
2373{
2374 return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface);
2375}
2376
2377static inline void
2378wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
2379{
2380 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2381 WL_SUBSURFACE_DESTROY);
2382
2383 wl_proxy_destroy((struct wl_proxy *) wl_subsurface);
2384}
2385
2386static inline void
2387wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
2388{
2389 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2390 WL_SUBSURFACE_SET_POSITION, x, y);
2391}
2392
2393static inline void
2394wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
2395{
2396 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2397 WL_SUBSURFACE_PLACE_ABOVE, sibling);
2398}
2399
2400static inline void
2401wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
2402{
2403 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2404 WL_SUBSURFACE_PLACE_BELOW, sibling);
2405}
2406
2407static inline void
2408wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
2409{
2410 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2411 WL_SUBSURFACE_SET_SYNC);
2412}
2413
2414static inline void
2415wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
2416{
2417 wl_proxy_marshal((struct wl_proxy *) wl_subsurface,
2418 WL_SUBSURFACE_SET_DESYNC);
2419}
2420
2421#ifdef __cplusplus
2422}
2423#endif
2424
2425#endif
2426

Warning: That file was not part of the compilation database. It may have many parsing errors.