|
| 1 | +#ifndef STARRAY_JAVA_INPUT_BRIDGE_H |
| 2 | +#define STARRAY_JAVA_INPUT_BRIDGE_H |
| 3 | + |
| 4 | +#include <stdint.h> |
| 5 | + |
| 6 | +#define MODMANAGER_JAVA_INPUT_ABI_VERSION 2 |
| 7 | +#define MODMANAGER_JAVA_INPUT_MAX_POINTERS 32 |
| 8 | +#define MODMANAGER_JAVA_INPUT_MAX_HISTORY_SAMPLES 256 |
| 9 | +#define MODMANAGER_JAVA_INPUT_AXIS_COUNT 64 |
| 10 | + |
| 11 | +typedef struct ModManagerJavaInputPointer { |
| 12 | + int32_t id; |
| 13 | + int32_t tool_type; |
| 14 | + float x; |
| 15 | + float y; |
| 16 | + float raw_x; |
| 17 | + float raw_y; |
| 18 | + float pressure; |
| 19 | + float size; |
| 20 | + float touch_major; |
| 21 | + float touch_minor; |
| 22 | + float tool_major; |
| 23 | + float tool_minor; |
| 24 | + float orientation; |
| 25 | + float tilt; |
| 26 | + float distance; |
| 27 | + float axis_values[MODMANAGER_JAVA_INPUT_AXIS_COUNT]; |
| 28 | +} ModManagerJavaInputPointer; |
| 29 | + |
| 30 | +#pragma pack(push, 4) |
| 31 | +typedef struct ModManagerJavaInputHistorySample { |
| 32 | + int32_t pointer_count; |
| 33 | + int32_t stored_pointer_count; |
| 34 | + int64_t event_time_nanos; |
| 35 | + const ModManagerJavaInputPointer *pointers; |
| 36 | +} ModManagerJavaInputHistorySample; |
| 37 | + |
| 38 | +typedef struct ModManagerJavaInputEvent { |
| 39 | + int32_t struct_size; |
| 40 | + int32_t abi_version; |
| 41 | + int32_t type; |
| 42 | + int32_t is_generic_motion; |
| 43 | + int32_t full_data_included; |
| 44 | + int32_t action; |
| 45 | + int32_t action_index; |
| 46 | + int32_t pointer_count; |
| 47 | + int32_t stored_pointer_count; |
| 48 | + int32_t source; |
| 49 | + int32_t device_id; |
| 50 | + int32_t flags; |
| 51 | + int32_t meta_state; |
| 52 | + int32_t button_state; |
| 53 | + int32_t action_button; |
| 54 | + int32_t key_code; |
| 55 | + int32_t scan_code; |
| 56 | + int32_t repeat_count; |
| 57 | + int32_t unicode_code_point; |
| 58 | + int32_t viewport_width; |
| 59 | + int32_t viewport_height; |
| 60 | + int32_t raw_action; |
| 61 | + int64_t event_time_nanos; |
| 62 | + int64_t down_time_nanos; |
| 63 | + float horizontal_scroll; |
| 64 | + float vertical_scroll; |
| 65 | + int32_t history_sample_count; |
| 66 | + int32_t stored_history_sample_count; |
| 67 | + const ModManagerJavaInputHistorySample *history_samples; |
| 68 | + ModManagerJavaInputPointer pointers[MODMANAGER_JAVA_INPUT_MAX_POINTERS]; |
| 69 | +} ModManagerJavaInputEvent; |
| 70 | +#pragma pack(pop) |
| 71 | + |
| 72 | +typedef void (*ModManagerJavaInputCallback)(const ModManagerJavaInputEvent *event); |
| 73 | + |
| 74 | +#ifdef __cplusplus |
| 75 | +extern "C" { |
| 76 | +#endif |
| 77 | + |
| 78 | +void modmanager_set_java_input_callback(void *callback); |
| 79 | +void modmanager_set_java_input_capture_state(int overlay_visible, |
| 80 | + int capture_mouse, |
| 81 | + int capture_keyboard); |
| 82 | +void modmanager_set_java_input_full_data_enabled(int enabled); |
| 83 | + |
| 84 | +#ifdef __cplusplus |
| 85 | +} |
| 86 | +#endif |
| 87 | + |
| 88 | +#endif |
0 commit comments