]> Pileus Git - wmpus/blob - wayland.h
Add home grown wayland protocol
[wmpus] / wayland.h
1 #ifndef WAYLAND_H
2 #define WAYLAND_H
3
4 #include <stdint.h>
5
6 /***********************************************************
7  * Common Types
8  ***********************************************************/
9
10 #define WL_MESSAGE_LEN 4096
11
12 typedef struct {
13         uint32_t id;
14         uint32_t len : 16;
15         uint32_t op  : 16;
16 } wl_header_t;
17
18 typedef struct {
19         uint32_t len;
20         char    *str;
21 } wl_string_t;
22
23 typedef struct {
24         uint32_t len;
25         void    *data;
26 } wl_array_t;
27
28 typedef struct {
29         uint32_t num  : 24;
30         uint32_t frac : 8;
31 } wl_fixed_t;
32
33 /***********************************************************
34  * Interfaces
35  ***********************************************************/
36
37 /* Interface Versions */
38 #define WL_DISPLAY_VERSION               1
39 #define WL_REGISTRY_VERSION              1
40 #define WL_CALLBACK_VERSION              1
41 #define WL_COMPOSITOR_VERSION            3
42 #define WL_SHM_POOL_VERSION              1
43 #define WL_SHM_VERSION                   1
44 #define WL_BUFFER_VERSION                1
45 #define WL_DATA_OFFER_VERSION            1
46 #define WL_DATA_SOURCE_VERSION           1
47 #define WL_DATA_DEVICE_VERSION           1
48 #define WL_DATA_DEVICE_MANAGER_VERSION   1
49 #define WL_SHELL_VERSION                 1
50 #define WL_SHELL_SURFACE_VERSION         1
51 #define WL_SURFACE_VERSION               3
52 #define WL_SEAT_VERSION                  4
53 #define WL_POINTER_VERSION               3
54 #define WL_KEYBOARD_VERSION              4
55 #define WL_TOUCH_VERSION                 3
56 #define WL_OUTPUT_VERSION                2
57 #define WL_REGION_VERSION                1
58 #define WL_SUBCOMPOSITOR_VERSION         1
59 #define WL_SUBSURFACE_VERSION            1
60
61 /* Interface IDs */
62 typedef enum {
63         WL_DISPLAY                     = 0,
64         WL_REGISTRY                    = 1,
65         WL_CALLBACK                    = 2,
66         WL_COMPOSITOR                  = 3,
67         WL_SHM_POOL                    = 4,
68         WL_SHM                         = 5,
69         WL_BUFFER                      = 6,
70         WL_DATA_OFFER                  = 7,
71         WL_DATA_SOURCE                 = 8,
72         WL_DATA_DEVICE                 = 9,
73         WL_DATA_DEVICE_MANAGER         = 10,
74         WL_SHELL                       = 11,
75         WL_SHELL_SURFACE               = 12,
76         WL_SURFACE                     = 13,
77         WL_SEAT                        = 14,
78         WL_POINTER                     = 15,
79         WL_KEYBOARD                    = 16,
80         WL_TOUCH                       = 17,
81         WL_OUTPUT                      = 18,
82         WL_REGION                      = 19,
83         WL_SUBCOMPOSITOR               = 20,
84         WL_SUBSURFACE                  = 21,
85         WL_NUM_INTERFACES              = 22,
86 } wl_interface_t;
87
88 /***********************************************************
89  * Interface WL_DISPLAY
90  ***********************************************************/
91
92 /* Request IDs */
93 typedef enum {
94         WL_DISPLAY_SYNC                = 0,
95         WL_DISPLAY_GET_REGISTRY        = 1,
96         WL_NUM_DISPLAY_REQUESTS        = 2,
97 } wl_display_request_t;
98
99 /* Event IDs */
100 typedef enum {
101         WL_DISPLAY_ERROR               = 0,
102         WL_DISPLAY_DELETE_ID           = 1,
103         WL_NUM_DISPLAY_EVENTS          = 2,
104 } wl_display_event_t;
105
106 /* Requests Messages */
107 typedef struct {
108         uint32_t    callback;
109 } wl_display_sync_t;
110
111 typedef struct {
112         uint32_t    registry;
113 } wl_display_get_registry_t;
114
115 /* Events Messages */
116 typedef struct {
117         uint32_t    object_id;
118         uint32_t    code;
119         wl_string_t message;
120 } wl_display_error_t;
121
122 typedef struct {
123         uint32_t    id;
124 } wl_display_delete_id_t;
125
126 /***********************************************************
127  * Interface WL_REGISTRY
128  ***********************************************************/
129
130 /* Request IDs */
131 typedef enum {
132         WL_REGISTRY_BIND               = 0,
133         WL_NUM_REGISTRY_REQUESTS       = 1,
134 } wl_registry_request_t;
135
136 /* Event IDs */
137 typedef enum {
138         WL_REGISTRY_GLOBAL             = 0,
139         WL_REGISTRY_GLOBAL_REMOVE      = 1,
140         WL_NUM_REGISTRY_EVENTS         = 2,
141 } wl_registry_event_t;
142
143 /* Requests Messages */
144 typedef struct {
145         uint32_t    name;
146         uint32_t    id;
147 } wl_registry_bind_t;
148
149 /* Events Messages */
150 typedef struct {
151         uint32_t    name;
152         wl_string_t interface;
153         uint32_t    version;
154 } wl_registry_global_t;
155
156 typedef struct {
157         uint32_t    name;
158 } wl_registry_global_remove_t;
159
160 /***********************************************************
161  * Interface WL_CALLBACK
162  ***********************************************************/
163
164 /* Event IDs */
165 typedef enum {
166         WL_CALLBACK_DONE               = 0,
167         WL_NUM_CALLBACK_EVENTS         = 1,
168 } wl_callback_event_t;
169
170 /* Events Messages */
171 typedef struct {
172         uint32_t    callback_data;
173 } wl_callback_done_t;
174
175 /***********************************************************
176  * Interface WL_COMPOSITOR
177  ***********************************************************/
178
179 /* Request IDs */
180 typedef enum {
181         WL_COMPOSITOR_CREATE_SURFACE   = 0,
182         WL_COMPOSITOR_CREATE_REGION    = 1,
183         WL_NUM_COMPOSITOR_REQUESTS     = 2,
184 } wl_compositor_request_t;
185
186 /* Requests Messages */
187 typedef struct {
188         uint32_t    id;
189 } wl_compositor_create_surface_t;
190
191 typedef struct {
192         uint32_t    id;
193 } wl_compositor_create_region_t;
194
195 /***********************************************************
196  * Interface WL_SHM_POOL
197  ***********************************************************/
198
199 /* Request IDs */
200 typedef enum {
201         WL_SHM_POOL_CREATE_BUFFER      = 0,
202         WL_SHM_POOL_DESTROY            = 1,
203         WL_SHM_POOL_RESIZE             = 2,
204         WL_NUM_SHM_POOL_REQUESTS       = 3,
205 } wl_shm_pool_request_t;
206
207 /* Requests Messages */
208 typedef struct {
209         uint32_t    id;
210         int32_t     offset;
211         int32_t     width;
212         int32_t     height;
213         int32_t     stride;
214         uint32_t    format;
215 } wl_shm_pool_create_buffer_t;
216
217 typedef struct {
218         int32_t     size;
219 } wl_shm_pool_resize_t;
220
221 /***********************************************************
222  * Interface WL_SHM
223  ***********************************************************/
224
225 /* Request IDs */
226 typedef enum {
227         WL_SHM_CREATE_POOL             = 0,
228         WL_NUM_SHM_REQUESTS            = 1,
229 } wl_shm_request_t;
230
231 /* Event IDs */
232 typedef enum {
233         WL_SHM_FORMAT                  = 0,
234         WL_NUM_SHM_EVENTS              = 1,
235 } wl_shm_event_t;
236
237 /* Requests Messages */
238 typedef struct {
239         uint32_t    id;
240         int32_t     size;
241 } wl_shm_create_pool_t;
242
243 /* Events Messages */
244 typedef struct {
245         uint32_t    format;
246 } wl_shm_format_t;
247
248 /***********************************************************
249  * Interface WL_BUFFER
250  ***********************************************************/
251
252 /* Request IDs */
253 typedef enum {
254         WL_BUFFER_DESTROY              = 0,
255         WL_NUM_BUFFER_REQUESTS         = 1,
256 } wl_buffer_request_t;
257
258 /* Event IDs */
259 typedef enum {
260         WL_BUFFER_RELEASE              = 0,
261         WL_NUM_BUFFER_EVENTS           = 1,
262 } wl_buffer_event_t;
263
264 /***********************************************************
265  * Interface WL_DATA_OFFER
266  ***********************************************************/
267
268 /* Request IDs */
269 typedef enum {
270         WL_DATA_OFFER_ACCEPT           = 0,
271         WL_DATA_OFFER_RECEIVE          = 1,
272         WL_DATA_OFFER_DESTROY          = 2,
273         WL_NUM_DATA_OFFER_REQUESTS     = 3,
274 } wl_data_offer_request_t;
275
276 /* Event IDs */
277 typedef enum {
278         WL_DATA_OFFER_OFFER            = 0,
279         WL_NUM_DATA_OFFER_EVENTS       = 1,
280 } wl_data_offer_event_t;
281
282 /* Requests Messages */
283 typedef struct {
284         uint32_t    serial;
285         wl_string_t mime_type;
286 } wl_data_offer_accept_t;
287
288 typedef struct {
289         wl_string_t mime_type;
290 } wl_data_offer_receive_t;
291
292 /* Events Messages */
293 typedef struct {
294         wl_string_t mime_type;
295 } wl_data_offer_offer_t;
296
297 /***********************************************************
298  * Interface WL_DATA_SOURCE
299  ***********************************************************/
300
301 /* Request IDs */
302 typedef enum {
303         WL_DATA_SOURCE_OFFER           = 0,
304         WL_DATA_SOURCE_DESTROY         = 1,
305         WL_NUM_DATA_SOURCE_REQUESTS    = 2,
306 } wl_data_source_request_t;
307
308 /* Event IDs */
309 typedef enum {
310         WL_DATA_SOURCE_TARGET          = 0,
311         WL_DATA_SOURCE_SEND            = 1,
312         WL_DATA_SOURCE_CANCELLED       = 2,
313         WL_NUM_DATA_SOURCE_EVENTS      = 3,
314 } wl_data_source_event_t;
315
316 /* Requests Messages */
317 typedef struct {
318         wl_string_t mime_type;
319 } wl_data_source_offer_t;
320
321 /* Events Messages */
322 typedef struct {
323         wl_string_t mime_type;
324 } wl_data_source_target_t;
325
326 typedef struct {
327         wl_string_t mime_type;
328 } wl_data_source_send_t;
329
330 /***********************************************************
331  * Interface WL_DATA_DEVICE
332  ***********************************************************/
333
334 /* Request IDs */
335 typedef enum {
336         WL_DATA_DEVICE_START_DRAG      = 0,
337         WL_DATA_DEVICE_SET_SELECTION   = 1,
338         WL_NUM_DATA_DEVICE_REQUESTS    = 2,
339 } wl_data_device_request_t;
340
341 /* Event IDs */
342 typedef enum {
343         WL_DATA_DEVICE_DATA_OFFER      = 0,
344         WL_DATA_DEVICE_ENTER           = 1,
345         WL_DATA_DEVICE_LEAVE           = 2,
346         WL_DATA_DEVICE_MOTION          = 3,
347         WL_DATA_DEVICE_DROP            = 4,
348         WL_DATA_DEVICE_SELECTION       = 5,
349         WL_NUM_DATA_DEVICE_EVENTS      = 6,
350 } wl_data_device_event_t;
351
352 /* Requests Messages */
353 typedef struct {
354         uint32_t    source;
355         uint32_t    origin;
356         uint32_t    icon;
357         uint32_t    serial;
358 } wl_data_device_start_drag_t;
359
360 typedef struct {
361         uint32_t    source;
362         uint32_t    serial;
363 } wl_data_device_set_selection_t;
364
365 /* Events Messages */
366 typedef struct {
367         uint32_t    id;
368 } wl_data_device_data_offer_t;
369
370 typedef struct {
371         uint32_t    serial;
372         uint32_t    surface;
373         wl_fixed_t  x;
374         wl_fixed_t  y;
375         uint32_t    id;
376 } wl_data_device_enter_t;
377
378 typedef struct {
379         uint32_t    time;
380         wl_fixed_t  x;
381         wl_fixed_t  y;
382 } wl_data_device_motion_t;
383
384 typedef struct {
385         uint32_t    id;
386 } wl_data_device_selection_t;
387
388 /***********************************************************
389  * Interface WL_DATA_DEVICE_MANAGER
390  ***********************************************************/
391
392 /* Request IDs */
393 typedef enum {
394         WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE = 0,
395         WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE = 1,
396         WL_NUM_DATA_DEVICE_MANAGER_REQUESTS = 2,
397 } wl_data_device_manager_request_t;
398
399 /* Requests Messages */
400 typedef struct {
401         uint32_t    id;
402 } wl_data_device_manager_create_data_source_t;
403
404 typedef struct {
405         uint32_t    id;
406         uint32_t    seat;
407 } wl_data_device_manager_get_data_device_t;
408
409 /***********************************************************
410  * Interface WL_SHELL
411  ***********************************************************/
412
413 /* Request IDs */
414 typedef enum {
415         WL_SHELL_GET_SHELL_SURFACE     = 0,
416         WL_NUM_SHELL_REQUESTS          = 1,
417 } wl_shell_request_t;
418
419 /* Requests Messages */
420 typedef struct {
421         uint32_t    id;
422         uint32_t    surface;
423 } wl_shell_get_shell_surface_t;
424
425 /***********************************************************
426  * Interface WL_SHELL_SURFACE
427  ***********************************************************/
428
429 /* Request IDs */
430 typedef enum {
431         WL_SHELL_SURFACE_PONG          = 0,
432         WL_SHELL_SURFACE_MOVE          = 1,
433         WL_SHELL_SURFACE_RESIZE        = 2,
434         WL_SHELL_SURFACE_SET_TOPLEVEL  = 3,
435         WL_SHELL_SURFACE_SET_TRANSIENT = 4,
436         WL_SHELL_SURFACE_SET_FULLSCREEN = 5,
437         WL_SHELL_SURFACE_SET_POPUP     = 6,
438         WL_SHELL_SURFACE_SET_MAXIMIZED = 7,
439         WL_SHELL_SURFACE_SET_TITLE     = 8,
440         WL_SHELL_SURFACE_SET_CLASS     = 9,
441         WL_NUM_SHELL_SURFACE_REQUESTS  = 10,
442 } wl_shell_surface_request_t;
443
444 /* Event IDs */
445 typedef enum {
446         WL_SHELL_SURFACE_PING          = 0,
447         WL_SHELL_SURFACE_CONFIGURE     = 1,
448         WL_SHELL_SURFACE_POPUP_DONE    = 2,
449         WL_NUM_SHELL_SURFACE_EVENTS    = 3,
450 } wl_shell_surface_event_t;
451
452 /* Requests Messages */
453 typedef struct {
454         uint32_t    serial;
455 } wl_shell_surface_pong_t;
456
457 typedef struct {
458         uint32_t    seat;
459         uint32_t    serial;
460 } wl_shell_surface_move_t;
461
462 typedef struct {
463         uint32_t    seat;
464         uint32_t    serial;
465         uint32_t    edges;
466 } wl_shell_surface_resize_t;
467
468 typedef struct {
469         uint32_t    parent;
470         int32_t     x;
471         int32_t     y;
472         uint32_t    flags;
473 } wl_shell_surface_set_transient_t;
474
475 typedef struct {
476         uint32_t    method;
477         uint32_t    framerate;
478         uint32_t    output;
479 } wl_shell_surface_set_fullscreen_t;
480
481 typedef struct {
482         uint32_t    seat;
483         uint32_t    serial;
484         uint32_t    parent;
485         int32_t     x;
486         int32_t     y;
487         uint32_t    flags;
488 } wl_shell_surface_set_popup_t;
489
490 typedef struct {
491         uint32_t    output;
492 } wl_shell_surface_set_maximized_t;
493
494 typedef struct {
495         wl_string_t title;
496 } wl_shell_surface_set_title_t;
497
498 typedef struct {
499         wl_string_t class_;
500 } wl_shell_surface_set_class_t;
501
502 /* Events Messages */
503 typedef struct {
504         uint32_t    serial;
505 } wl_shell_surface_ping_t;
506
507 typedef struct {
508         uint32_t    edges;
509         int32_t     width;
510         int32_t     height;
511 } wl_shell_surface_configure_t;
512
513 /***********************************************************
514  * Interface WL_SURFACE
515  ***********************************************************/
516
517 /* Request IDs */
518 typedef enum {
519         WL_SURFACE_DESTROY             = 0,
520         WL_SURFACE_ATTACH              = 1,
521         WL_SURFACE_DAMAGE              = 2,
522         WL_SURFACE_FRAME               = 3,
523         WL_SURFACE_SET_OPAQUE_REGION   = 4,
524         WL_SURFACE_SET_INPUT_REGION    = 5,
525         WL_SURFACE_COMMIT              = 6,
526         WL_SURFACE_SET_BUFFER_TRANSFORM = 7,
527         WL_SURFACE_SET_BUFFER_SCALE    = 8,
528         WL_NUM_SURFACE_REQUESTS        = 9,
529 } wl_surface_request_t;
530
531 /* Event IDs */
532 typedef enum {
533         WL_SURFACE_ENTER               = 0,
534         WL_SURFACE_LEAVE               = 1,
535         WL_NUM_SURFACE_EVENTS          = 2,
536 } wl_surface_event_t;
537
538 /* Requests Messages */
539 typedef struct {
540         uint32_t    buffer;
541         int32_t     x;
542         int32_t     y;
543 } wl_surface_attach_t;
544
545 typedef struct {
546         int32_t     x;
547         int32_t     y;
548         int32_t     width;
549         int32_t     height;
550 } wl_surface_damage_t;
551
552 typedef struct {
553         uint32_t    callback;
554 } wl_surface_frame_t;
555
556 typedef struct {
557         uint32_t    region;
558 } wl_surface_set_opaque_region_t;
559
560 typedef struct {
561         uint32_t    region;
562 } wl_surface_set_input_region_t;
563
564 typedef struct {
565         int32_t     transform;
566 } wl_surface_set_buffer_transform_t;
567
568 typedef struct {
569         int32_t     scale;
570 } wl_surface_set_buffer_scale_t;
571
572 /* Events Messages */
573 typedef struct {
574         uint32_t    output;
575 } wl_surface_enter_t;
576
577 typedef struct {
578         uint32_t    output;
579 } wl_surface_leave_t;
580
581 /***********************************************************
582  * Interface WL_SEAT
583  ***********************************************************/
584
585 /* Request IDs */
586 typedef enum {
587         WL_SEAT_GET_POINTER            = 0,
588         WL_SEAT_GET_KEYBOARD           = 1,
589         WL_SEAT_GET_TOUCH              = 2,
590         WL_NUM_SEAT_REQUESTS           = 3,
591 } wl_seat_request_t;
592
593 /* Event IDs */
594 typedef enum {
595         WL_SEAT_CAPABILITIES           = 0,
596         WL_SEAT_NAME                   = 1,
597         WL_NUM_SEAT_EVENTS             = 2,
598 } wl_seat_event_t;
599
600 /* Requests Messages */
601 typedef struct {
602         uint32_t    id;
603 } wl_seat_get_pointer_t;
604
605 typedef struct {
606         uint32_t    id;
607 } wl_seat_get_keyboard_t;
608
609 typedef struct {
610         uint32_t    id;
611 } wl_seat_get_touch_t;
612
613 /* Events Messages */
614 typedef struct {
615         uint32_t    capabilities;
616 } wl_seat_capabilities_t;
617
618 typedef struct {
619         wl_string_t name;
620 } wl_seat_name_t;
621
622 /***********************************************************
623  * Interface WL_POINTER
624  ***********************************************************/
625
626 /* Request IDs */
627 typedef enum {
628         WL_POINTER_SET_CURSOR          = 0,
629         WL_POINTER_RELEASE             = 1,
630         WL_NUM_POINTER_REQUESTS        = 2,
631 } wl_pointer_request_t;
632
633 /* Event IDs */
634 typedef enum {
635         WL_POINTER_ENTER               = 0,
636         WL_POINTER_LEAVE               = 1,
637         WL_POINTER_MOTION              = 2,
638         WL_POINTER_BUTTON              = 3,
639         WL_POINTER_AXIS                = 4,
640         WL_NUM_POINTER_EVENTS          = 5,
641 } wl_pointer_event_t;
642
643 /* Requests Messages */
644 typedef struct {
645         uint32_t    serial;
646         uint32_t    surface;
647         int32_t     hotspot_x;
648         int32_t     hotspot_y;
649 } wl_pointer_set_cursor_t;
650
651 /* Events Messages */
652 typedef struct {
653         uint32_t    serial;
654         uint32_t    surface;
655         wl_fixed_t  surface_x;
656         wl_fixed_t  surface_y;
657 } wl_pointer_enter_t;
658
659 typedef struct {
660         uint32_t    serial;
661         uint32_t    surface;
662 } wl_pointer_leave_t;
663
664 typedef struct {
665         uint32_t    time;
666         wl_fixed_t  surface_x;
667         wl_fixed_t  surface_y;
668 } wl_pointer_motion_t;
669
670 typedef struct {
671         uint32_t    serial;
672         uint32_t    time;
673         uint32_t    button;
674         uint32_t    state;
675 } wl_pointer_button_t;
676
677 typedef struct {
678         uint32_t    time;
679         uint32_t    axis;
680         wl_fixed_t  value;
681 } wl_pointer_axis_t;
682
683 /***********************************************************
684  * Interface WL_KEYBOARD
685  ***********************************************************/
686
687 /* Request IDs */
688 typedef enum {
689         WL_KEYBOARD_RELEASE            = 0,
690         WL_NUM_KEYBOARD_REQUESTS       = 1,
691 } wl_keyboard_request_t;
692
693 /* Event IDs */
694 typedef enum {
695         WL_KEYBOARD_KEYMAP             = 0,
696         WL_KEYBOARD_ENTER              = 1,
697         WL_KEYBOARD_LEAVE              = 2,
698         WL_KEYBOARD_KEY                = 3,
699         WL_KEYBOARD_MODIFIERS          = 4,
700         WL_KEYBOARD_REPEAT_INFO        = 5,
701         WL_NUM_KEYBOARD_EVENTS         = 6,
702 } wl_keyboard_event_t;
703
704 /* Events Messages */
705 typedef struct {
706         uint32_t    format;
707         uint32_t    size;
708 } wl_keyboard_keymap_t;
709
710 typedef struct {
711         uint32_t    serial;
712         uint32_t    surface;
713         wl_array_t  keys;
714 } wl_keyboard_enter_t;
715
716 typedef struct {
717         uint32_t    serial;
718         uint32_t    surface;
719 } wl_keyboard_leave_t;
720
721 typedef struct {
722         uint32_t    serial;
723         uint32_t    time;
724         uint32_t    key;
725         uint32_t    state;
726 } wl_keyboard_key_t;
727
728 typedef struct {
729         uint32_t    serial;
730         uint32_t    mods_depressed;
731         uint32_t    mods_latched;
732         uint32_t    mods_locked;
733         uint32_t    group;
734 } wl_keyboard_modifiers_t;
735
736 typedef struct {
737         int32_t     rate;
738         int32_t     delay;
739 } wl_keyboard_repeat_info_t;
740
741 /***********************************************************
742  * Interface WL_TOUCH
743  ***********************************************************/
744
745 /* Request IDs */
746 typedef enum {
747         WL_TOUCH_RELEASE               = 0,
748         WL_NUM_TOUCH_REQUESTS          = 1,
749 } wl_touch_request_t;
750
751 /* Event IDs */
752 typedef enum {
753         WL_TOUCH_DOWN                  = 0,
754         WL_TOUCH_UP                    = 1,
755         WL_TOUCH_MOTION                = 2,
756         WL_TOUCH_FRAME                 = 3,
757         WL_TOUCH_CANCEL                = 4,
758         WL_NUM_TOUCH_EVENTS            = 5,
759 } wl_touch_event_t;
760
761 /* Events Messages */
762 typedef struct {
763         uint32_t    serial;
764         uint32_t    time;
765         uint32_t    surface;
766         int32_t     id;
767         wl_fixed_t  x;
768         wl_fixed_t  y;
769 } wl_touch_down_t;
770
771 typedef struct {
772         uint32_t    serial;
773         uint32_t    time;
774         int32_t     id;
775 } wl_touch_up_t;
776
777 typedef struct {
778         uint32_t    time;
779         int32_t     id;
780         wl_fixed_t  x;
781         wl_fixed_t  y;
782 } wl_touch_motion_t;
783
784 /***********************************************************
785  * Interface WL_OUTPUT
786  ***********************************************************/
787
788 /* Event IDs */
789 typedef enum {
790         WL_OUTPUT_GEOMETRY             = 0,
791         WL_OUTPUT_MODE                 = 1,
792         WL_OUTPUT_DONE                 = 2,
793         WL_OUTPUT_SCALE                = 3,
794         WL_NUM_OUTPUT_EVENTS           = 4,
795 } wl_output_event_t;
796
797 /* Events Messages */
798 typedef struct {
799         int32_t     x;
800         int32_t     y;
801         int32_t     physical_width;
802         int32_t     physical_height;
803         int32_t     subpixel;
804         wl_string_t make;
805         wl_string_t model;
806         int32_t     transform;
807 } wl_output_geometry_t;
808
809 typedef struct {
810         uint32_t    flags;
811         int32_t     width;
812         int32_t     height;
813         int32_t     refresh;
814 } wl_output_mode_t;
815
816 typedef struct {
817         int32_t     factor;
818 } wl_output_scale_t;
819
820 /***********************************************************
821  * Interface WL_REGION
822  ***********************************************************/
823
824 /* Request IDs */
825 typedef enum {
826         WL_REGION_DESTROY              = 0,
827         WL_REGION_ADD                  = 1,
828         WL_REGION_SUBTRACT             = 2,
829         WL_NUM_REGION_REQUESTS         = 3,
830 } wl_region_request_t;
831
832 /* Requests Messages */
833 typedef struct {
834         int32_t     x;
835         int32_t     y;
836         int32_t     width;
837         int32_t     height;
838 } wl_region_add_t;
839
840 typedef struct {
841         int32_t     x;
842         int32_t     y;
843         int32_t     width;
844         int32_t     height;
845 } wl_region_subtract_t;
846
847 /***********************************************************
848  * Interface WL_SUBCOMPOSITOR
849  ***********************************************************/
850
851 /* Request IDs */
852 typedef enum {
853         WL_SUBCOMPOSITOR_DESTROY       = 0,
854         WL_SUBCOMPOSITOR_GET_SUBSURFACE = 1,
855         WL_NUM_SUBCOMPOSITOR_REQUESTS  = 2,
856 } wl_subcompositor_request_t;
857
858 /* Requests Messages */
859 typedef struct {
860         uint32_t    id;
861         uint32_t    surface;
862         uint32_t    parent;
863 } wl_subcompositor_get_subsurface_t;
864
865 /***********************************************************
866  * Interface WL_SUBSURFACE
867  ***********************************************************/
868
869 /* Request IDs */
870 typedef enum {
871         WL_SUBSURFACE_DESTROY          = 0,
872         WL_SUBSURFACE_SET_POSITION     = 1,
873         WL_SUBSURFACE_PLACE_ABOVE      = 2,
874         WL_SUBSURFACE_PLACE_BELOW      = 3,
875         WL_SUBSURFACE_SET_SYNC         = 4,
876         WL_SUBSURFACE_SET_DESYNC       = 5,
877         WL_NUM_SUBSURFACE_REQUESTS     = 6,
878 } wl_subsurface_request_t;
879
880 /* Requests Messages */
881 typedef struct {
882         int32_t     x;
883         int32_t     y;
884 } wl_subsurface_set_position_t;
885
886 typedef struct {
887         uint32_t    sibling;
888 } wl_subsurface_place_above_t;
889
890 typedef struct {
891         uint32_t    sibling;
892 } wl_subsurface_place_below_t;
893
894 /* Union messages */
895 typedef union {
896         wl_display_sync_t                                  wl_display_sync;
897         wl_display_get_registry_t                          wl_display_get_registry;
898         wl_registry_bind_t                                 wl_registry_bind;
899         wl_compositor_create_surface_t                     wl_compositor_create_surface;
900         wl_compositor_create_region_t                      wl_compositor_create_region;
901         wl_shm_pool_create_buffer_t                        wl_shm_pool_create_buffer;
902         wl_shm_pool_resize_t                               wl_shm_pool_resize;
903         wl_shm_create_pool_t                               wl_shm_create_pool;
904         wl_data_offer_accept_t                             wl_data_offer_accept;
905         wl_data_offer_receive_t                            wl_data_offer_receive;
906         wl_data_source_offer_t                             wl_data_source_offer;
907         wl_data_device_start_drag_t                        wl_data_device_start_drag;
908         wl_data_device_set_selection_t                     wl_data_device_set_selection;
909         wl_data_device_manager_create_data_source_t        wl_data_device_manager_create_data_source;
910         wl_data_device_manager_get_data_device_t           wl_data_device_manager_get_data_device;
911         wl_shell_get_shell_surface_t                       wl_shell_get_shell_surface;
912         wl_shell_surface_pong_t                            wl_shell_surface_pong;
913         wl_shell_surface_move_t                            wl_shell_surface_move;
914         wl_shell_surface_resize_t                          wl_shell_surface_resize;
915         wl_shell_surface_set_transient_t                   wl_shell_surface_set_transient;
916         wl_shell_surface_set_fullscreen_t                  wl_shell_surface_set_fullscreen;
917         wl_shell_surface_set_popup_t                       wl_shell_surface_set_popup;
918         wl_shell_surface_set_maximized_t                   wl_shell_surface_set_maximized;
919         wl_shell_surface_set_title_t                       wl_shell_surface_set_title;
920         wl_shell_surface_set_class_t                       wl_shell_surface_set_class;
921         wl_surface_attach_t                                wl_surface_attach;
922         wl_surface_damage_t                                wl_surface_damage;
923         wl_surface_frame_t                                 wl_surface_frame;
924         wl_surface_set_opaque_region_t                     wl_surface_set_opaque_region;
925         wl_surface_set_input_region_t                      wl_surface_set_input_region;
926         wl_surface_set_buffer_transform_t                  wl_surface_set_buffer_transform;
927         wl_surface_set_buffer_scale_t                      wl_surface_set_buffer_scale;
928         wl_seat_get_pointer_t                              wl_seat_get_pointer;
929         wl_seat_get_keyboard_t                             wl_seat_get_keyboard;
930         wl_seat_get_touch_t                                wl_seat_get_touch;
931         wl_pointer_set_cursor_t                            wl_pointer_set_cursor;
932         wl_region_add_t                                    wl_region_add;
933         wl_region_subtract_t                               wl_region_subtract;
934         wl_subcompositor_get_subsurface_t                  wl_subcompositor_get_subsurface;
935         wl_subsurface_set_position_t                       wl_subsurface_set_position;
936         wl_subsurface_place_above_t                        wl_subsurface_place_above;
937         wl_subsurface_place_below_t                        wl_subsurface_place_below;
938 } wl_request_t;
939
940 typedef union {
941         wl_display_error_t                                 wl_display_error;
942         wl_display_delete_id_t                             wl_display_delete_id;
943         wl_registry_global_t                               wl_registry_global;
944         wl_registry_global_remove_t                        wl_registry_global_remove;
945         wl_callback_done_t                                 wl_callback_done;
946         wl_shm_format_t                                    wl_shm_format;
947         wl_data_offer_offer_t                              wl_data_offer_offer;
948         wl_data_source_target_t                            wl_data_source_target;
949         wl_data_source_send_t                              wl_data_source_send;
950         wl_data_device_data_offer_t                        wl_data_device_data_offer;
951         wl_data_device_enter_t                             wl_data_device_enter;
952         wl_data_device_motion_t                            wl_data_device_motion;
953         wl_data_device_selection_t                         wl_data_device_selection;
954         wl_shell_surface_ping_t                            wl_shell_surface_ping;
955         wl_shell_surface_configure_t                       wl_shell_surface_configure;
956         wl_surface_enter_t                                 wl_surface_enter;
957         wl_surface_leave_t                                 wl_surface_leave;
958         wl_seat_capabilities_t                             wl_seat_capabilities;
959         wl_seat_name_t                                     wl_seat_name;
960         wl_pointer_enter_t                                 wl_pointer_enter;
961         wl_pointer_leave_t                                 wl_pointer_leave;
962         wl_pointer_motion_t                                wl_pointer_motion;
963         wl_pointer_button_t                                wl_pointer_button;
964         wl_pointer_axis_t                                  wl_pointer_axis;
965         wl_keyboard_keymap_t                               wl_keyboard_keymap;
966         wl_keyboard_enter_t                                wl_keyboard_enter;
967         wl_keyboard_leave_t                                wl_keyboard_leave;
968         wl_keyboard_key_t                                  wl_keyboard_key;
969         wl_keyboard_modifiers_t                            wl_keyboard_modifiers;
970         wl_keyboard_repeat_info_t                          wl_keyboard_repeat_info;
971         wl_touch_down_t                                    wl_touch_down;
972         wl_touch_up_t                                      wl_touch_up;
973         wl_touch_motion_t                                  wl_touch_motion;
974         wl_output_geometry_t                               wl_output_geometry;
975         wl_output_mode_t                                   wl_output_mode;
976         wl_output_scale_t                                  wl_output_scale;
977 } wl_event_t;
978
979 /***********************************************************
980  * Arrays and Strings
981  ***********************************************************/
982
983 /* Constants */
984 #define WL_ARRAY_NONE   '-'
985 #define WL_ARRAY_STRING 's'
986 #define WL_ARRAY_ARRAY  'a'
987 #define WL_ARRAY_FD     'f'
988
989 extern const char **wl_rarray[WL_NUM_INTERFACES];
990 extern const char **wl_earray[WL_NUM_INTERFACES];
991
992 /* Request Array */
993 #ifdef WL_DEFINE_TABLES
994 const char **wl_rarray[WL_NUM_INTERFACES] = {
995         [WL_SHM] (const char *[WL_NUM_SHM_REQUESTS]) {
996                 [WL_SHM_CREATE_POOL]           "-f-",
997         },
998         [WL_DATA_OFFER] (const char *[WL_NUM_DATA_OFFER_REQUESTS]) {
999                 [WL_DATA_OFFER_ACCEPT]         "-s",
1000                 [WL_DATA_OFFER_RECEIVE]        "sf",
1001         },
1002         [WL_DATA_SOURCE] (const char *[WL_NUM_DATA_SOURCE_REQUESTS]) {
1003                 [WL_DATA_SOURCE_OFFER]         "s",
1004         },
1005         [WL_SHELL_SURFACE] (const char *[WL_NUM_SHELL_SURFACE_REQUESTS]) {
1006                 [WL_SHELL_SURFACE_SET_TITLE]   "s",
1007                 [WL_SHELL_SURFACE_SET_CLASS]   "s",
1008         },
1009 };
1010 #endif
1011
1012 /* Event Array */
1013 #ifdef WL_DEFINE_TABLES
1014 const char **wl_earray[WL_NUM_INTERFACES] = {
1015         [WL_DISPLAY] (const char *[WL_NUM_DISPLAY_EVENTS]) {
1016                 [WL_DISPLAY_ERROR]             "--s",
1017         },
1018         [WL_REGISTRY] (const char *[WL_NUM_REGISTRY_EVENTS]) {
1019                 [WL_REGISTRY_GLOBAL]           "-s-",
1020         },
1021         [WL_DATA_OFFER] (const char *[WL_NUM_DATA_OFFER_EVENTS]) {
1022                 [WL_DATA_OFFER_OFFER]          "s",
1023         },
1024         [WL_DATA_SOURCE] (const char *[WL_NUM_DATA_SOURCE_EVENTS]) {
1025                 [WL_DATA_SOURCE_TARGET]        "s",
1026                 [WL_DATA_SOURCE_SEND]          "sf",
1027         },
1028         [WL_SEAT] (const char *[WL_NUM_SEAT_EVENTS]) {
1029                 [WL_SEAT_NAME]                 "s",
1030         },
1031         [WL_KEYBOARD] (const char *[WL_NUM_KEYBOARD_EVENTS]) {
1032                 [WL_KEYBOARD_KEYMAP]           "-f-",
1033                 [WL_KEYBOARD_ENTER]            "--a",
1034         },
1035         [WL_OUTPUT] (const char *[WL_NUM_OUTPUT_EVENTS]) {
1036                 [WL_OUTPUT_GEOMETRY]           "-----ss-",
1037         },
1038 };
1039 #endif
1040
1041 #endif