1 #ifndef H_LY_INPUTS 2 #define H_LY_INPUTS 3 4 #include "termbox.h" 5 #include "ctypes.h" 6 7 enum display_server {DS_WAYLAND, DS_SHELL, DS_XINITRC, DS_XORG}; 8 9 struct text 10 { 11 char* text; 12 char* end; 13 i64 len; 14 char* cur; 15 char* visible_start; 16 u16 visible_len; 17 18 u16 x; 19 u16 y; 20 }; 21 22 struct desktop 23 { 24 char** list; 25 char** cmd; 26 enum display_server* display_server; 27 28 u16 cur; 29 u16 len; 30 u16 visible_len; 31 u16 x; 32 u16 y; 33 }; 34 35 void handle_desktop(void* input_struct, struct tb_event* event); 36 void handle_text(void* input_struct, struct tb_event* event); 37 void input_desktop(struct desktop* target); 38 void input_text(struct text* target, u64 len); 39 void input_desktop_free(struct desktop* target); 40 void input_text_free(struct text* target); 41 void input_desktop_right(struct desktop* target); 42 void input_desktop_left(struct desktop* target); 43 void input_desktop_add( 44 struct desktop* target, 45 char* name, 46 char* cmd, 47 enum display_server display_server); 48 void input_text_right(struct text* target); 49 void input_text_left(struct text* target); 50 void input_text_write(struct text* target, char ascii); 51 void input_text_delete(struct text* target); 52 void input_text_backspace(struct text* target); 53 void input_text_clear(struct text* target); 54 55 #endif 56