mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Improve error description for invalid scancodes
This commit is contained in:
parent
3dc7349c35
commit
56092814f3
@ -1536,7 +1536,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.ns.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -524,6 +524,12 @@ const char* _glfwPlatformGetClipboardString(void)
|
||||
|
||||
const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
{
|
||||
if (scancode < GLFW_KEY_SPACE || scancode > GLFW_KEY_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (scancode)
|
||||
{
|
||||
case GLFW_KEY_APOSTROPHE:
|
||||
|
@ -2108,7 +2108,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
if (scancode < 0 || scancode > (KF_EXTENDED | 0xff) ||
|
||||
_glfw.win32.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2891,7 +2891,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
|
||||
if (scancode < 0 || scancode > 0xff ||
|
||||
_glfw.x11.keycodes[scancode] == GLFW_KEY_UNKNOWN)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode");
|
||||
_glfwInputError(GLFW_INVALID_VALUE, "Invalid scancode %i", scancode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user