Bug 619866 - Shift key for safe mode conflicts with Windows shortcut keys. r=dtownsend, a=approval2.0
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 21 Dec 2010 16:32:14 -0800
changeset 59584 875e5ea752417b0cb408f9409caf77bc4d3274fb
parent 59583 ae9c1e421a164d4bf4bd60eb3fb8b65d4e47358f
child 59585 ba354c7ac671e4ff1967369d10f8bccfcdc0ceed
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersdtownsend, approval2
bugs619866
milestone2.0b9pre
Bug 619866 - Shift key for safe mode conflicts with Windows shortcut keys. r=dtownsend, a=approval2.0
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3054,22 +3054,25 @@ XRE_main(int argc, char* argv[], const n
   if (ar == ARG_BAD) {
     PR_fprintf(PR_STDERR, "Error: argument -safe-mode is invalid when argument -osint is specified\n");
     return 1;
   } else if (ar == ARG_FOUND) {
     gSafeMode = PR_TRUE;
   }
 
 #ifdef XP_WIN
-  // If the shift key is pressed during startup start in safe mode. GetKeyState
-  // returns a short and the high order bit will be 1 if the shift key is
-  // pressed. By masking the returned short with 0x8000 the result will be 0 if
-  // the key is not pressed and non-zero otherwise.
-  if (GetKeyState(VK_SHIFT) & 0x8000)
+  // If the shift key is pressed and the ctrl and / or alt keys are not pressed
+  // during startup start in safe mode. GetKeyState returns a short and the high
+  // order bit will be 1 if the key is pressed. By masking the returned short
+  // with 0x8000 the result will be 0 if the key is not pressed and non-zero
+  // otherwise.
+  if (GetKeyState(VK_SHIFT) & 0x8000 &&
+      !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000)) {
     gSafeMode = PR_TRUE;
+  }
 #endif
 
 #ifdef XP_MACOSX
   if (GetCurrentEventKeyModifiers() & optionKey)
     gSafeMode = PR_TRUE;
 #endif
 
   // Handle -no-remote command line argument. Setup the environment to