summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/wayland/wayland-client-protocol.h
blob: 0af6645bbd1cf94065bfe3649317a265fa1fc7db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
/*
 * Copyright © 2010 Kristian Høgsberg
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that copyright
 * notice and this permission notice appear in supporting documentation, and
 * that the name of the copyright holders not be used in advertising or
 * publicity pertaining to distribution of the software without specific,
 * written prior permission.  The copyright holders make no representations
 * about the suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
 *
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 * OF THIS SOFTWARE.
 */


#ifndef WAYLAND_CLIENT_PROTOCOL_H
#define WAYLAND_CLIENT_PROTOCOL_H

#ifdef  __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"

struct wl_client;

struct wl_display;
struct wl_compositor;
struct wl_drm;
struct wl_shm;
struct wl_buffer;
struct wl_shell;
struct wl_selection;
struct wl_selection_offer;
struct wl_drag;
struct wl_drag_offer;
struct wl_surface;
struct wl_input_device;
struct wl_output;
struct wl_visual;

struct wl_proxy;

extern void
wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
extern struct wl_proxy *
wl_proxy_create(struct wl_proxy *factory,
		const struct wl_interface *interface);
extern struct wl_proxy *
wl_proxy_create_for_id(struct wl_display *display,
		       const struct wl_interface *interface, uint32_t id);
extern void
wl_proxy_destroy(struct wl_proxy *proxy);

extern int
wl_proxy_add_listener(struct wl_proxy *proxy,
		      void (**implementation)(void), void *data);

extern void
wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);

extern void *
wl_proxy_get_user_data(struct wl_proxy *proxy);

extern const struct wl_interface wl_display_interface;
extern const struct wl_interface wl_compositor_interface;
extern const struct wl_interface wl_drm_interface;
extern const struct wl_interface wl_shm_interface;
extern const struct wl_interface wl_buffer_interface;
extern const struct wl_interface wl_shell_interface;
extern const struct wl_interface wl_selection_interface;
extern const struct wl_interface wl_selection_offer_interface;
extern const struct wl_interface wl_drag_interface;
extern const struct wl_interface wl_drag_offer_interface;
extern const struct wl_interface wl_surface_interface;
extern const struct wl_interface wl_input_device_interface;
extern const struct wl_interface wl_output_interface;
extern const struct wl_interface wl_visual_interface;

struct wl_display_listener {
	void (*invalid_object)(void *data,
			       struct wl_display *display,
			       uint32_t object_id);
	void (*invalid_method)(void *data,
			       struct wl_display *display,
			       uint32_t object_id,
			       uint32_t opcode);
	void (*no_memory)(void *data,
			  struct wl_display *display);
	void (*global)(void *data,
		       struct wl_display *display,
		       uint32_t id,
		       const char *name,
		       uint32_t version);
	void (*range)(void *data,
		      struct wl_display *display,
		      uint32_t base);
	void (*key)(void *data,
		    struct wl_display *display,
		    uint32_t key,
		    uint32_t time);
};

static inline int
wl_display_add_listener(struct wl_display *display,
			const struct wl_display_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) display,
				     (void (**)(void)) listener, data);
}

#define WL_DISPLAY_SYNC	0
#define WL_DISPLAY_FRAME	1

static inline void
wl_display_set_user_data(struct wl_display *display, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) display, user_data);
}

static inline void *
wl_display_get_user_data(struct wl_display *display)
{
	return wl_proxy_get_user_data((struct wl_proxy *) display);
}

static inline void
wl_display_sync(struct wl_display *display, uint32_t key)
{
	wl_proxy_marshal((struct wl_proxy *) display,
			 WL_DISPLAY_SYNC, key);
}

static inline void
wl_display_frame(struct wl_display *display, uint32_t key)
{
	wl_proxy_marshal((struct wl_proxy *) display,
			 WL_DISPLAY_FRAME, key);
}

#define WL_COMPOSITOR_CREATE_SURFACE	0

static inline struct wl_compositor *
wl_compositor_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_compositor *)
		wl_proxy_create_for_id(display, &wl_compositor_interface, id);
}

