mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 08:50:15 +00:00
@@ -1939,6 +1939,34 @@ void _glfwPlatformSetCursorMode(_GLFWwindow* window, int mode)
|
||||
}
|
||||
}
|
||||
|
||||
const char* _glfwPlatformGetKeyName(int key, int scancode)
|
||||
{
|
||||
KeySym keysym;
|
||||
int extra;
|
||||
|
||||
if (!_glfw.x11.xkb.available)
|
||||
return NULL;
|
||||
|
||||
if (key != GLFW_KEY_UNKNOWN)
|
||||
scancode = _glfw.x11.nativeKeys[key];
|
||||
|
||||
if (!_glfwIsPrintable(_glfw.x11.publicKeys[scancode]))
|
||||
return NULL;
|
||||
|
||||
keysym = XkbKeycodeToKeysym(_glfw.x11.display, scancode, 0, 0);
|
||||
if (keysym == NoSymbol)
|
||||
return NULL;
|
||||
|
||||
XkbTranslateKeySym(_glfw.x11.display, &keysym, 0,
|
||||
_glfw.x11.keyName, sizeof(_glfw.x11.keyName),
|
||||
&extra);
|
||||
|
||||
if (!strlen(_glfw.x11.keyName))
|
||||
return NULL;
|
||||
|
||||
return _glfw.x11.keyName;
|
||||
}
|
||||
|
||||
int _glfwPlatformCreateCursor(_GLFWcursor* cursor,
|
||||
const GLFWimage* image,
|
||||
int xhot, int yhot)
|
||||
|
||||
Reference in New Issue
Block a user