Simplify Win32 character message handling

master
Camilla Berglund ago%!(EXTRA string=10 years)
parent 37b20124f9
commit d725eeaf84
  1. 45
      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:

Loading…
Cancel
Save