From 75c8fb0a3f817dfbcb04e73f0b43ba9d38456fb4 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Wed, 29 Jun 2022 22:50:53 -0400 Subject: keyboard: Progressively allocate remainder pixels So the keyboard always fills the width of the screen, and the width is distributed evenly --- keyboard.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'keyboard.c') diff --git a/keyboard.c b/keyboard.c index bfdfdc9..2b1506a 100644 --- a/keyboard.c +++ b/keyboard.c @@ -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++; } -- cgit 1.4.1