From 1ab50e37e67fa284de61a648c8df13708bd40c47 Mon Sep 17 00:00:00 2001 From: jules Date: Wed, 13 Jun 2007 15:27:48 +0000 Subject: [PATCH] changed the way keycodes are returned so that modifier keys are correctly removed from the keycode. This might mess up a few people's key-shortcut settings, but is now done the correct way. --- .../juce_win32_Windowing.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/build/win32/platform_specific_code/juce_win32_Windowing.cpp b/build/win32/platform_specific_code/juce_win32_Windowing.cpp index 7f754bf4a0..8db3ab78c5 100644 --- a/build/win32/platform_specific_code/juce_win32_Windowing.cpp +++ b/build/win32/platform_specific_code/juce_win32_Windowing.cpp @@ -1626,10 +1626,11 @@ private: } const juce_wchar textChar = (juce_wchar) key; + const int virtualScanCode = (flags >> 16) & 0xff; if (key >= '0' && key <= '9') { - switch ((flags >> 16) & 0xff) // check for a numeric keypad scan-code + switch (virtualScanCode) // check for a numeric keypad scan-code { case 0x52: case 0x4f: @@ -1647,6 +1648,17 @@ private: break; } } + else + { + // convert the scan code to an unmodified character code.. + UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (wMapVirtualKeyW (virtualScanCode, 1), 2) + : MapVirtualKey (MapVirtualKey (virtualScanCode, 1), 2); + + keyChar = LOWORD (keyChar); + + if (keyChar != 0) + key = (int) keyChar; + } handleKeyPress (key, textChar); }