-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswcl.h
1844 lines (1665 loc) · 63.9 KB
/
swcl.h
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
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2024 Vlad Krupinskii <[email protected]>
// SPDX-License-Identifier: MIT
// SWCL - Simple Wayland Client Library
// Create Wayland clients easily.
// This header-only library simplifies creating native Wayland window, receiving
// mouse or keyboard events and helping with creation of Client-Side Decorations
// (CSD).
// Compile flags: -lwayland-client -lwayland-egl -lwayland-cursor -lGL -lEGL -lm
#ifndef SWCL_H
#define SWCL_H
#include <EGL/egl.h>
#include <GL/gl.h>
#include <wayland-client-protocol.h>
#include <wayland-client.h>
#include <wayland-cursor.h>
#include <wayland-egl-core.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
// -------- MACROS -------- //
// Log formatted message
#define SWCL_LOG(format, ...) \
fprintf(stderr, "SWCL: " format "\n", ##__VA_ARGS__)
// Debug log formatted message
#ifdef SWCL_ENABLE_DEBUG_LOGS
#define SWCL_LOG_DEBUG(format, ...) \
fprintf(stdout, "SWCL DEBUG: " format "\n", ##__VA_ARGS__)
#else
#define SWCL_LOG_DEBUG(format, ...) ((void)0)
#endif
// Not implemented message
#define SWCL_NOT_IMPLEMENTED(func_name) \
printf("SWCL FUNCTION IS NOT IMPLEMENTED: %s\n", func_name)
// Exit program with message
#define SWCL_PANIC(format, ...) \
do { \
fprintf(stderr, "SWCL PANIC: " format "\n", ##__VA_ARGS__); \
exit(1); \
} while (0)
#define SWCL_ALLOC(T) (T *)malloc(sizeof(T))
// ---------- UTILS ---------- //
// Function to generate unique ID
static inline int swcl_generate_id() {
static int id = -1; // static variable to hold the current ID value
return ++id; // increment and return the current ID
}
// --- Dynamic Array --- //
// Simple dynamic array structure that can only be grown in size
typedef struct {
uint32_t length;
uint32_t capacity;
void **items;
} SWCLArray;
// Create new dynamic array with given initial capacity.
static inline SWCLArray swcl_array_new(uint32_t initial_capacity) {
SWCLArray a = {
.length = 0,
.capacity = initial_capacity,
.items = (void **)malloc(sizeof(void *) * initial_capacity),
};
return a;
};
// Add item to the end of the array, resizing it if needed.
static inline void swcl_array_append(SWCLArray *array, void *item) {
if (array->length + 1 > array->capacity) {
void **new_array =
(void **)realloc(array->items, ++array->capacity * sizeof(void *));
array->items = new_array;
}
array->items[array->length++] = item;
}
// Destroy array
static inline void swcl_array_free(SWCLArray array) {
for (uint32_t i = 0; i < array.length; i++) {
free(array.items[i]);
}
}
// ---------- ENUMS ---------- //
// Direction of the mouse scroll wheel
typedef enum {
SWCL_SCROLL_UP = 0,
SWCL_SCROLL_DOWN = 1,
} SWCLScrollDirection;
// Mouse buttons keycodes
typedef enum {
SWCL_MOUSE_1 = 272, // Left
SWCL_MOUSE_2 = 273, // Right
SWCL_MOUSE_3 = 274, // Middle
SWCL_MOUSE_4 = 275, // Back
SWCL_MOUSE_5 = 276, // Forward
} SWCLMouseButton;
// State of the button
typedef enum {
SWCL_BUTTON_RELEASED = 0,
SWCL_BUTTON_PRESSED = 1,
} SWCLButtonState;
// Edge or corner of the window. Passed to 'swcl_window_resize' function.
typedef enum {
SWCL_WINDOW_EDGE_NONE = 0,
SWCL_WINDOW_EDGE_TOP = 1,
SWCL_WINDOW_EDGE_BOTTOM = 2,
SWCL_WINDOW_EDGE_LEFT = 4,
SWCL_WINDOW_EDGE_TOP_LEFT = 5,
SWCL_WINDOW_EDGE_BOTTOM_LEFT = 6,
SWCL_WINDOW_EDGE_RIGHT = 8,
SWCL_WINDOW_EDGE_TOP_RIGHT = 9,
SWCL_WINDOW_EDGE_BOTTOM_RIGHT = 10,
} SWCLWindowEdge;
// Ancor position of the window.
typedef enum {
SWCL_ANCOR_NONE = 0,
SWCL_ANCOR_TOP = 1,
SWCL_ANCOR_BOTTOM = 2,
SWCL_ANCOR_LEFT = 3,
SWCL_ANCOR_RIGHT = 4,
SWCL_ANCOR_CENTER = 5,
} SWCLAncor;
// ---------- STRUCTS ---------- //
typedef struct SWCLApplication SWCLApplication;
typedef struct SWCLWindow SWCLWindow;
// Toplevel window object
typedef struct SWCLWindow {
// Read-Only properties
uint32_t id;
char *title;
uint32_t width;
uint32_t height;
uint32_t min_width;
uint32_t min_height;
bool maximized;
bool fullscreen;
// Draw function
void (*on_draw_cb)(SWCLWindow *win);
// Wayland elements
struct wl_surface *wl_surface;
struct wl_callback *wl_callback;
struct xdg_surface *xdg_surface;
struct xdg_toplevel *xdg_toplevel;
// EGL
struct wl_egl_window *egl_window;
EGLSurface egl_surface;
SWCLApplication *app;
} SWCLWindow;
// SWCL application configuration.
// Create before initializing.
// app_id must be in format e. g. "com.mydomain.AppName"
// Callbacks can be NULL.
typedef struct {
const char *app_id;
void (*on_pointer_enter_cb)(SWCLWindow *win, int x, int y);
void (*on_pointer_leave_cb)(SWCLWindow *win);
void (*on_pointer_motion_cb)(SWCLWindow *win, int x, int y);
void (*on_mouse_button_cb)(SWCLWindow *win, SWCLMouseButton button,
SWCLButtonState state);
void (*on_mouse_scroll_cb)(SWCLWindow *win, SWCLScrollDirection dir);
void (*on_keyboard_key_cb)(SWCLWindow *win, uint32_t key,
SWCLButtonState state);
void (*on_keyboard_mod_key_cb)(SWCLWindow *win, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);
} SWCLConfig;
// Position with x and y coordinates
typedef struct {
uint32_t x;
uint32_t y;
} SWCLPoint;
struct SWCLApplication {
// Properties
const char *app_id;
bool running;
SWCLArray windows;
SWCLPoint cursor_pos;
SWCLWindow *current_window;
// Serials of events
uint32_t wl_pointer_serial;
uint32_t wl_keyboard_serial;
// Wayland
struct wl_display *wl_display;
struct wl_registry *wl_registry;
struct wl_compositor *wl_compositor;
struct wl_seat *wl_seat;
struct wl_pointer *wl_pointer;
struct wl_keyboard *wl_keyboard;
struct xdg_wm_base *xdg_wm_base;
struct zwlr_layer_shell_v1 *wlr_layer_shell;
EGLConfig egl_config;
EGLDisplay egl_display;
EGLContext egl_context;
// Cursor
struct wl_buffer *wl_cursor_buffer;
struct wl_cursor *wl_cursor;
struct wl_cursor_theme *wl_cursor_theme;
struct wl_cursor_image *wl_cursor_image;
struct wl_shm *wl_cursor_shm;
struct wl_surface *wl_cursor_surface;
char *current_cursor_name;
// Callbacks
void (*on_pointer_enter_cb)(SWCLWindow *win, int x, int y);
void (*on_pointer_leave_cb)(SWCLWindow *win);
void (*on_pointer_motion_cb)(SWCLWindow *win, int x, int y);
void (*on_mouse_button_cb)(SWCLWindow *win, SWCLMouseButton button,
SWCLButtonState state);
void (*on_mouse_scroll_cb)(SWCLWindow *win, SWCLScrollDirection dir);
void (*on_keyboard_key_cb)(SWCLWindow *win, uint32_t key,
SWCLButtonState state);
void (*on_keyboard_mod_key_cb)(SWCLWindow *win, uint32_t mods_depressed,
uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);
};
// ---------- DRAWING-RELATED STRUCTS ---------- //
// RGBA color. Values can be from 0 to 255.
typedef struct {
uint8_t r;
uint8_t g;
uint8_t b;
uint8_t a;
} SWCLColor;
// Rectangle with top left corner position at 'x' and 'y',
// width 'w' and height 'h'
typedef struct {
uint32_t x;
uint32_t y;
uint32_t w;
uint32_t h;
} SWCLRect;
// Circle where 'cx' and 'cy' are coordinates of the center of the circle and
// 'r' is the radius
typedef struct {
uint32_t cx;
uint32_t cy;
uint32_t r;
} SWCLCircle;
// ---------- APPLICATION ---------- //
// Initialize SWCL.
// It will initialize connection to Wayland display, register mouse, keyboard
// and touch devices. Also it will initialize EGL and create OpenGL context.
static SWCLApplication *swcl_application_new(SWCLConfig *cfg);
// Start the application loop
static void swcl_application_run(SWCLApplication *app);
// Set cursor image with given name and size.
// Name can be one of those:
// "left_ptr" - default cursor
// "top_side" - resize top side
// "bottom_side" - resize bottom side
// "left_side" - resize left side
// "right_side" - resize right side
// "top_left_corner" - resize top left corner
// "top_right_corner" - resize top right corner
// "bottom_left_corner" - resize bottom left corner
// "bottom_right_corner" - resize bottom right corner
static void swcl_application_set_cursor(SWCLApplication *app, const char *name,
uint8_t size);
// Shutdown SWCL application
static void swcl_application_quit(SWCLApplication *app);
// ---------- WINDOW ---------- //
// Create new window.
// This function takes care of creating native wayland window with stuff like
// wl_surface, xdg_surface, xdg_toplevel and putting egl_window with OpenGL
// context into it.
static SWCLWindow *swcl_window_new(SWCLApplication *app, char *title,
uint16_t width, uint16_t height,
uint16_t min_width, uint16_t min_height,
bool maximized, bool fullscreen,
void (*draw_func)(SWCLWindow *win));
// Start window rendering.
static void swcl_window_show(SWCLWindow *win);
// Set window ancor. Useful for bars, docks or run menus types of apps.
// Can be used only with compositors that support
// wlr_layer_shell protocol, e. g. hyprland, kwin, sway.
// If compositor is not supported - does nothing.
static void swcl_window_ancor(SWCLAncor ancor);
// Request server-side decorations (SSR) for the window.
// Compositor must support xdg_decoration protocol.
// Supported compositors: kwin, sway, hyprland.
static void swcl_window_request_ssr(SWCLWindow *win);
// Show compositor window menu. This function is
// useful for implementing Client-Side Decorations (CSD).
static void swcl_window_show_menu(SWCLWindow *win);
// Tells compositor to begin native drag operation. With this, window can be
// snapped to the sides of the screen if comositor allows it. This function is
// useful for implementing Client-Side Decorations (CSD).
static void swcl_window_drag(SWCLWindow *win);
// Tells compositor to begin native resize operation. With this, window can be
// resized if comositor allows it.
// This function is useful for implementing Client-Side Decorations (CSD).
static void swcl_window_resize(SWCLWindow *win, SWCLWindowEdge edge);
// Swap OpenGL buffer for rendered frame
static void swcl_window_swap_buffers(SWCLWindow *win);
// Set window properties
// Set window title
static void swcl_window_set_title(SWCLWindow *win, char *title);
// Set window size
// void swcl_window_set_size(SWCLWindow *win, int width, int height);
// Set window minimum size
static void swcl_window_set_min_size(SWCLWindow *win, int min_width,
int min_height);
// Set window maximized state
static void swcl_window_set_maximized(SWCLWindow *win, bool maximized);
// Set window minimized state
static void swcl_window_minimize(SWCLWindow *win);
// Set window fullscreen state
static void swcl_window_set_fullscreen(SWCLWindow *win, bool maximized);
// ---------- DRAWING ---------- //
// Clear buffer background
static void swcl_clear_background(SWCLColor color);
// Draw rectangle with given color and dimentions.
static void swcl_draw_rect(SWCLColor color, SWCLRect rect);
// Same as swcl_draw_rect, but with rounded corners
static void swcl_draw_rounded_rect(SWCLColor color, SWCLRect rect, int radius);
// Draw circle
static void swcl_draw_circle(SWCLColor color, SWCLCircle circle);
// ------------------------------------------------------------------------- //
// //
// XDG_SHELL_PROTOCOL DEFENITION //
// INSERTED DURING BUILD STEP //
// //
// ------------------------------------------------------------------------- //
#ifndef XDG_SHELL_CLIENT_PROTOCOL_H
#define XDG_SHELL_CLIENT_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-client.h"
struct wl_output;
struct wl_seat;
struct wl_surface;
struct xdg_popup;
struct xdg_positioner;
struct xdg_surface;
struct xdg_toplevel;
struct xdg_wm_base;
#ifndef XDG_WM_BASE_INTERFACE
#define XDG_WM_BASE_INTERFACE
extern const struct wl_interface xdg_wm_base_interface;
#endif
#ifndef XDG_POSITIONER_INTERFACE
#define XDG_POSITIONER_INTERFACE
extern const struct wl_interface xdg_positioner_interface;
#endif
#ifndef XDG_SURFACE_INTERFACE
#define XDG_SURFACE_INTERFACE
extern const struct wl_interface xdg_surface_interface;
#endif
#ifndef XDG_TOPLEVEL_INTERFACE
#define XDG_TOPLEVEL_INTERFACE
extern const struct wl_interface xdg_toplevel_interface;
#endif
#ifndef XDG_POPUP_INTERFACE
#define XDG_POPUP_INTERFACE
extern const struct wl_interface xdg_popup_interface;
#endif
#ifndef XDG_WM_BASE_ERROR_ENUM
#define XDG_WM_BASE_ERROR_ENUM
enum xdg_wm_base_error {
XDG_WM_BASE_ERROR_ROLE = 0,
XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,
XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,
XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,
XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,
XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,
XDG_WM_BASE_ERROR_UNRESPONSIVE = 6,
};
#endif
struct xdg_wm_base_listener {
void (*ping)(void *data,
struct xdg_wm_base *xdg_wm_base,
uint32_t serial);
};
static inline int
xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base,
const struct xdg_wm_base_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base,
(void (**)(void)) listener, data);
}
#define XDG_WM_BASE_DESTROY 0
#define XDG_WM_BASE_CREATE_POSITIONER 1
#define XDG_WM_BASE_GET_XDG_SURFACE 2
#define XDG_WM_BASE_PONG 3
#define XDG_WM_BASE_PING_SINCE_VERSION 1
#define XDG_WM_BASE_DESTROY_SINCE_VERSION 1
#define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1
#define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1
#define XDG_WM_BASE_PONG_SINCE_VERSION 1
static inline void
xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data);
}
static inline void *
xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base);
}
static inline uint32_t
xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base);
}
static inline void
xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), WL_MARSHAL_FLAG_DESTROY);
}
static inline struct xdg_positioner *
xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL);
return (struct xdg_positioner *) id;
}
static inline struct xdg_surface *
xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, NULL, surface);
return (struct xdg_surface *) id;
}
static inline void
xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_wm_base,
XDG_WM_BASE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_wm_base), 0, serial);
}
#ifndef XDG_POSITIONER_ERROR_ENUM
#define XDG_POSITIONER_ERROR_ENUM
enum xdg_positioner_error {
XDG_POSITIONER_ERROR_INVALID_INPUT = 0,
};
#endif
#ifndef XDG_POSITIONER_ANCHOR_ENUM
#define XDG_POSITIONER_ANCHOR_ENUM
enum xdg_positioner_anchor {
XDG_POSITIONER_ANCHOR_NONE = 0,
XDG_POSITIONER_ANCHOR_TOP = 1,
XDG_POSITIONER_ANCHOR_BOTTOM = 2,
XDG_POSITIONER_ANCHOR_LEFT = 3,
XDG_POSITIONER_ANCHOR_RIGHT = 4,
XDG_POSITIONER_ANCHOR_TOP_LEFT = 5,
XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6,
XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7,
XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8,
};
#endif
#ifndef XDG_POSITIONER_GRAVITY_ENUM
#define XDG_POSITIONER_GRAVITY_ENUM
enum xdg_positioner_gravity {
XDG_POSITIONER_GRAVITY_NONE = 0,
XDG_POSITIONER_GRAVITY_TOP = 1,
XDG_POSITIONER_GRAVITY_BOTTOM = 2,
XDG_POSITIONER_GRAVITY_LEFT = 3,
XDG_POSITIONER_GRAVITY_RIGHT = 4,
XDG_POSITIONER_GRAVITY_TOP_LEFT = 5,
XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6,
XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7,
XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8,
};
#endif
#ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
#define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
enum xdg_positioner_constraint_adjustment {
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
};
#endif
#define XDG_POSITIONER_DESTROY 0
#define XDG_POSITIONER_SET_SIZE 1
#define XDG_POSITIONER_SET_ANCHOR_RECT 2
#define XDG_POSITIONER_SET_ANCHOR 3
#define XDG_POSITIONER_SET_GRAVITY 4
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5
#define XDG_POSITIONER_SET_OFFSET 6
#define XDG_POSITIONER_SET_REACTIVE 7
#define XDG_POSITIONER_SET_PARENT_SIZE 8
#define XDG_POSITIONER_SET_PARENT_CONFIGURE 9
#define XDG_POSITIONER_DESTROY_SINCE_VERSION 1
#define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1
#define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1
#define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1
#define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1
#define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1
#define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1
#define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3
#define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3
#define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3
static inline void
xdg_positioner_set_user_data(struct xdg_positioner *xdg_positioner, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_positioner, user_data);
}
static inline void *
xdg_positioner_get_user_data(struct xdg_positioner *xdg_positioner)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_positioner);
}
static inline uint32_t
xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_positioner);
}
static inline void
xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), WL_MARSHAL_FLAG_DESTROY);
}
static inline void
xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, width, height);
}
static inline void
xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y, width, height);
}
static inline void
xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, anchor);
}
static inline void
xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, gravity);
}
static inline void
xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, constraint_adjustment);
}
static inline void
xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, x, y);
}
static inline void
xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_REACTIVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0);
}
static inline void
xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_PARENT_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, parent_width, parent_height);
}
static inline void
xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_positioner,
XDG_POSITIONER_SET_PARENT_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_positioner), 0, serial);
}
#ifndef XDG_SURFACE_ERROR_ENUM
#define XDG_SURFACE_ERROR_ENUM
enum xdg_surface_error {
XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1,
XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2,
XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3,
XDG_SURFACE_ERROR_INVALID_SERIAL = 4,
XDG_SURFACE_ERROR_INVALID_SIZE = 5,
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT = 6,
};
#endif
struct xdg_surface_listener {
void (*configure)(void *data,
struct xdg_surface *xdg_surface,
uint32_t serial);
};
static inline int
xdg_surface_add_listener(struct xdg_surface *xdg_surface,
const struct xdg_surface_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
(void (**)(void)) listener, data);
}
#define XDG_SURFACE_DESTROY 0
#define XDG_SURFACE_GET_TOPLEVEL 1
#define XDG_SURFACE_GET_POPUP 2
#define XDG_SURFACE_SET_WINDOW_GEOMETRY 3
#define XDG_SURFACE_ACK_CONFIGURE 4
#define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1
#define XDG_SURFACE_DESTROY_SINCE_VERSION 1
#define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 1
#define XDG_SURFACE_GET_POPUP_SINCE_VERSION 1
#define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
#define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1
static inline void
xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
}
static inline void *
xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
}
static inline uint32_t
xdg_surface_get_version(struct xdg_surface *xdg_surface)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_surface);
}
static inline void
xdg_surface_destroy(struct xdg_surface *xdg_surface)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
XDG_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), WL_MARSHAL_FLAG_DESTROY);
}
static inline struct xdg_toplevel *
xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL);
return (struct xdg_toplevel *) id;
}
static inline struct xdg_popup *
xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *parent, struct xdg_positioner *positioner)
{
struct wl_proxy *id;
id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
XDG_SURFACE_GET_POPUP, &xdg_popup_interface, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, NULL, parent, positioner);
return (struct xdg_popup *) id;
}
static inline void
xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
XDG_SURFACE_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, x, y, width, height);
}
static inline void
xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_surface,
XDG_SURFACE_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_surface), 0, serial);
}
#ifndef XDG_TOPLEVEL_ERROR_ENUM
#define XDG_TOPLEVEL_ERROR_ENUM
enum xdg_toplevel_error {
XDG_TOPLEVEL_ERROR_INVALID_RESIZE_EDGE = 0,
XDG_TOPLEVEL_ERROR_INVALID_PARENT = 1,
XDG_TOPLEVEL_ERROR_INVALID_SIZE = 2,
};
#endif
#ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM
#define XDG_TOPLEVEL_RESIZE_EDGE_ENUM
enum xdg_toplevel_resize_edge {
XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0,
XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1,
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2,
XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4,
XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5,
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6,
XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8,
XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9,
XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10,
};
#endif
#ifndef XDG_TOPLEVEL_STATE_ENUM
#define XDG_TOPLEVEL_STATE_ENUM
enum xdg_toplevel_state {
XDG_TOPLEVEL_STATE_MAXIMIZED = 1,
XDG_TOPLEVEL_STATE_FULLSCREEN = 2,
XDG_TOPLEVEL_STATE_RESIZING = 3,
XDG_TOPLEVEL_STATE_ACTIVATED = 4,
XDG_TOPLEVEL_STATE_TILED_LEFT = 5,
XDG_TOPLEVEL_STATE_TILED_RIGHT = 6,
XDG_TOPLEVEL_STATE_TILED_TOP = 7,
XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8,
XDG_TOPLEVEL_STATE_SUSPENDED = 9,
};
#define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 2
#define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 2
#define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 2
#define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2
#define XDG_TOPLEVEL_STATE_SUSPENDED_SINCE_VERSION 6
#endif
#ifndef XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
#define XDG_TOPLEVEL_WM_CAPABILITIES_ENUM
enum xdg_toplevel_wm_capabilities {
XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1,
XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 2,
XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 3,
XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 4,
};
#endif
struct xdg_toplevel_listener {
void (*configure)(void *data,
struct xdg_toplevel *xdg_toplevel,
int32_t width,
int32_t height,
struct wl_array *states);
void (*close)(void *data,
struct xdg_toplevel *xdg_toplevel);
void (*configure_bounds)(void *data,
struct xdg_toplevel *xdg_toplevel,
int32_t width,
int32_t height);
void (*wm_capabilities)(void *data,
struct xdg_toplevel *xdg_toplevel,
struct wl_array *capabilities);
};
static inline int
xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel,
const struct xdg_toplevel_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel,
(void (**)(void)) listener, data);
}
#define XDG_TOPLEVEL_DESTROY 0
#define XDG_TOPLEVEL_SET_PARENT 1
#define XDG_TOPLEVEL_SET_TITLE 2
#define XDG_TOPLEVEL_SET_APP_ID 3
#define XDG_TOPLEVEL_SHOW_WINDOW_MENU 4
#define XDG_TOPLEVEL_MOVE 5
#define XDG_TOPLEVEL_RESIZE 6
#define XDG_TOPLEVEL_SET_MAX_SIZE 7
#define XDG_TOPLEVEL_SET_MIN_SIZE 8
#define XDG_TOPLEVEL_SET_MAXIMIZED 9
#define XDG_TOPLEVEL_UNSET_MAXIMIZED 10
#define XDG_TOPLEVEL_SET_FULLSCREEN 11
#define XDG_TOPLEVEL_UNSET_FULLSCREEN 12
#define XDG_TOPLEVEL_SET_MINIMIZED 13
#define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 1
#define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1
#define XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION 4
#define XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION 5
#define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 1
#define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 1
#define XDG_TOPLEVEL_MOVE_SINCE_VERSION 1
#define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 1
#define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 1
#define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 1
#define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 1
static inline void
xdg_toplevel_set_user_data(struct xdg_toplevel *xdg_toplevel, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel, user_data);
}
static inline void *
xdg_toplevel_get_user_data(struct xdg_toplevel *xdg_toplevel)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel);
}
static inline uint32_t
xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel);
}
static inline void
xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), WL_MARSHAL_FLAG_DESTROY);
}
static inline void
xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, parent);
}
static inline void
xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, title);
}
static inline void
xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, app_id);
}
static inline void
xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, x, y);
}
static inline void
xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial);
}
static inline void
xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, seat, serial, edges);
}
static inline void
xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
}
static inline void
xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, width, height);
}
static inline void
xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
}
static inline void
xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
}
static inline void
xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0, output);
}
static inline void
xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
}
static inline void
xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_toplevel,
XDG_TOPLEVEL_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_toplevel), 0);
}
#ifndef XDG_POPUP_ERROR_ENUM
#define XDG_POPUP_ERROR_ENUM
enum xdg_popup_error {
XDG_POPUP_ERROR_INVALID_GRAB = 0,
};
#endif
struct xdg_popup_listener {
void (*configure)(void *data,
struct xdg_popup *xdg_popup,
int32_t x,
int32_t y,
int32_t width,
int32_t height);
void (*popup_done)(void *data,
struct xdg_popup *xdg_popup);
void (*repositioned)(void *data,
struct xdg_popup *xdg_popup,
uint32_t token);
};
static inline int
xdg_popup_add_listener(struct xdg_popup *xdg_popup,
const struct xdg_popup_listener *listener, void *data)
{
return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
(void (**)(void)) listener, data);
}
#define XDG_POPUP_DESTROY 0
#define XDG_POPUP_GRAB 1
#define XDG_POPUP_REPOSITION 2
#define XDG_POPUP_CONFIGURE_SINCE_VERSION 1
#define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
#define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3
#define XDG_POPUP_DESTROY_SINCE_VERSION 1
#define XDG_POPUP_GRAB_SINCE_VERSION 1
#define XDG_POPUP_REPOSITION_SINCE_VERSION 3
static inline void
xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
}
static inline void *
xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
{
return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
}
static inline uint32_t
xdg_popup_get_version(struct xdg_popup *xdg_popup)
{
return wl_proxy_get_version((struct wl_proxy *) xdg_popup);
}
static inline void
xdg_popup_destroy(struct xdg_popup *xdg_popup)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
XDG_POPUP_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), WL_MARSHAL_FLAG_DESTROY);
}
static inline void
xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
XDG_POPUP_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, seat, serial);
}
static inline void
xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)
{
wl_proxy_marshal_flags((struct wl_proxy *) xdg_popup,
XDG_POPUP_REPOSITION, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_popup), 0, positioner, token);
}
#endif