static inline void
wl_compositor_set_user_data(struct wl_compositor *compositor, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) compositor, user_data);
}

static inline void *
wl_compositor_get_user_data(struct wl_compositor *compositor)
{
	return wl_proxy_get_user_data((struct wl_proxy *) compositor);
}

static inline void
wl_compositor_destroy(struct wl_compositor *compositor)
{
	wl_proxy_destroy((struct wl_proxy *) compositor);
}

static inline struct wl_surface *
wl_compositor_create_surface(struct wl_compositor *compositor)
{
	struct wl_proxy *id;

	id = wl_proxy_create((struct wl_proxy *) compositor,
			     &wl_surface_interface);
	if (!id)
		return NULL;

	wl_proxy_marshal((struct wl_proxy *) compositor,
			 WL_COMPOSITOR_CREATE_SURFACE, id);

	return (struct wl_surface *) id;
}

struct wl_drm_listener {
	void (*device)(void *data,
		       struct wl_drm *drm,
		       const char *name);
	void (*authenticated)(void *data,
			      struct wl_drm *drm);
};

static inline int
wl_drm_add_listener(struct wl_drm *drm,
		    const struct wl_drm_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) drm,
				     (void (**)(void)) listener, data);
}

#define WL_DRM_AUTHENTICATE	0
#define WL_DRM_CREATE_BUFFER	1

static inline struct wl_drm *
wl_drm_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_drm *)
		wl_proxy_create_for_id(display, &wl_drm_interface, id);
}

static inline void
wl_drm_set_user_data(struct wl_drm *drm, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) drm, user_data);
}

static inline void *
wl_drm_get_user_data(struct wl_drm *drm)
{
	return wl_proxy_get_user_data((struct wl_proxy *) drm);
}

static inline void
wl_drm_destroy(struct wl_drm *drm)
{
	wl_proxy_destroy((struct wl_proxy *) drm);
}

static inline void
wl_drm_authenticate(struct wl_drm *drm, uint32_t id)
{
	wl_proxy_marshal((struct wl_proxy *) drm,
			 WL_DRM_AUTHENTICATE, id);
}

static inline struct wl_buffer *
wl_drm_create_buffer(struct wl_drm *drm, uint32_t name, int width, int height, uint32_t stride, struct wl_visual *visual)
{
	struct wl_proxy *id;

	id = wl_proxy_create((struct wl_proxy *) drm,
			     &wl_buffer_interface);
	if (!id)
		return NULL;

	wl_proxy_marshal((struct wl_proxy *) drm,
			 WL_DRM_CREATE_BUFFER, id, name, width, height, stride, visual);

	return (struct wl_buffer *) id;
}

#define WL_SHM_CREATE_BUFFER	0

static inline struct wl_shm *
wl_shm_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_shm *)
		wl_proxy_create_for_id(display, &wl_shm_interface, id);
}

static inline void
wl_shm_set_user_data(struct wl_shm *shm, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) shm, user_data);
}

static inline void *
wl_shm_get_user_data(struct wl_shm *shm)
{
	return wl_proxy_get_user_data((struct wl_proxy *) shm);
}

static inline void
wl_shm_destroy(struct wl_shm *shm)
{
	wl_proxy_destroy((struct wl_proxy *) shm);
}

static inline struct wl_buffer *
wl_shm_create_buffer(struct wl_shm *shm, int fd, int width, int height, uint32_t stride, struct wl_visual *visual)
{
	struct wl_proxy *id;

	id = wl_proxy_create((struct wl_proxy *) shm,
			     &wl_buffer_interface);
	if (!id)
		return NULL;

	wl_proxy_marshal((struct wl_proxy *) shm,
			 WL_SHM_CREATE_BUFFER, id, fd, width, height, stride, visual);

	return (struct wl_buffer *) id;
}

#define WL_BUFFER_DESTROY	0

static inline struct wl_buffer *
wl_buffer_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_buffer *)
		wl_proxy_create_for_id(display, &wl_buffer_interface, id);
}

