libs/justui: add custom keymap test

This commit is contained in:
Lephenixnoir 2024-03-24 09:01:33 +01:00
parent 32ffebacda
commit 15757c40c7
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 9 additions and 4 deletions

View File

@ -77,6 +77,14 @@ static void table_gen(gtable *t, int row)
gtable_provide(t, c1, c2, c3);
}
static uint32_t keymap_function(int key, bool shift, bool alpha)
{
if(key == KEY_7 && shift)
return '@';
else
return keymap_translate(key, shift, alpha);
}
/* gintctl_libs_justui(): Just User Interfaces */
void gintctl_libs_justui(void)
{
@ -113,6 +121,7 @@ void gintctl_libs_justui(void)
jinput *input = jinput_create("Prompt:" _(," "), 12, tab1);
jwidget_set_stretch(input, 1, 0, false);
jinput_set_font(input, _(&font_uf5x7, dfont_default()));
jinput_set_keymap_function(input, keymap_function);
// Widget tree visualisation
@ -163,10 +172,6 @@ void gintctl_libs_justui(void)
if(key == KEY_F1) gscreen_show_tab(scr, 0);
if(key == KEY_F2) gscreen_show_tab(scr, 1);
#ifdef FX9860G
if(key == KEY_F6) screen_mono(u"\\\\fls0\\justui.bin");
#endif
}
gscreen_destroy(scr);