summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--xkbcat.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/xkbcat.c b/xkbcat.c
index c56cce0..5e28cc2 100644
--- a/xkbcat.c
+++ b/xkbcat.c
@@ -125,7 +125,20 @@ int main(int argc, char * argv[]) {
// regardless of what modifiers are held down.
KeySym s = XkbKeycodeToKeysym(
disp, ev->detail, group, 0 /*shift level*/);
- if (NoSymbol == s) continue;
+
+ // Non-zero keysym groups are "overlays" on the base (`0`)
+ // group. If the current group has no keysym for this
+ // keycode, defer to the base group instead. (This usually
+ // happens with common shared keys like Return, Backspace,
+ // or numeric keypad keys.)
+ if (NoSymbol == s) {
+ if (group == 0) continue;
+ else {
+ s = XkbKeycodeToKeysym(disp, ev->detail,
+ 0 /* base group */, 0 /*shift level*/);
+ if (NoSymbol == s) continue;
+ }
+ }
char *str = XKeysymToString(s);
if (NULL == str) continue;