From 81283db2da6c95a316d9345ae20fc0c1ac88d69c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 7 Nov 2014 15:05:55 +0800 Subject: [PATCH] views: Make auto-hide-menu-bar work when NumLock is on, fixes #796 --- atom/browser/native_window_views.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index dc1d684ea2b..9a7e6d528be 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -113,9 +113,12 @@ bool IsAltKey(const content::NativeWebKeyboardEvent& event) { bool IsAltModifier(const content::NativeWebKeyboardEvent& event) { typedef content::NativeWebKeyboardEvent::Modifiers Modifiers; - return (event.modifiers == Modifiers::AltKey) || - (event.modifiers == (Modifiers::AltKey | Modifiers::IsLeft)) || - (event.modifiers == (Modifiers::AltKey | Modifiers::IsRight)); + int modifiers = event.modifiers; + modifiers &= ~Modifiers::NumLockOn; + modifiers &= ~Modifiers::CapsLockOn; + return (modifiers == Modifiers::AltKey) || + (modifiers == (Modifiers::AltKey | Modifiers::IsLeft)) || + (modifiers == (Modifiers::AltKey | Modifiers::IsRight)); } class NativeWindowClientView : public views::ClientView {