event.h (1385B)
1 #ifndef LTK_EVENT_H 2 #define LTK_EVENT_H 3 4 #include "eventdefs.h" 5 6 typedef struct { 7 ltk_event_type type; 8 ltk_button_type button; 9 int x, y; 10 } ltk_button_event; 11 12 typedef struct { 13 ltk_event_type type; 14 int x, y; 15 int dx, dy; 16 } ltk_scroll_event; 17 18 typedef struct { 19 ltk_event_type type; 20 int x, y; 21 } ltk_motion_event; 22 23 typedef struct { 24 ltk_event_type type; 25 ltk_mod_type modmask; 26 ltk_keysym sym; 27 char *text; 28 char *mapped; 29 } ltk_key_event; 30 31 typedef struct { 32 ltk_event_type type; 33 char *new_kbd; 34 } ltk_keyboard_event; 35 36 typedef struct { 37 ltk_event_type type; 38 int x, y; 39 int w, h; 40 } ltk_configure_event; 41 42 /* FIXME: should maybe be handled in backend with double buffering */ 43 typedef struct { 44 ltk_event_type type; 45 int x, y; 46 int w, h; 47 } ltk_expose_event; 48 49 typedef union { 50 ltk_event_type type; 51 ltk_button_event button; 52 ltk_scroll_event scroll; 53 ltk_motion_event motion; 54 ltk_key_event key; 55 ltk_configure_event configure; 56 ltk_expose_event expose; 57 ltk_keyboard_event keyboard; 58 } ltk_event; 59 60 #include "ltk.h" 61 #include "clipboard.h" 62 63 void ltk_events_cleanup(void); 64 /* WARNING: Text returned in key and keyboard events must be copied before calling this function again! */ 65 int ltk_next_event(ltk_renderdata *renderdata, ltk_clipboard *clip, size_t lang_index, ltk_event *event); 66 void ltk_generate_keyboard_event(ltk_renderdata *renderdata, ltk_event *event); 67 68 #endif /* LTK_EVENT_H */