1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Wayland: Clean up text input

Adapt style and naming to match the rest of the project.
This commit is contained in:
Camilla Löwy 2021-12-30 19:49:06 +01:00
parent fe7be39793
commit b70259e52d

View File

@ -542,23 +542,19 @@ static xkb_keysym_t composeSymbol(xkb_keysym_t sym)
} }
#endif #endif
static GLFWbool inputChar(_GLFWwindow* window, uint32_t key) static GLFWbool inputChar(_GLFWwindow* window, uint32_t scancode)
{ {
uint32_t code, numSyms, codepoint; const xkb_keysym_t* keysyms;
const xkb_keysym_t *syms; const xkb_keycode_t keycode = scancode + 8;
xkb_keysym_t sym;
code = key + 8; if (xkb_state_key_get_syms(_glfw.wl.xkb.state, keycode, &keysyms) == 1)
numSyms = xkb_state_key_get_syms(_glfw.wl.xkb.state, code, &syms);
if (numSyms == 1)
{ {
#ifdef HAVE_XKBCOMMON_COMPOSE_H #ifdef HAVE_XKBCOMMON_COMPOSE_H
sym = composeSymbol(syms[0]); const xkb_keysym_t keysym = composeSymbol(keysyms[0]);
#else #else
sym = syms[0]; const xkb_keysym_t keysym = keysyms[0];
#endif #endif
codepoint = _glfwKeySym2Unicode(sym); const uint32_t codepoint = _glfwKeySym2Unicode(keysym);
if (codepoint != GLFW_INVALID_CODEPOINT) if (codepoint != GLFW_INVALID_CODEPOINT)
{ {
const int mods = _glfw.wl.xkb.modifiers; const int mods = _glfw.wl.xkb.modifiers;
@ -567,7 +563,7 @@ static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
} }
} }
return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, code); return xkb_keymap_key_repeats(_glfw.wl.xkb.keymap, keycode);
} }
static void keyboardHandleKey(void* data, static void keyboardHandleKey(void* data,