Wayland: Clean up key translation

Adapt style and naming to match the rest of the project.
This commit is contained in:
Camilla Löwy 2021-12-31 00:19:08 +01:00
parent 1a7da42e6e
commit 0ce611958e

View File

@ -507,10 +507,10 @@ static void keyboardHandleLeave(void* data,
_glfwInputWindowFocus(window, GLFW_FALSE);
}
static int toGLFWKeyCode(uint32_t key)
static int translateKey(uint32_t scancode)
{
if (key < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
return _glfw.wl.keycodes[key];
if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
return _glfw.wl.keycodes[scancode];
return GLFW_KEY_UNKNOWN;
}
@ -566,7 +566,7 @@ static void keyboardHandleKey(void* data,
if (!window)
return;
const int key = toGLFWKeyCode(scancode);
const int key = translateKey(scancode);
const int action =
state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;