-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keymap: add xkb_keymap_keyname_get_keycode() #29
Conversation
Would it be possible to do a release after merging this? |
This is indeed a lacuna in the API, so makes sense to add. Some comments:
Thanks. |
return key->keycode; | ||
} | ||
|
||
name = XkbResolveKeyAlias(keymap, name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to canonicalize the name first, then do just one loop. An alias cannot conflict with a canonical name, so the result is the same.
I tried adding a simple test (https://gist.github.com/zmike/88daf2a29a7b6d5d4987), but the first call fails and XKB_KEYCODE_INVALID is returned. Seems unexpected; did I do something wrong in the implementation? |
The problem with the test is that there is no key with the name "9". You can check And two more comments :)
Thanks! |
Okay, I've added a separate test using a keyname from the evdev keycodes file, but it's still failing. |
Ah, and I'll squash after everything is resolved. |
Nevermind, user error. Squashing... |
xkb_keymap_key_by_name() allows finding a keycode from a given keyname and is useful for generating keyboard events to use in regression tests during CI xkb_keymap_key_get_name() is the inverse of xkb_keymap_key_by_name() Signed-off-by: Mike Blumenkrantz <[email protected]>
Should be all done now. |
I made some tiny tweaks and pushed, thanks. A release is definitely overdue, I'll prepare one. @fooishbar what do you about making this one 1.0.0? I think it's about time :) |
this function allows finding a keycode from a given keyname and
is useful for generating keyboard events to use in regression tests
during CI
Signed-off-by: Mike Blumenkrantz [email protected]