Unify key name string handling

This makes key names per-key static strings for all supported platforms.

Fixes #1200.

(cherry picked from commit 56ca0cb3b3)
This commit is contained in:
Camilla Löwy
2019-08-22 21:31:46 +02:00
parent 2032a8f0dc
commit 79f4ec6822
5 changed files with 16 additions and 11 deletions
+4 -3
View File
@@ -2792,6 +2792,7 @@ const char* _glfwPlatformGetScancodeName(int scancode)
if (!_glfw.x11.xkb.available)
return NULL;
const int key = _glfw.x11.keycodes[scancode];
const KeySym keysym = XkbKeycodeToKeysym(_glfw.x11.display,
scancode, _glfw.x11.xkb.group, 0);
if (keysym == NoSymbol)
@@ -2801,12 +2802,12 @@ const char* _glfwPlatformGetScancodeName(int scancode)
if (ch == -1)
return NULL;
const size_t count = encodeUTF8(_glfw.x11.keyName, (unsigned int) ch);
const size_t count = encodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch);
if (count == 0)
return NULL;
_glfw.x11.keyName[count] = '\0';
return _glfw.x11.keyName;
_glfw.x11.keynames[key][count] = '\0';
return _glfw.x11.keynames[key];
}
int _glfwPlatformGetKeyScancode(int key)