Interactive tools: always print keycode

master
Pierre Le Marre 2023-09-18 12:06:45 +02:00 committed by Wismill
parent 44029221e8
commit c23c6bb996
1 changed files with 13 additions and 0 deletions

View File

@ -50,6 +50,17 @@
#include "tools-common.h"
static void
print_keycode(struct xkb_keymap *keymap, const char* prefix,
xkb_keycode_t keycode, const char *suffix) {
const char *keyname = xkb_keymap_key_get_name(keymap, keycode);
if (keyname) {
printf("%s%-4s%s", prefix, keyname, suffix);
} else {
printf("%s%-4d%s", prefix, keycode, suffix);
}
}
void
tools_print_keycode_state(struct xkb_state *state,
struct xkb_compose_state *compose_state,
@ -89,6 +100,8 @@ tools_print_keycode_state(struct xkb_state *state,
syms = &sym;
}
print_keycode(keymap, "keycode [ ", keycode, " ] ");
printf("keysyms [ ");
for (int i = 0; i < nsyms; i++) {
xkb_keysym_get_name(syms[i], s, sizeof(s));