From 8c5471d6cdc6d87935e494b8c379f659e998bcf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Fri, 1 Dec 2023 13:22:11 +0100 Subject: [PATCH] Fix return value on error for glfwGetKeyScancode The documentation says it should be -1, not zero. --- README.md | 1 + src/input.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d0a40c34..797ffd17 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ information on what to include when reporting a bug. - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) + - Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1` - [Win32] Added the `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu - [Win32] Added a version info resource to the GLFW DLL diff --git a/src/input.c b/src/input.c index 36128e10..8c1bb7ef 100644 --- a/src/input.c +++ b/src/input.c @@ -721,7 +721,7 @@ GLFWAPI int glfwGetKeyScancode(int key) if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST) { _glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key); - return GLFW_RELEASE; + return -1; } return _glfw.platform.getKeyScancode(key);