From 7e0ca6705b0a687a15acde6a90b908f5b6f138d6 Mon Sep 17 00:00:00 2001 From: Hanmac Date: Tue, 31 Jan 2012 10:00:52 +0100 Subject: [PATCH] Added use of XkbKeycodeToKeysym when Xkb is available. --- src/x11_init.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/x11_init.c b/src/x11_init.c index 4d3c0f74..3ed9ab13 100644 --- a/src/x11_init.c +++ b/src/x11_init.c @@ -79,7 +79,11 @@ static int keyCodeToGLFWKeyCode(int keyCode) // Note: This way we always force "NumLock = ON", which is intentional // since the returned key code should correspond to a physical // location. +#if defined(_GLFW_HAS_XKB) + keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1, 0); +#else keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 1); +#endif switch (keySym) { case XK_KP_0: return GLFW_KEY_KP_0; @@ -102,7 +106,12 @@ static int keyCodeToGLFWKeyCode(int keyCode) // Now try pimary keysym for function keys (non-printable keys). These // should not be layout dependent (i.e. US layout and international // layouts should give the same result). +#if defined(_GLFW_HAS_XKB) + keySym = XkbKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0, 0); +#else keySym = XKeycodeToKeysym(_glfwLibrary.X11.display, keyCode, 0); +#endif + switch (keySym) { case XK_Escape: return GLFW_KEY_ESCAPE;