git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

scratch/print_xwayland_offsets.c (758B)

 1 #define WLR_USE_UNSTABLE
 2 #include <wlr/xwayland.h>
 3 #include <stdio.h>
 4 #include <stddef.h>
 5 
 6 #define PRINT_OFFSET(struct_name, member) \
 7     printf("offset of " #member ": %zu\n", offsetof(struct_name, member))
 8 
 9 int main() {
10     printf("C sizeof(struct wlr_xwayland): %zu\n", sizeof(struct wlr_xwayland));
11     PRINT_OFFSET(struct wlr_xwayland, server);
12     PRINT_OFFSET(struct wlr_xwayland, own_server);
13     PRINT_OFFSET(struct wlr_xwayland, xwm);
14     PRINT_OFFSET(struct wlr_xwayland, shell_v1);
15     PRINT_OFFSET(struct wlr_xwayland, display_name);
16     PRINT_OFFSET(struct wlr_xwayland, wl_display);
17     PRINT_OFFSET(struct wlr_xwayland, compositor);
18     PRINT_OFFSET(struct wlr_xwayland, seat);
19     PRINT_OFFSET(struct wlr_xwayland, events);
20     return 0;
21 }