mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 13:04:35 +00:00
Replace XkbGetKeyboard with XkbGetMap
Switch to XkbGetMap as XkbGetKeyboard returns NULL on XWayland. Fixes #389.
This commit is contained in:
parent
b69b4a9f2a
commit
2d39dff84a
@ -94,6 +94,7 @@ GLFW bundles a number of dependencies in the `deps/` directory.
|
||||
- [X11] Bugfix: The `GLFW_DECORATED` hint was not ignored for full screen
|
||||
- [X11] Bugfix: `glfwWaitEvents` did not handle `EINTR` for `select`
|
||||
- [X11] Bugfix: `glfwWaitEvents` could return when no events were available
|
||||
- [X11] Bugfix: `XkbGetKeyboard` fails on XWayland
|
||||
- [WGL] Made all WGL functions dynamically loaded
|
||||
- [WGL] Removed `GLFW_USE_DWM_SWAP_INTERVAL` compile-time option
|
||||
- [WGL] Bugfix: Swap interval was ignored when DWM was enabled
|
||||
|
@ -241,15 +241,14 @@ static void createKeyTables(void)
|
||||
// keyboard layout
|
||||
|
||||
char name[XkbKeyNameLength + 1];
|
||||
XkbDescPtr descr = XkbGetKeyboard(_glfw.x11.display,
|
||||
XkbAllComponentsMask,
|
||||
XkbUseCoreKbd);
|
||||
XkbDescPtr desc = XkbGetMap(_glfw.x11.display, 0, XkbUseCoreKbd);
|
||||
XkbGetNames(_glfw.x11.display, XkbKeyNamesMask, desc);
|
||||
|
||||
// Find the X11 key code -> GLFW key code mapping
|
||||
for (scancode = descr->min_key_code; scancode <= descr->max_key_code; scancode++)
|
||||
for (scancode = desc->min_key_code; scancode <= desc->max_key_code; scancode++)
|
||||
{
|
||||
memcpy(name, descr->names->keys[scancode].name, XkbKeyNameLength);
|
||||
name[XkbKeyNameLength] = 0;
|
||||
memcpy(name, desc->names->keys[scancode].name, XkbKeyNameLength);
|
||||
name[XkbKeyNameLength] = '\0';
|
||||
|
||||
// Map the key name to a GLFW key code. Note: We only map printable
|
||||
// keys here, and we use the US keyboard layout. The rest of the
|
||||
@ -309,7 +308,8 @@ static void createKeyTables(void)
|
||||
_glfw.x11.publicKeys[scancode] = key;
|
||||
}
|
||||
|
||||
XkbFreeKeyboard(descr, 0, True);
|
||||
XkbFreeNames(desc, XkbKeyNamesMask, True);
|
||||
XkbFreeClientMap(desc, 0, True);
|
||||
}
|
||||
|
||||
// Translate the un-translated key codes using traditional X11 KeySym
|
||||
|
Loading…
Reference in New Issue
Block a user