#include <gfxprim.h> /* or */ #include <input/gp_event.h> struct gp_event_pos_rel { int32_t rx; int32_t ry; }; struct gp_event_pos_abs { uint32_t x, x_max; /* the x is between 0 and x_max */ uint32_t y, y_max; uint32_t pressure, pressure_max; }; struct gp_event_key { uint32_t key; char ascii; }; struct gp_event_sys { uint32_t w, h; }; struct gp_events_state { /** Bitmap of pressed keys including mouse buttons. */ uint8_t keys_pressed[GP_EVENT_KEY_BITMAP_BYTES]; /** Cursor coordinates */ uint32_t cursor_x; uint32_t cursor_y; }; typedef struct gp_event { /** enum gp_event_type */ uint16_t type; /** enum gp_event_*_code */ uint16_t code; union { /* generic integer value */ int32_t val; /* key */ struct gp_event_key key; /* position */ struct gp_event_pos_rel rel; struct gp_event_pos_abs abs; /* system event */ struct gp_event_sys sys; /* timer event */ gp_timer *tmr; }; /* event timestamp */ struct timeval time; /* overall accumulated state, pressed keys, cursor, etc. */ gp_events_state *st; } gp_event;