static inline void
wl_buffer_set_user_data(struct wl_buffer *buffer, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) buffer, user_data);
}

static inline void *
wl_buffer_get_user_data(struct wl_buffer *buffer)
{
	return wl_proxy_get_user_data((struct wl_proxy *) buffer);
}

static inline void
wl_buffer_destroy(struct wl_buffer *buffer)
{
	wl_proxy_marshal((struct wl_proxy *) buffer,
			 WL_BUFFER_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) buffer);
}

#ifndef WL_SHELL_RESIZE_ENUM
#define WL_SHELL_RESIZE_ENUM
enum wl_shell_resize {
	WL_SHELL_RESIZE_NONE = 0,
	WL_SHELL_RESIZE_TOP = 1,
	WL_SHELL_RESIZE_BOTTOM = 2,
	WL_SHELL_RESIZE_LEFT = 4,
	WL_SHELL_RESIZE_TOP_LEFT = 5,
	WL_SHELL_RESIZE_BOTTOM_LEFT = 6,
	WL_SHELL_RESIZE_RIGHT = 8,
	WL_SHELL_RESIZE_TOP_RIGHT = 9,
	WL_SHELL_RESIZE_BOTTOM_RIGHT = 10,
};
#endif /* WL_SHELL_RESIZE_ENUM */

struct wl_shell_listener {
	void (*configure)(void *data,
			  struct wl_shell *shell,
			  uint32_t time,
			  uint32_t edges,
			  struct wl_surface *surface,
			  int width,
			  int height);
};

static inline int
wl_shell_add_listener(struct wl_shell *shell,
		      const struct wl_shell_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) shell,
				     (void (**)(void)) listener, data);
}

#define WL_SHELL_MOVE	0
#define WL_SHELL_RESIZE	1
#define WL_SHELL_CREATE_DRAG	2
#define WL_SHELL_CREATE_SELECTION	3

static inline struct wl_shell *
wl_shell_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_shell *)
		wl_proxy_create_for_id(display, &wl_shell_interface, id);
}

static inline void
wl_shell_set_user_data(struct wl_shell *shell, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) shell, user_data);
}

static inline void *
wl_shell_get_user_data(struct wl_shell *shell)
{
	return wl_proxy_get_user_data((struct wl_proxy *) shell);
}

static inline void
wl_shell_destroy(struct wl_shell *shell)
{
	wl_proxy_destroy((struct wl_proxy *) shell);
}

static inline void
wl_shell_move(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time)
{
	wl_proxy_marshal((struct wl_proxy *) shell,
			 WL_SHELL_MOVE, surface, input_device, time);
}

static inline void
wl_shell_resize(struct wl_shell *shell, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time, uint32_t edges)
{
	wl_proxy_marshal((struct wl_proxy *) shell,
			 WL_SHELL_RESIZE, surface, input_device, time, edges);
}

static inline struct wl_drag *
wl_shell_create_drag(struct wl_shell *shell)
{
	struct wl_proxy *id;

	id = wl_proxy_create((struct wl_proxy *) shell,
			     &wl_drag_interface);
	if (!id)
		return NULL;

	wl_proxy_marshal((struct wl_proxy *) shell,
			 WL_SHELL_CREATE_DRAG, id);

	return (struct wl_drag *) id;
}

static inline struct wl_selection *
wl_shell_create_selection(struct wl_shell *shell)
{
	struct wl_proxy *id;

	id = wl_proxy_create((struct wl_proxy *) shell,
			     &wl_selection_interface);
	if (!id)
		return NULL;

	wl_proxy_marshal((struct wl_proxy *) shell,
			 WL_SHELL_CREATE_SELECTION, id);

	return (struct wl_selection *) id;
}

struct wl_selection_listener {
	void (*send)(void *data,
		     struct wl_selection *selection,
		     const char *mime_type,
		     int fd);
	void (*cancelled)(void *data,
			  struct wl_selection *selection);
};

static inline int
wl_selection_add_listener(struct wl_selection *selection,
			  const struct wl_selection_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) selection,
				     (void (**)(void)) listener, data);
}

