mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
refactor: use kKeyModifiers in IsAltModifier() (#47066)
We probably didn't use this before because IsAltModifier() was written two years before the KeyModifiers mask was added upstream in 98ec378a.
This commit is contained in:
@@ -20,13 +20,8 @@ bool IsAltKey(const input::NativeWebKeyboardEvent& event) {
|
||||
}
|
||||
|
||||
bool IsAltModifier(const input::NativeWebKeyboardEvent& event) {
|
||||
using Modifiers = input::NativeWebKeyboardEvent::Modifiers;
|
||||
int modifiers = event.GetModifiers();
|
||||
modifiers &= ~Modifiers::kNumLockOn;
|
||||
modifiers &= ~Modifiers::kCapsLockOn;
|
||||
return (modifiers == Modifiers::kAltKey) ||
|
||||
(modifiers == (Modifiers::kAltKey | Modifiers::kIsLeft)) ||
|
||||
(modifiers == (Modifiers::kAltKey | Modifiers::kIsRight));
|
||||
using Mods = input::NativeWebKeyboardEvent::Modifiers;
|
||||
return (event.GetModifiers() & Mods::kKeyModifiers) == Mods::kAltKey;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user