Bug 385168 - Changing input locale leads to sticky ALT key
p=Dainis Jonitis <jonitis@gmail.com>
r=ere, sr=roc
--- a/widget/src/windows/nsKeyboardLayout.cpp
+++ b/widget/src/windows/nsKeyboardLayout.cpp
@@ -324,30 +324,29 @@ PRUint32 KeyboardLayout::GetUniChars (PR
#endif
}
void KeyboardLayout::LoadLayout ()
{
#ifndef WINCE
PRUint32 shiftState;
BYTE kbdState [256];
+ BYTE originalKbdState [256];
PRUint16 shiftStatesWithDeadKeys = 0; // Bitfield with all shift states that have at least one dead-key.
PRUint16 shiftStatesWithBaseChars = 0; // Bitfield with all shift states that produce any possible dead-key base characters.
memset (kbdState, 0, sizeof (kbdState));
mActiveDeadKey = -1;
mNumOfChars = 0;
mKeyboardLayout = ::GetKeyboardLayout (0);
ReleaseDeadKeyTables ();
-#ifndef DEBUG
- PRBool keyboardInputAlreadyBlocked = !::BlockInput (PR_TRUE);
-#endif
+ ::GetKeyboardState (originalKbdState);
// For each shift state gather all printable characters that are produced
// for normal case when no any dead-key is active.
for (shiftState = 0; shiftState < 16; shiftState++)
{
SetShiftState (kbdState, shiftState);
@@ -412,20 +411,17 @@ void KeyboardLayout::LoadLayout ()
if (!dkt)
dkt = AddDeadKeyTable (deadKeyArray, n);
mVirtualKeys [vki].AttachDeadKeyTable (shiftState, dkt);
}
}
}
-#ifndef DEBUG
- if (!keyboardInputAlreadyBlocked)
- ::BlockInput (PR_FALSE);
-#endif
+ ::SetKeyboardState (originalKbdState);
#endif
}
#ifndef WINCE
PRUint8 KeyboardLayout::GetShiftState (const PBYTE aKbdState)
{
PRBool isShift = (aKbdState [VK_SHIFT] & 0x80) != 0;