#ifndef GEMINUX_TOUCH_GESTURE_H #define GEMINUX_TOUCH_GESTURE_H #include #include #define GEMINUX_MAX_TOUCHES 10 #define GEMINUX_MULTITOUCH_GRACE_MS 45 #define GEMINUX_LONGPRESS_MS 500 #define GEMINUX_TAP_2F_MS 320 #define GEMINUX_TAP_3F_MS 360 #define GEMINUX_MOVE_THRESH_PX 32.0 #define GEMINUX_TAP_2F_THRESH_PX 44.0 #define GEMINUX_TAP_3F_THRESH_PX 56.0 #define GEMINUX_SCROLL_DEADZONE_PX 18.0 #define GEMINUX_SCROLL_STEP_Y_PX 44.0 #define GEMINUX_SCROLL_STEP_X_PX 56.0 enum { GEMINUX_ALLOW_NONE = 0, GEMINUX_ALLOW_REJECT = 1, GEMINUX_ALLOW_ACCEPT = 2 }; typedef enum { GESTURE_IDLE = 0, GESTURE_PENDING_1F, GESTURE_PASSTHROUGH_1F, GESTURE_ACCEPTED_1F_HOLD, GESTURE_ACCEPTED_MULTI } geminux_gesture_phase_t; typedef struct { bool active; bool decided; int devid; unsigned int touchid; double x0; double y0; double x; double y; } geminux_touch_slot_t; typedef struct { int devid; unsigned int touchid; int allow_mode; } geminux_touch_decision_t; typedef struct { geminux_touch_decision_t decisions[GEMINUX_MAX_TOUCHES]; int decision_count; int click_button; int wheel_v; int wheel_h; double pointer_x; double pointer_y; int next_timer_ms; } geminux_gesture_action_t; typedef struct { geminux_gesture_phase_t phase; bool natural_scroll; geminux_touch_slot_t slots[GEMINUX_MAX_TOUCHES]; int active_count; int max_fingers; uint64_t seq_start_ms; bool scrolled; bool centroid_valid; double max_disp; double anchor_x; double anchor_y; double start_cx; double start_cy; double last_cx; double last_cy; double accum_dx; double accum_dy; } geminux_gesture_state_t; void geminux_gesture_init(geminux_gesture_state_t *st, bool natural_scroll); void geminux_gesture_on_begin(geminux_gesture_state_t *st, int devid, unsigned int touchid, double x, double y, uint64_t now_ms, geminux_gesture_action_t *out); void geminux_gesture_on_update(geminux_gesture_state_t *st, int devid, unsigned int touchid, double x, double y, uint64_t now_ms, geminux_gesture_action_t *out); void geminux_gesture_on_end(geminux_gesture_state_t *st, int devid, unsigned int touchid, double x, double y, uint64_t now_ms, geminux_gesture_action_t *out); void geminux_gesture_on_timer(geminux_gesture_state_t *st, uint64_t now_ms, geminux_gesture_action_t *out); #endif