Bug 385168 - Changing input locale leads to sticky ALT key
authorasqueella@gmail.com
Mon, 23 Jul 2007 18:34:13 -0700
changeset 3810 a1a66b69f304454715e2f3fc32808d24ef73f5a4
parent 3809 1a650bf8678d8d4c16543d102c864b8e31899c53
child 3811 2c3484dcd913c88a9fcc3dada2bc4d36432bcd0d
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs385168
milestone1.9a7pre
Bug 385168 - Changing input locale leads to sticky ALT key p=Dainis Jonitis <jonitis@gmail.com> r=ere, sr=roc
widget/src/windows/nsKeyboardLayout.cpp
--- 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;