#define WL_SELECTION_OFFER	0
#define WL_SELECTION_ACTIVATE	1
#define WL_SELECTION_DESTROY	2

static inline struct wl_selection *
wl_selection_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_selection *)
		wl_proxy_create_for_id(display, &wl_selection_interface, id);
}

static inline void
wl_selection_set_user_data(struct wl_selection *selection, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) selection, user_data);
}

static inline void *
wl_selection_get_user_data(struct wl_selection *selection)
{
	return wl_proxy_get_user_data((struct wl_proxy *) selection);
}

static inline void
wl_selection_offer(struct wl_selection *selection, const char *type)
{
	wl_proxy_marshal((struct wl_proxy *) selection,
			 WL_SELECTION_OFFER, type);
}

static inline void
wl_selection_activate(struct wl_selection *selection, struct wl_input_device *input_device, uint32_t time)
{
	wl_proxy_marshal((struct wl_proxy *) selection,
			 WL_SELECTION_ACTIVATE, input_device, time);
}

static inline void
wl_selection_destroy(struct wl_selection *selection)
{
	wl_proxy_marshal((struct wl_proxy *) selection,
			 WL_SELECTION_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) selection);
}

struct wl_selection_offer_listener {
	void (*offer)(void *data,
		      struct wl_selection_offer *selection_offer,
		      const char *type);
	void (*keyboard_focus)(void *data,
			       struct wl_selection_offer *selection_offer,
			       struct wl_input_device *input_device);
};

static inline int
wl_selection_offer_add_listener(struct wl_selection_offer *selection_offer,
				const struct wl_selection_offer_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) selection_offer,
				     (void (**)(void)) listener, data);
}

#define WL_SELECTION_OFFER_RECEIVE	0

static inline struct wl_selection_offer *
wl_selection_offer_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_selection_offer *)
		wl_proxy_create_for_id(display, &wl_selection_offer_interface, id);
}

static inline void
wl_selection_offer_set_user_data(struct wl_selection_offer *selection_offer, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) selection_offer, user_data);
}

static inline void *
wl_selection_offer_get_user_data(struct wl_selection_offer *selection_offer)
{
	return wl_proxy_get_user_data((struct wl_proxy *) selection_offer);
}

static inline void
wl_selection_offer_destroy(struct wl_selection_offer *selection_offer)
{
	wl_proxy_destroy((struct wl_proxy *) selection_offer);
}

static inline void
wl_selection_offer_receive(struct wl_selection_offer *selection_offer, const char *mime_type, int fd)
{
	wl_proxy_marshal((struct wl_proxy *) selection_offer,
			 WL_SELECTION_OFFER_RECEIVE, mime_type, fd);
}

struct wl_drag_listener {
	void (*target)(void *data,
		       struct wl_drag *drag,
		       const char *mime_type);
	void (*finish)(void *data,
		       struct wl_drag *drag,
		       int fd);
	void (*reject)(void *data,
		       struct wl_drag *drag);
};

static inline int
wl_drag_add_listener(struct wl_drag *drag,
		     const struct wl_drag_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) drag,
				     (void (**)(void)) listener, data);
}

#define WL_DRAG_OFFER	0
#define WL_DRAG_ACTIVATE	1
#define WL_DRAG_DESTROY	2

static inline struct wl_drag *
wl_drag_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_drag *)
		wl_proxy_create_for_id(display, &wl_drag_interface, id);
}

static inline void
wl_drag_set_user_data(struct wl_drag *drag, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) drag, user_data);
}

static inline void *
wl_drag_get_user_data(struct wl_drag *drag)
{
	return wl_proxy_get_user_data((struct wl_proxy *) drag);
}

static inline void
wl_drag_offer(struct wl_drag *drag, const char *type)
{
	wl_proxy_marshal((struct wl_proxy *) drag,
			 WL_DRAG_OFFER, type);
}

static inline void
wl_drag_activate(struct wl_drag *drag, struct wl_surface *surface, struct wl_input_device *input_device, uint32_t time)
{
	wl_proxy_marshal((struct wl_proxy *) drag,
			 WL_DRAG_ACTIVATE, surface, input_device, time);
}

