views: Make auto-hide-menu-bar work when NumLock is on, fixes #796

This commit is contained in:
Cheng Zhao 2014-11-07 15:05:55 +08:00 committed by Frank Hale
parent ef255db069
commit b92d5071fa

View file

@ -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 {