github.com/rajveermalviya/gamen@v0.1.2-0.20220930195403-9be15877c1aa/internal/wayland/callbacks.c (about) 1 //go:build linux && !android 2 3 #include <stdio.h> 4 #include "_cgo_export.h" 5 #include "wayland-client-protocol.h" 6 #include "xdg-shell-client-protocol.h" 7 #include "xdg-decoration-unstable-v1-client-protocol.h" 8 9 const struct wl_registry_listener gamen_wl_registry_listener = { 10 .global = (void (*)(void *, struct wl_registry *, uint32_t, const char *, uint32_t))registryHandleGlobal, 11 .global_remove = registryHandleGlobalRemove, 12 }; 13 14 void outputHandleName(void *data, struct wl_output *wl_output, const char *name) {} 15 16 void outputHandleDescription(void *data, struct wl_output *wl_output, const char *description) {} 17 18 const struct wl_output_listener gamen_wl_output_listener = { 19 .geometry = (void (*)(void *, struct wl_output *, int32_t, int32_t, int32_t, int32_t, int32_t, const char *, const char *, int32_t))outputHandleGeometry, 20 .mode = outputHandleMode, 21 .done = outputHandleDone, 22 .scale = outputHandleScale, 23 .name = outputHandleName, 24 .description = outputHandleDescription, 25 }; 26 27 const struct xdg_wm_base_listener gamen_xdg_wm_base_listener = { 28 .ping = xdgWmBaseHandlePing, 29 }; 30 31 void seatHandleName(void *data, struct wl_seat *seat, const char *name) {} 32 33 const struct wl_seat_listener gamen_wl_seat_listener = { 34 .capabilities = seatHandleCapabilities, 35 .name = seatHandleName, 36 }; 37 38 void pointerHandleMotion_cgo(void *data, struct wl_pointer *wl_pointer, uint32_t time, wl_fixed_t surface_x, wl_fixed_t surface_y) { 39 pointerHandleMotion(data, wl_pointer, time, wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y)); 40 } 41 42 void pointerHandleAxis_cgo(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis, wl_fixed_t value) { 43 pointerHandleAxis(data, wl_pointer, time, axis, wl_fixed_to_double(value)); 44 } 45 46 void pointerHandleAxisSource(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source) {} 47 48 void pointerHandleAxisStop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis) {} 49 50 const struct wl_pointer_listener gamen_wl_pointer_listener = { 51 .enter = pointerHandleEnter, 52 .leave = pointerHandleLeave, 53 .motion = pointerHandleMotion_cgo, 54 .button = pointerHandleButton, 55 .axis = pointerHandleAxis_cgo, 56 .axis_discrete = pointerHandleAxisDiscrete, 57 .axis_source = pointerHandleAxisSource, 58 .axis_stop = pointerHandleAxisStop, 59 .frame = pointerHandleFrame, 60 }; 61 62 const struct wl_keyboard_listener gamen_wl_keyboard_listener = { 63 .keymap = keyboardHandleKeymap, 64 .enter = keyboardHandleEnter, 65 .leave = keyboardHandleLeave, 66 .key = keyboardHandleKey, 67 .modifiers = keyboardHandleModifiers, 68 .repeat_info = keyboardHandleRepeatInfo, 69 }; 70 71 const struct wl_surface_listener gamen_wl_surface_listener = { 72 .enter = windowSurfaceHandleEnter, 73 .leave = windowSurfaceHandleLeave, 74 }; 75 76 const struct xdg_surface_listener gamen_xdg_surface_listener = { 77 .configure = xdgSurfaceHandleConfigure, 78 }; 79 80 void xdgToplevelConfigureBounds(void *data, struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height) {} 81 82 const struct xdg_toplevel_listener gamen_xdg_toplevel_listener = { 83 .configure = xdgToplevelHandleConfigure, 84 .close = xdgToplevelHandleClose, 85 .configure_bounds = xdgToplevelConfigureBounds, 86 }; 87 88 void zxdgToplevelDecorationHandleConfigure(void *data, struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode) {} 89 90 const struct zxdg_toplevel_decoration_v1_listener gamen_zxdg_toplevel_decoration_v1_listener = { 91 .configure = zxdgToplevelDecorationHandleConfigure, 92 }; 93 94 const struct wl_callback_listener gamen_wl_callback_listener = { 95 .done = goWlCallbackDone, 96 };