Clean up internal Unicode code point handling

Call code points by their name and store them as uint32_t.

(cherry picked from commit fe7be39793)
This commit is contained in:
Camilla Löwy
2021-12-30 19:09:53 +01:00
parent 1f7ce12cbc
commit 5066f57371
9 changed files with 43 additions and 42 deletions
+4 -5
View File
@@ -541,8 +541,7 @@ static xkb_keysym_t composeSymbol(xkb_keysym_t sym)
static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
{
uint32_t code, numSyms;
long cp;
uint32_t code, numSyms, codepoint;
const xkb_keysym_t *syms;
xkb_keysym_t sym;
@@ -556,12 +555,12 @@ static GLFWbool inputChar(_GLFWwindow* window, uint32_t key)
#else
sym = syms[0];
#endif
cp = _glfwKeySym2Unicode(sym);
if (cp != -1)
codepoint = _glfwKeySym2Unicode(sym);
if (codepoint != GLFW_INVALID_CODEPOINT)
{
const int mods = _glfw.wl.xkb.modifiers;
const int plain = !(mods & (GLFW_MOD_CONTROL | GLFW_MOD_ALT));
_glfwInputChar(window, cp, mods, plain);
_glfwInputChar(window, codepoint, mods, plain);
}
}