github.com/cybriq/giocore@v0.0.7-0.20210703034601-cfb9cb5f3900/app/internal/wm/os_wayland.c (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 // +build linux,!android,!nowayland freebsd 4 5 #include <wayland-client.h> 6 #include "wayland_xdg_shell.h" 7 #include "wayland_text_input.h" 8 #include "_cgo_export.h" 9 10 const struct wl_registry_listener gio_registry_listener = { 11 // Cast away const parameter. 12 .global = (void (*)(void *, struct wl_registry *, uint32_t, const char *, uint32_t))gio_onRegistryGlobal, 13 .global_remove = gio_onRegistryGlobalRemove 14 }; 15 16 const struct wl_surface_listener gio_surface_listener = { 17 .enter = gio_onSurfaceEnter, 18 .leave = gio_onSurfaceLeave, 19 }; 20 21 const struct xdg_surface_listener gio_xdg_surface_listener = { 22 .configure = gio_onXdgSurfaceConfigure, 23 }; 24 25 const struct xdg_toplevel_listener gio_xdg_toplevel_listener = { 26 .configure = gio_onToplevelConfigure, 27 .close = gio_onToplevelClose, 28 }; 29 30 static void xdg_wm_base_handle_ping(void *data, struct xdg_wm_base *wm, uint32_t serial) { 31 xdg_wm_base_pong(wm, serial); 32 } 33 34 const struct xdg_wm_base_listener gio_xdg_wm_base_listener = { 35 .ping = xdg_wm_base_handle_ping, 36 }; 37 38 const struct wl_callback_listener gio_callback_listener = { 39 .done = gio_onFrameDone, 40 }; 41 42 const struct wl_output_listener gio_output_listener = { 43 // Cast away const parameter. 44 .geometry = (void (*)(void *, struct wl_output *, int32_t, int32_t, int32_t, int32_t, int32_t, const char *, const char *, int32_t))gio_onOutputGeometry, 45 .mode = gio_onOutputMode, 46 .done = gio_onOutputDone, 47 .scale = gio_onOutputScale, 48 }; 49 50 const struct wl_seat_listener gio_seat_listener = { 51 .capabilities = gio_onSeatCapabilities, 52 // Cast away const parameter. 53 .name = (void (*)(void *, struct wl_seat *, const char *))gio_onSeatName, 54 }; 55 56 const struct wl_pointer_listener gio_pointer_listener = { 57 .enter = gio_onPointerEnter, 58 .leave = gio_onPointerLeave, 59 .motion = gio_onPointerMotion, 60 .button = gio_onPointerButton, 61 .axis = gio_onPointerAxis, 62 .frame = gio_onPointerFrame, 63 .axis_source = gio_onPointerAxisSource, 64 .axis_stop = gio_onPointerAxisStop, 65 .axis_discrete = gio_onPointerAxisDiscrete, 66 }; 67 68 const struct wl_touch_listener gio_touch_listener = { 69 .down = gio_onTouchDown, 70 .up = gio_onTouchUp, 71 .motion = gio_onTouchMotion, 72 .frame = gio_onTouchFrame, 73 .cancel = gio_onTouchCancel, 74 }; 75 76 const struct wl_keyboard_listener gio_keyboard_listener = { 77 .keymap = gio_onKeyboardKeymap, 78 .enter = gio_onKeyboardEnter, 79 .leave = gio_onKeyboardLeave, 80 .key = gio_onKeyboardKey, 81 .modifiers = gio_onKeyboardModifiers, 82 .repeat_info = gio_onKeyboardRepeatInfo 83 }; 84 85 const struct zwp_text_input_v3_listener gio_zwp_text_input_v3_listener = { 86 .enter = gio_onTextInputEnter, 87 .leave = gio_onTextInputLeave, 88 // Cast away const parameter. 89 .preedit_string = (void (*)(void *, struct zwp_text_input_v3 *, const char *, int32_t, int32_t))gio_onTextInputPreeditString, 90 .commit_string = (void (*)(void *, struct zwp_text_input_v3 *, const char *))gio_onTextInputCommitString, 91 .delete_surrounding_text = gio_onTextInputDeleteSurroundingText, 92 .done = gio_onTextInputDone 93 }; 94 95 const struct wl_data_device_listener gio_data_device_listener = { 96 .data_offer = gio_onDataDeviceOffer, 97 .enter = gio_onDataDeviceEnter, 98 .leave = gio_onDataDeviceLeave, 99 .motion = gio_onDataDeviceMotion, 100 .drop = gio_onDataDeviceDrop, 101 .selection = gio_onDataDeviceSelection, 102 }; 103 104 const struct wl_data_offer_listener gio_data_offer_listener = { 105 .offer = (void (*)(void *, struct wl_data_offer *, const char *))gio_onDataOfferOffer, 106 .source_actions = gio_onDataOfferSourceActions, 107 .action = gio_onDataOfferAction, 108 }; 109 110 const struct wl_data_source_listener gio_data_source_listener = { 111 .target = (void (*)(void *, struct wl_data_source *, const char *))gio_onDataSourceTarget, 112 .send = (void (*)(void *, struct wl_data_source *, const char *, int32_t))gio_onDataSourceSend, 113 .cancelled = gio_onDataSourceCancelled, 114 .dnd_drop_performed = gio_onDataSourceDNDDropPerformed, 115 .dnd_finished = gio_onDataSourceDNDFinished, 116 .action = gio_onDataSourceAction, 117 };