#ifndef COMET_EVENT_H #define COMET_EVENT_H #include "window.h" #include "layout.h" typedef struct layout layout_t; typedef enum { EVENT_TRIGGER, EVENT_LEFT_CLICK, EVENT_MIDDLE_CLICK, EVENT_RIGHT_CLICK, EVENT_SCROLL_UP, EVENT_SCROLL_DOWN, EVENT_HOVER_START, EVENT_HOVER_MOVE, EVENT_HOVER_STOP, EVENT_MAX, } event_type_t; typedef struct { event_type_t type; union { struct { const char *origin; const char *payload; } trigger; struct { int x; int y; } mouse; }; } event_t; typedef struct { layout_t hovered; int hover_x, hover_y; layout_t *layout; config_t *config; } event_state_t; const char *event_type_to_string(event_type_t type); void event_init_trigger(event_t *event, const char *origin, const char *payload); void event_init_mouse(event_t *event, event_type_t type, int x, int y); bool event_is_trigger(event_t event); bool event_is_mouse(event_t event); bool event_is_click(event_t event); bool event_is_scroll(event_t event); bool event_is_hover(event_t event); void event_dispatch(event_state_t *state, window_t *window); #endif