Bug 1303273 part.1 KeyboardLayout::IsSysKey() should check MODIFIER_ALT as a bit flag r?m_kato
This is a simple mistake and blocks following patchs' automated tests.
For example, when Alt+Shift+foo doesn't cause text, this returns false even though it should return true.
MozReview-Commit-ID: 91L33vZhouT
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -3516,16 +3516,17 @@ KeyboardLayout::IsDeadKey(uint8_t aVirtu
bool
KeyboardLayout::IsSysKey(uint8_t aVirtualKey,
const ModifierKeyState& aModKeyState) const
{
// If Alt key is not pressed, it's never a system key combination.
// Additionally, if Ctrl key is pressed, it's never a system key combination
// too.
+ // FYI: Windows logo key state won't affect if it's a system key.
if (!aModKeyState.IsAlt() || aModKeyState.IsControl()) {
return false;
}
int32_t virtualKeyIndex = GetKeyIndex(aVirtualKey);
if (virtualKeyIndex < 0) {
return true;
}
@@ -3533,17 +3534,17 @@ KeyboardLayout::IsSysKey(uint8_t aVirtua
UniCharsAndModifiers inputCharsAndModifiers =
GetUniCharsAndModifiers(aVirtualKey, aModKeyState);
if (inputCharsAndModifiers.IsEmpty()) {
return true;
}
// If the Alt key state isn't consumed, that means that the key with Alt
// doesn't cause text input. So, the combination is a system key.
- return inputCharsAndModifiers.mModifiers[0] != MODIFIER_ALT;
+ return !!(inputCharsAndModifiers.mModifiers[0] & MODIFIER_ALT);
}
void
KeyboardLayout::InitNativeKey(NativeKey& aNativeKey,
const ModifierKeyState& aModKeyState)
{
if (mIsPendingToRestoreKeyboardLayout) {
LoadLayout(::GetKeyboardLayout(0));