static inline void
wl_drag_destroy(struct wl_drag *drag)
{
	wl_proxy_marshal((struct wl_proxy *) drag,
			 WL_DRAG_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) drag);
}

struct wl_drag_offer_listener {
	void (*offer)(void *data,
		      struct wl_drag_offer *drag_offer,
		      const char *type);
	void (*pointer_focus)(void *data,
			      struct wl_drag_offer *drag_offer,
			      uint32_t time,
			      struct wl_surface *surface,
			      int x,
			      int y,
			      int surface_x,
			      int surface_y);
	void (*motion)(void *data,
		       struct wl_drag_offer *drag_offer,
		       uint32_t time,
		       int x,
		       int y,
		       int surface_x,
		       int surface_y);
	void (*drop)(void *data,
		     struct wl_drag_offer *drag_offer);
};

static inline int
wl_drag_offer_add_listener(struct wl_drag_offer *drag_offer,
			   const struct wl_drag_offer_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) drag_offer,
				     (void (**)(void)) listener, data);
}

#define WL_DRAG_OFFER_ACCEPT	0
#define WL_DRAG_OFFER_RECEIVE	1
#define WL_DRAG_OFFER_REJECT	2

static inline struct wl_drag_offer *
wl_drag_offer_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_drag_offer *)
		wl_proxy_create_for_id(display, &wl_drag_offer_interface, id);
}

static inline void
wl_drag_offer_set_user_data(struct wl_drag_offer *drag_offer, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) drag_offer, user_data);
}

static inline void *
wl_drag_offer_get_user_data(struct wl_drag_offer *drag_offer)
{
	return wl_proxy_get_user_data((struct wl_proxy *) drag_offer);
}

static inline void
wl_drag_offer_destroy(struct wl_drag_offer *drag_offer)
{
	wl_proxy_destroy((struct wl_proxy *) drag_offer);
}

static inline void
wl_drag_offer_accept(struct wl_drag_offer *drag_offer, uint32_t time, const char *type)
{
	wl_proxy_marshal((struct wl_proxy *) drag_offer,
			 WL_DRAG_OFFER_ACCEPT, time, type);
}

static inline void
wl_drag_offer_receive(struct wl_drag_offer *drag_offer, int fd)
{
	wl_proxy_marshal((struct wl_proxy *) drag_offer,
			 WL_DRAG_OFFER_RECEIVE, fd);
}

static inline void
wl_drag_offer_reject(struct wl_drag_offer *drag_offer)
{
	wl_proxy_marshal((struct wl_proxy *) drag_offer,
			 WL_DRAG_OFFER_REJECT);
}

#define WL_SURFACE_DESTROY	0
#define WL_SURFACE_ATTACH	1
#define WL_SURFACE_MAP_TOPLEVEL	2
#define WL_SURFACE_MAP_TRANSIENT	3
#define WL_SURFACE_MAP_FULLSCREEN	4
#define WL_SURFACE_DAMAGE	5

static inline struct wl_surface *
wl_surface_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_surface *)
		wl_proxy_create_for_id(display, &wl_surface_interface, id);
}

static inline void
wl_surface_set_user_data(struct wl_surface *surface, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) surface, user_data);
}

static inline void *
wl_surface_get_user_data(struct wl_surface *surface)
{
	return wl_proxy_get_user_data((struct wl_proxy *) surface);
}

static inline void
wl_surface_destroy(struct wl_surface *surface)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_DESTROY);

	wl_proxy_destroy((struct wl_proxy *) surface);
}

static inline void
wl_surface_attach(struct wl_surface *surface, struct wl_buffer *buffer, int x, int y)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_ATTACH, buffer, x, y);
}

static inline void
wl_surface_map_toplevel(struct wl_surface *surface)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_MAP_TOPLEVEL);
}

static inline void
wl_surface_map_transient(struct wl_surface *surface, struct wl_surface *parent, int x, int y, uint32_t flags)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_MAP_TRANSIENT, parent, x, y, flags);
}

