From e786fc8abbed920f61fd1e7eefa01ff577dbcc21 Mon Sep 17 00:00:00 2001 From: ocornut Date: Fri, 25 Dec 2015 21:59:02 +0100 Subject: [PATCH] Fix Win32 charmods handler not triggering when CTRL is held (fix #672) --- src/win32_window.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/win32_window.c b/src/win32_window.c index 5f9295f2c..869fce860 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -379,6 +379,18 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, else _glfwInputKey(window, key, scancode, action, mods); + if ((uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN) && (mods & GLFW_MOD_CONTROL)) + { + static BYTE keys[256] = { 0 }; + WCHAR buf[4]; + int buf_sz; + int n; + keys[VK_SHIFT] = (mods & GLFW_MOD_SHIFT) ? 0x80 : 0; + buf_sz = ToUnicodeEx(wParam, scancode, keys, buf, 4, 0, NULL); + for (n = 0; n < buf_sz; n++) + _glfwInputChar(window, buf[n], getKeyMods(), FALSE); + } + break; }