From e12a58c1f0cd48cc1abd14630e4d44152e810948 Mon Sep 17 00:00:00 2001 From: Lephenixnoir Date: Wed, 4 Sep 2024 08:56:04 +0200 Subject: [PATCH] jfkeys: parameterize width to better fit on fx-CP display --- src/jfkeys.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/jfkeys.c b/src/jfkeys.c index 21b4380..2266925 100644 --- a/src/jfkeys.c +++ b/src/jfkeys.c @@ -117,8 +117,11 @@ static void jfkeys_poly_render(void *f0, int base_x, int y) if(!text || (*text != '.' && *text != '/' && *text != '@' && *text != '#')) continue; - int x = base_x + 4 + 65 * position; - int w = 63; + int fw = jwidget_full_width(f); + int margin = (fw >= 250 ? 4 : 2); + int spacing = 2; + int w = (fw - 2 * margin - 5 * spacing) / 6; + int x = base_x + margin + (w + spacing) * position; int color = (text[0] == '#') ? f->text_special_color : f->text_color; if(text[0] == '.') {