mirror of
https://github.com/glfw/glfw.git
synced 2024-11-14 14:33:52 +00:00
Wayland: Clean up key translation
Adapt style and naming to match the rest of the project.
(cherry picked from commit 0ce611958e
)
This commit is contained in:
parent
e155c19f8e
commit
c68ad09c04
@ -503,10 +503,10 @@ static void keyboardHandleLeave(void* data,
|
|||||||
_glfwInputWindowFocus(window, GLFW_FALSE);
|
_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]))
|
if (scancode < sizeof(_glfw.wl.keycodes) / sizeof(_glfw.wl.keycodes[0]))
|
||||||
return _glfw.wl.keycodes[key];
|
return _glfw.wl.keycodes[scancode];
|
||||||
|
|
||||||
return GLFW_KEY_UNKNOWN;
|
return GLFW_KEY_UNKNOWN;
|
||||||
}
|
}
|
||||||
@ -562,7 +562,7 @@ static void keyboardHandleKey(void* data,
|
|||||||
if (!window)
|
if (!window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const int key = toGLFWKeyCode(scancode);
|
const int key = translateKey(scancode);
|
||||||
const int action =
|
const int action =
|
||||||
state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;
|
state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user