diff options
Diffstat (limited to 'src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp')
-rw-r--r-- | src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp b/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp index 3eefb3908..8231ff5ce 100644 --- a/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp +++ b/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp @@ -1910,8 +1910,18 @@ bool VBoxConsoleView::winLowKeyboardEvent (UINT msg, const KBDLLHOOKSTRUCT &even * the VK_LCONTROL vkey with curious 0x21D scan code (seems to be necessary * to specially treat ALT_GR to enter additional chars to regular apps). * These events are definitely unwanted in VM, so filter them out. */ + /* Note (michael): it also sometimes sends the VK_CAPITAL vkey with scan + * code 0x23a. If this is not passed through then it is impossible to + * cancel CapsLock on a French keyboard. I didn't find any other examples + * of these strange events. Let's hope we are not missing anything else + * of importance! */ if (hasFocus() && (event.scanCode & ~0xFF)) - return true; + { + if (event.vkCode == VK_CAPITAL) + return false; + else + return true; + } if (!mKbdCaptured) return false; @@ -2051,7 +2061,7 @@ bool VBoxConsoleView::winEvent (MSG *aMsg, long* /* aResult */) /* These special keys have to be handled by Windows as well to update the * internal modifier state and to enable/disable the keyboard LED */ - if (vkey == VK_NUMLOCK || vkey == VK_CAPITAL) + if (vkey == VK_NUMLOCK || vkey == VK_CAPITAL || vkey == VK_LSHIFT || vkey == VK_RSHIFT) return false; return result; @@ -2530,6 +2540,14 @@ void VBoxConsoleView::fixModifierState (LONG *codes, uint *count) muCapsLockAdaptionCnt--; codes[(*count)++] = 0x3a; codes[(*count)++] = 0x3a | 0x80; + /* Some keyboard layouts require shift to be pressed to break + * capslock. For simplicity, only do this if shift is not + * already held down. */ + if (mCapsLock && !(mPressedKeys [0x2a] & IsKeyPressed)) + { + codes[(*count)++] = 0x2a; + codes[(*count)++] = 0x2a | 0x80; + } } #elif defined(Q_WS_WIN32) @@ -2545,6 +2563,14 @@ void VBoxConsoleView::fixModifierState (LONG *codes, uint *count) muCapsLockAdaptionCnt--; codes[(*count)++] = 0x3a; codes[(*count)++] = 0x3a | 0x80; + /* Some keyboard layouts require shift to be pressed to break + * capslock. For simplicity, only do this if shift is not + * already held down. */ + if (mCapsLock && !(mPressedKeys [0x2a] & IsKeyPressed)) + { + codes[(*count)++] = 0x2a; + codes[(*count)++] = 0x2a | 0x80; + } } #elif defined (Q_WS_MAC) @@ -2555,6 +2581,14 @@ void VBoxConsoleView::fixModifierState (LONG *codes, uint *count) muCapsLockAdaptionCnt--; codes[(*count)++] = 0x3a; codes[(*count)++] = 0x3a | 0x80; + /* Some keyboard layouts require shift to be pressed to break + * capslock. For simplicity, only do this if shift is not + * already held down. */ + if (mCapsLock && !(mPressedKeys [0x2a] & IsKeyPressed)) + { + codes[(*count)++] = 0x2a; + codes[(*count)++] = 0x2a | 0x80; + } } #else |