Bug 1382199: On Windows, prevent the System menu bar from triggering when F10 is released. r?jimm draft
authorJames Teh <jteh@mozilla.com>
Fri, 16 Feb 2018 12:08:58 +1000
changeset 755939 55a950ea0065a14903e2595c5e52a699b71c21c4
parent 755833 994a8d6eccbcdc6106794705bd77e3ac5f031be2
push id99335
push userbmo:jteh@mozilla.com
push dateFri, 16 Feb 2018 02:21:53 +0000
reviewersjimm
bugs1382199
milestone60.0a1
Bug 1382199: On Windows, prevent the System menu bar from triggering when F10 is released. r?jimm Windows default behavior will trigger the System menu bar when F10 is released. Among other things, this causes the System menu bar to appear when a web page overrides the contextmenu event. We *never* want this default behavior, so eat this key (never pass it to Windows). MozReview-Commit-ID: 4fWOuj4mWvW
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6497,17 +6497,25 @@ LRESULT nsWindow::ProcessCharMessage(con
   NativeKey nativeKey(this, aMsg, modKeyState);
   return static_cast<LRESULT>(nativeKey.HandleCharMessage(aEventDispatched));
 }
 
 LRESULT nsWindow::ProcessKeyUpMessage(const MSG &aMsg, bool *aEventDispatched)
 {
   ModifierKeyState modKeyState;
   NativeKey nativeKey(this, aMsg, modKeyState);
-  return static_cast<LRESULT>(nativeKey.HandleKeyUpMessage(aEventDispatched));
+  bool result = nativeKey.HandleKeyUpMessage(aEventDispatched);
+  if (aMsg.wParam == VK_F10) {
+    // Bug 1382199: Windows default behavior will trigger the System menu bar
+    // when F10 is released. Among other things, this causes the System menu bar
+    // to appear when a web page overrides the contextmenu event. We *never*
+    // want this default behavior, so eat this key (never pass it to Windows).
+    return true;
+  }
+  return result;
 }
 
 LRESULT nsWindow::ProcessKeyDownMessage(const MSG &aMsg,
                                         bool *aEventDispatched)
 {
   // If this method doesn't call NativeKey::HandleKeyDownMessage(), this method
   // must clean up the redirected message information itself.  For more
   // information, see above comment of