mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-07-12 22:14:32 +02:00
layout: Implement spacing better
to no longer need overscan Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
This commit is contained in:
committed by
Maarten van Gompel
parent
1843e60a74
commit
0cd0d5e1a1
@ -122,16 +122,23 @@ kbd_init_layout(struct layout *l, uint32_t width, uint32_t height) {
|
||||
|
||||
struct key *k = l->keys;
|
||||
double rowlength = kbd_get_row_length(k);
|
||||
double rowwidth = 0.0;
|
||||
while (k->type != Last) {
|
||||
if (k->type == EndRow) {
|
||||
y += l->keyheight;
|
||||
x = 0;
|
||||
rowwidth = 0.0;
|
||||
rowlength = kbd_get_row_length(k + 1);
|
||||
} else if (k->width > 0) {
|
||||
k->x = x;
|
||||
k->y = y;
|
||||
k->w = ((double)width / rowlength) * k->width;
|
||||
x += k->w;
|
||||
rowwidth += k->width;
|
||||
if (x < (rowwidth / rowlength) * (double)width) {
|
||||
k->w++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
k->h = l->keyheight;
|
||||
k++;
|
||||
|
Reference in New Issue
Block a user