Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Map function keys independently of key group #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.
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.
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.