1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

Simplify Win32 character message handling

This commit is contained in:
Camilla Berglund 2015-10-29 14:05:57 +01:00
parent 37b20124f9
commit d725eeaf84

View File

@ -317,6 +317,24 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
return 0;
}
case WM_CHAR:
case WM_SYSCHAR:
case WM_UNICHAR:
{
const GLFWbool plain = (uMsg != WM_SYSCHAR);
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(), plain);
return 0;
}
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
{
@ -329,33 +347,6 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
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
if (wParam == UNICODE_NOCHAR)
{
// Returning TRUE here announces support for this message
return TRUE;
}
_glfwInputChar(window, (unsigned int) wParam, getKeyMods(), GLFW_TRUE);
return FALSE;
}
case WM_KEYUP:
case WM_SYSKEYUP:
{