|
|
|
@ -432,10 +432,10 @@ static char** parseUriList(char* text, int* count) |
|
|
|
|
// Decode a Unicode code point from a UTF-8 stream
|
|
|
|
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
|
|
|
|
//
|
|
|
|
|
static unsigned int decodeUTF8(const char** s) |
|
|
|
|
static uint32_t decodeUTF8(const char** s) |
|
|
|
|
{ |
|
|
|
|
unsigned int ch = 0, count = 0; |
|
|
|
|
static const unsigned int offsets[] = |
|
|
|
|
uint32_t codepoint = 0, count = 0; |
|
|
|
|
static const uint32_t offsets[] = |
|
|
|
|
{ |
|
|
|
|
0x00000000u, 0x00003080u, 0x000e2080u, |
|
|
|
|
0x03c82080u, 0xfa082080u, 0x82082080u |
|
|
|
@ -443,13 +443,13 @@ static unsigned int decodeUTF8(const char** s) |
|
|
|
|
|
|
|
|
|
do |
|
|
|
|
{ |
|
|
|
|
ch = (ch << 6) + (unsigned char) **s; |
|
|
|
|
codepoint = (codepoint << 6) + (unsigned char) **s; |
|
|
|
|
(*s)++; |
|
|
|
|
count++; |
|
|
|
|
} while ((**s & 0xc0) == 0x80); |
|
|
|
|
|
|
|
|
|
assert(count <= 6); |
|
|
|
|
return ch - offsets[count - 1]; |
|
|
|
|
return codepoint - offsets[count - 1]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Convert the specified Latin-1 string to UTF-8
|
|
|
|
@ -1286,9 +1286,9 @@ static void processEvent(XEvent *event) |
|
|
|
|
|
|
|
|
|
_glfwInputKey(window, key, keycode, GLFW_PRESS, mods); |
|
|
|
|
|
|
|
|
|
const long character = _glfwKeySym2Unicode(keysym); |
|
|
|
|
if (character != -1) |
|
|
|
|
_glfwInputChar(window, character, mods, plain); |
|
|
|
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym); |
|
|
|
|
if (codepoint != GLFW_INVALID_CODEPOINT) |
|
|
|
|
_glfwInputChar(window, codepoint, mods, plain); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return; |
|
|
|
@ -2868,11 +2868,11 @@ const char* _glfwGetScancodeNameX11(int scancode) |
|
|
|
|
if (keysym == NoSymbol) |
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
const long ch = _glfwKeySym2Unicode(keysym); |
|
|
|
|
if (ch == -1) |
|
|
|
|
const uint32_t codepoint = _glfwKeySym2Unicode(keysym); |
|
|
|
|
if (codepoint == GLFW_INVALID_CODEPOINT) |
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|
const size_t count = _glfwEncodeUTF8(_glfw.x11.keynames[key], (unsigned int) ch); |
|
|
|
|
const size_t count = _glfwEncodeUTF8(_glfw.x11.keynames[key], codepoint); |
|
|
|
|
if (count == 0) |
|
|
|
|
return NULL; |
|
|
|
|
|
|
|
|
|