#ifndef __KEYBOARD_H #define __KEYBOARD_H #include "drw.h" #define MAX_LAYERS 25 struct clr_scheme; struct key; struct kbd; enum key_draw_type { Unpress = 0, Press, Swipe, }; struct clr_scheme { Color fg; Color bg; Color high; Color swipe; Color text; }; struct key { char *label; // actual coordinates on the surface (pixels), will be computed automatically // for all keys uint32_t x, y, w, h; }; struct kbd { bool debug; struct clr_scheme scheme; uint32_t w, h, s; bool landscape; uint8_t mods; uint8_t compose; struct key *last_press; struct key suggs[64]; struct drwsurf *surf; }; void draw_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t border, Color color); void draw_over_inset(struct drwsurf *ds, uint32_t x, uint32_t y, uint32_t width, uint32_t height, uint32_t border, Color color); void kbd_init(struct kbd *kb); void kbd_init_suggs(struct key *suggs, uint32_t width, uint32_t height); struct key *kbd_get_key(struct kbd *kb, uint32_t x, uint32_t y); void kbd_unpress_key(struct kbd *kb); void kbd_release_key(struct kbd *kb); void kbd_motion_key(struct kbd *kb, uint32_t x, uint32_t y); void kbd_press_key(struct kbd *kb, struct key *k); void kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type); void kbd_draw_layout(struct kbd *kb); void kbd_resize(struct kbd *kb); double kbd_get_row_length(struct key *k); #endif