-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Map function keys independently of key group #1598
Conversation
X11: Fix bug that mapped all function keys to GLFW_KEY_UNKNOWN
Also, this bug is not present in the latest release. |
Do you mean that this bug is present in |
Syncing with upstream glfw
After running Lines 670 to 676 in fe57e3c
This is related to issue #1462, because I have an English QWERTY keyboard layout and also an Arabic QWERTY layout on my system (this may be why you couldn't reproduce it). The issue is the function keys are only on group 0. My Arabic layout is group 0 while my English layout is group 1. So the function keys only work if I start the program in Arabic layout. If I then switch to English layout while the program is running, it still works, but it's very inconvenient. This bug is reproducible in master as well as in GLFW 3.3.1. Over here: Lines 256 to 262 in fe57e3c
Since it's assigning ASCII keys here and they return the native character in the current keyboard layout, it would be simpler to assign the function keys there too. The function key names I added in my PR were taken from the evdev key-codes list and I tested all of them. |
Successfully reproduced on Cygwin/X running MATE with the default Arabic layout. |
This is a good PR but I cannot merge the removal of the non-XKB code as-is because that path can still be chosen if the XKB extension is unavailable, which would leave all keys unknown. We should either keep the whole fallback path or go all-in and require XKB at init. The Do these changes seem reasonable? |
Good point. We should keep the code that GLFW falls back to if XKB isn't available. I believe the changes in the |
This has been merged as a41a58a. Thank you for the fix and your patience through all the delays. |
This fixes the issue where function keys would be reported as GLFW_KEY_UNKNOWN if XKB was available and one of the configured keyboard layouts was Arabic. This is only part of #1598, because the full patch removed parts of the fallback path for when XKB is unavailable. Closes #1598. (cherry picked from commit a41a58a)
b25ee39 is an important bug fix. May I ask that it be released in 3.3.3 so that Linux distributions pick it up? |
Related to glfw#1598.
XkbKeycodeToKeysym in function translateKeyCode in x11_init.c is returning keySym value of -1 when called with the key's scancode. This causes all function and numpad keys to be mapped to GLFW_KEY_UNKNOWN.
Printable keys register correctly because they are mapped explicitly, so I mapped the other keys like that too. There is no reason to use translateKeyCode now.