static inline void
wl_surface_map_fullscreen(struct wl_surface *surface)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_MAP_FULLSCREEN);
}

static inline void
wl_surface_damage(struct wl_surface *surface, int x, int y, int width, int height)
{
	wl_proxy_marshal((struct wl_proxy *) surface,
			 WL_SURFACE_DAMAGE, x, y, width, height);
}

struct wl_input_device_listener {
	void (*motion)(void *data,
		       struct wl_input_device *input_device,
		       uint32_t time,
		       int x,
		       int y,
		       int surface_x,
		       int surface_y);
	void (*button)(void *data,
		       struct wl_input_device *input_device,
		       uint32_t time,
		       uint32_t button,
		       uint32_t state);
	void (*key)(void *data,
		    struct wl_input_device *input_device,
		    uint32_t time,
		    uint32_t key,
		    uint32_t state);
	void (*pointer_focus)(void *data,
			      struct wl_input_device *input_device,
			      uint32_t time,
			      struct wl_surface *surface,
			      int x,
			      int y,
			      int surface_x,
			      int surface_y);
	void (*keyboard_focus)(void *data,
			       struct wl_input_device *input_device,
			       uint32_t time,
			       struct wl_surface *surface,
			       struct wl_array *keys);
};

static inline int
wl_input_device_add_listener(struct wl_input_device *input_device,
			     const struct wl_input_device_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) input_device,
				     (void (**)(void)) listener, data);
}

#define WL_INPUT_DEVICE_ATTACH	0

static inline struct wl_input_device *
wl_input_device_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_input_device *)
		wl_proxy_create_for_id(display, &wl_input_device_interface, id);
}

static inline void
wl_input_device_set_user_data(struct wl_input_device *input_device, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) input_device, user_data);
}

static inline void *
wl_input_device_get_user_data(struct wl_input_device *input_device)
{
	return wl_proxy_get_user_data((struct wl_proxy *) input_device);
}

static inline void
wl_input_device_destroy(struct wl_input_device *input_device)
{
	wl_proxy_destroy((struct wl_proxy *) input_device);
}

static inline void
wl_input_device_attach(struct wl_input_device *input_device, uint32_t time, struct wl_buffer *buffer, int hotspot_x, int hotspot_y)
{
	wl_proxy_marshal((struct wl_proxy *) input_device,
			 WL_INPUT_DEVICE_ATTACH, time, buffer, hotspot_x, hotspot_y);
}

struct wl_output_listener {
	void (*geometry)(void *data,
			 struct wl_output *output,
			 int x,
			 int y,
			 int width,
			 int height);
};

static inline int
wl_output_add_listener(struct wl_output *output,
		       const struct wl_output_listener *listener, void *data)
{
	return wl_proxy_add_listener((struct wl_proxy *) output,
				     (void (**)(void)) listener, data);
}

static inline struct wl_output *
wl_output_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_output *)
		wl_proxy_create_for_id(display, &wl_output_interface, id);
}

static inline void
wl_output_set_user_data(struct wl_output *output, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) output, user_data);
}

static inline void *
wl_output_get_user_data(struct wl_output *output)
{
	return wl_proxy_get_user_data((struct wl_proxy *) output);
}

static inline void
wl_output_destroy(struct wl_output *output)
{
	wl_proxy_destroy((struct wl_proxy *) output);
}

static inline struct wl_visual *
wl_visual_create(struct wl_display *display, uint32_t id)
{
	return (struct wl_visual *)
		wl_proxy_create_for_id(display, &wl_visual_interface, id);
}

static inline void
wl_visual_set_user_data(struct wl_visual *visual, void *user_data)
{
	wl_proxy_set_user_data((struct wl_proxy *) visual, user_data);
}

static inline void *
wl_visual_get_user_data(struct wl_visual *visual)
{
	return wl_proxy_get_user_data((struct wl_proxy *) visual);
}

static inline void
wl_visual_destroy(struct wl_visual *visual)
{
	wl_proxy_destroy((struct wl_proxy *) visual);
}

#ifdef  __cplusplus
}
#endif

#endif