mirror of
https://github.com/glfw/glfw.git
synced 2026-09-17 22:32:50 +00:00
Cleanup
Clean up code and documentation for glfwGetKeyScancode and add implementation for Wayland and Mir. Related to #830.
This commit is contained in:
+1
-6
@@ -1511,13 +1511,8 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
return _glfw.ns.keyName;
|
||||
}
|
||||
|
||||
const short int _glfwPlatformGetKeyScancode(int key)
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
{
|
||||
if(key <= -1 || key >= (sizeof(_glfw.ns.nativeKeys) / sizeof(_glfw.ns.nativeKeys[0])))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _glfw.ns.nativeKeys[key];
|
||||
}
|
||||
|
||||
|
||||
+8
-1
@@ -256,9 +256,16 @@ GLFWAPI const char* glfwGetKeyName(int key, int scancode)
|
||||
return _glfwPlatformGetKeyName(key, scancode);
|
||||
}
|
||||
|
||||
GLFWAPI const short int glfwGetKeyScancode(int key)
|
||||
GLFWAPI int glfwGetKeyScancode(int key)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(-1);
|
||||
|
||||
if (key < GLFW_KEY_SPACE || key > GLFW_KEY_LAST)
|
||||
{
|
||||
_glfwInputError(GLFW_INVALID_ENUM, "Invalid key %i", key);
|
||||
return GLFW_RELEASE;
|
||||
}
|
||||
|
||||
return _glfwPlatformGetKeyScancode(key);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -545,7 +545,7 @@ const char* _glfwPlatformGetKeyName(int key, int scancode);
|
||||
/*! @copydoc glfwGetKeyScancode
|
||||
* @ingroup platform
|
||||
*/
|
||||
const short int _glfwPlatformGetKeyScancode(int key);
|
||||
int _glfwPlatformGetKeyScancode(int key);
|
||||
|
||||
/*! @copydoc glfwGetMonitors
|
||||
* @ingroup platform
|
||||
|
||||
+2
-4
@@ -744,11 +744,9 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int _glfwPlatformGetKeyScancode(int key)
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_ERROR,
|
||||
"Mir: Unsupported function %s", __PRETTY_FUNCTION__);
|
||||
return NULL;
|
||||
return _glfw.mir.nativeKeys[key];
|
||||
}
|
||||
|
||||
void _glfwPlatformSetClipboardString(_GLFWwindow* window, const char* string)
|
||||
|
||||
+1
-6
@@ -1511,13 +1511,8 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
return _glfw.win32.keyName;
|
||||
}
|
||||
|
||||
const short int _glfwPlatformGetKeyScancode(int key)
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
{
|
||||
if(key <= -1 || key >= (sizeof(_glfw.win32.nativeKeys) / sizeof(_glfw.win32.nativeKeys[0])))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _glfw.win32.nativeKeys[key];
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -686,10 +686,9 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const int _glfwPlatformGetKeyScancode(int key)
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
{
|
||||
// TODO
|
||||
return -1;
|
||||
return _glfw.wl.nativeKeys[key];
|
||||
}
|
||||
|
||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||
|
||||
+1
-6
@@ -2186,13 +2186,8 @@ const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
return _glfw.x11.keyName;
|
||||
}
|
||||
|
||||
const short int _glfwPlatformGetKeyScancode(int key)
|
||||
int _glfwPlatformGetKeyScancode(int key)
|
||||
{
|
||||
if(key <= -1 || key >= (sizeof(_glfw.x11.nativeKeys) / sizeof(_glfw.x11.nativeKeys[0])))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return _glfw.x11.nativeKeys[key];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user