зеркало из https://github.com/mozilla/gecko-dev.git
Bug 855975 part.3 Wrap MapVirtualKeyEx() API for converting VK to ScanCode with widget::KeyboardLayout r=jimm
This commit is contained in:
Родитель
529c849332
Коммит
e5373c9e94
|
@ -697,6 +697,13 @@ KeyboardLayout::IsPrintableCharKey(uint8_t aVirtualKey)
|
|||
return GetKeyIndex(aVirtualKey) >= 0;
|
||||
}
|
||||
|
||||
WORD
|
||||
KeyboardLayout::ComputeScanCodeForVirtualKeyCode(uint8_t aVirtualKeyCode) const
|
||||
{
|
||||
return static_cast<WORD>(
|
||||
::MapVirtualKeyEx(aVirtualKeyCode, MAPVK_VK_TO_VSC, GetLayout()));
|
||||
}
|
||||
|
||||
bool
|
||||
KeyboardLayout::IsDeadKey(uint8_t aVirtualKey,
|
||||
const ModifierKeyState& aModKeyState) const
|
||||
|
|
|
@ -467,6 +467,11 @@ public:
|
|||
return mIsPendingToRestoreKeyboardLayout ? ::GetKeyboardLayout(0) :
|
||||
mKeyboardLayout;
|
||||
}
|
||||
|
||||
/**
|
||||
* This wraps MapVirtualKeyEx() API with MAPVK_VK_TO_VSC.
|
||||
*/
|
||||
WORD ComputeScanCodeForVirtualKeyCode(uint8_t aVirtualKeyCode) const;
|
||||
};
|
||||
|
||||
} // namespace widget
|
||||
|
|
|
@ -5862,10 +5862,8 @@ nsWindow::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
}
|
||||
::SetKeyboardState(kbdState);
|
||||
ModifierKeyState modKeyState;
|
||||
UINT scanCode = ::MapVirtualKeyEx(argumentKeySpecific ?
|
||||
argumentKeySpecific : aNativeKeyCode,
|
||||
MAPVK_VK_TO_VSC,
|
||||
keyboardLayout->GetLayout());
|
||||
UINT scanCode = keyboardLayout->ComputeScanCodeForVirtualKeyCode(
|
||||
argumentKeySpecific ? argumentKeySpecific : aNativeKeyCode);
|
||||
LPARAM lParam = static_cast<LPARAM>(scanCode << 16);
|
||||
// Add extended key flag to the lParam for right control key and right alt
|
||||
// key.
|
||||
|
@ -5910,10 +5908,8 @@ nsWindow::SynthesizeNativeKeyEvent(int32_t aNativeKeyboardLayout,
|
|||
}
|
||||
::SetKeyboardState(kbdState);
|
||||
ModifierKeyState modKeyState;
|
||||
UINT scanCode = ::MapVirtualKeyEx(argumentKeySpecific ?
|
||||
argumentKeySpecific : aNativeKeyCode,
|
||||
MAPVK_VK_TO_VSC,
|
||||
keyboardLayout->GetLayout());
|
||||
UINT scanCode = keyboardLayout->ComputeScanCodeForVirtualKeyCode(
|
||||
argumentKeySpecific ? argumentKeySpecific : aNativeKeyCode);
|
||||
LPARAM lParam = static_cast<LPARAM>(scanCode << 16);
|
||||
// Add extended key flag to the lParam for right control key and right alt
|
||||
// key.
|
||||
|
|
Загрузка…
Ссылка в новой задаче