diff --git a/src/input.h b/src/input.h index 825904a..f1fdf72 100644 --- a/src/input.h +++ b/src/input.h @@ -54,11 +54,13 @@ struct kmscon_input; +#define KMSCON_INPUT_INVALID 0xffffffff + struct kmscon_input_event { uint16_t keycode; /* linux keycode - KEY_* - linux/input.h */ uint32_t keysym; /* X keysym - XK_* - X11/keysym.h */ uint8_t modifiers; /* xkbcommon modifiers - XKB_COMMON_*_MASK */ - uint32_t unicode; /* UCS-4 unicode value, 0 if none */ + uint32_t unicode; /* UCS-4 unicode value or KMSCON_INPUT_INVALID */ }; typedef void (*kmscon_input_cb) (struct kmscon_input *input, diff --git a/src/input_xkb.c b/src/input_xkb.c index 9eddc31..8a28c4a 100644 --- a/src/input_xkb.c +++ b/src/input_xkb.c @@ -704,6 +704,9 @@ bool kmscon_xkb_process_evdev_key(struct xkb_desc *desc, out->modifiers = state->mods; out->unicode = KeysymToUcs4(sym); + if (out->unicode == 0) + out->unicode = KMSCON_INPUT_INVALID; + event_filled = true; } diff --git a/tests/test_input.c b/tests/test_input.c index f5523ac..3bda398 100644 --- a/tests/test_input.c +++ b/tests/test_input.c @@ -90,7 +90,7 @@ static void input_arrived(struct kmscon_input *input, char s[16]; char utf8[MB_CUR_MAX + 1]; - if (ev->unicode == 0) { + if (ev->unicode == KMSCON_INPUT_INVALID) { xkb_keysym_to_string(ev->keysym, s, sizeof(s)); printf("sym %s ", s); } else {