diff --git a/src/win32_window.c b/src/win32_window.c index 342a5dff..f6d03898 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -317,43 +317,34 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, return 0; } - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - const int scancode = (lParam >> 16) & 0x1ff; - const int key = translateKey(wParam, lParam); - if (key == _GLFW_KEY_INVALID) - break; - - _glfwInputKey(window, key, scancode, GLFW_PRESS, getKeyMods()); - break; - } - case WM_CHAR: - { - _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE); - return 0; - } - case WM_SYSCHAR: - { - _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_FALSE); - return 0; - } - case WM_UNICHAR: { - // This message is not sent by Windows, but is sent by some - // third-party input method engines + const GLFWbool plain = (uMsg != WM_SYSCHAR); - if (wParam == UNICODE_NOCHAR) + if (uMsg == WM_UNICHAR && wParam == UNICODE_NOCHAR) { + // WM_UNICHAR is not sent by Windows, but is sent by some + // third-party input method engine // Returning TRUE here announces support for this message return TRUE; } - _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE); - return FALSE; + _glfwInputChar(window, (unsigned int) wParam, getKeyMods(), plain); + return 0; + } + + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + { + const int scancode = (lParam >> 16) & 0x1ff; + const int key = translateKey(wParam, lParam); + if (key == _GLFW_KEY_INVALID) + break; + + _glfwInputKey(window, key, scancode, GLFW_PRESS, getKeyMods()); + break; } case WM_KEYUP: