suggestion picker: a persistent layer to complement virtual keyboards like wvkbd
Diffstat (limited to 'keyboard.c')
| -rw-r--r-- | keyboard.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -29,11 +29,16 @@ kbd_init_suggs(struct key *suggs, uint32_t width, uint32_t height) { struct key *k = suggs; double rowlength = kbd_get_row_length(k); + uint8_t i = 0; while (k->label != NULL) { k->x = x; k->y = y; k->w = width / rowlength; x += k->w; + i++; + if (x < (width * i) / rowlength) { + k->w++; x++; + } k->h = keyheight; k++; } @@ -68,6 +73,7 @@ kbd_unpress_key(struct kbd *kb) { if (kb->last_press) { kbd_draw_key(kb, kb->last_press, Unpress); kb->last_press = NULL; + drwsurf_flip(kb->surf); } } @@ -78,7 +84,6 @@ kbd_release_key(struct kbd *kb) { // Important so autocompleted words get typed in time fflush(stdout); kbd_unpress_key(kb); - kbd_draw_layout(kb); } } @@ -99,6 +104,7 @@ kbd_press_key(struct kbd *kb, struct key *k) { if (k->label) { kb->last_press = k; kbd_draw_key(kb, k, Press); + drwsurf_flip(kb->surf); } } |