Bug 1528943 - Stop trying to retrieve raw keycode value when native virtual keycode is VK_PROCESS r=m_kato
We didn't dispatch keyboard events during composition. Therefore, we tried to retrieve raw virtual keycode value when key messages come with `VK_PROCESS` unexpectedly. However, the API, `ImmGetVirtualKey()`, is not usable for this purpose because it always returns `VK_PROCESS` if the key messages have already been handled by IME. So, we can just stop using it since we need to expose such key messages as KeyboardEvent whose `key` value is `Process` and `keyCode` value is `DOM_VK_PROCESS`. Differential Revision: https://phabricator.services.mozilla.com/D20623
This commit is contained in:
@@ -1432,14 +1432,11 @@ void NativeKey::InitWithKeyOrChar() {
|
||||
// cause sending another key message if odd tool hooks GetMessage(),
|
||||
// PeekMessage().
|
||||
sLastKeyMSG = mMsg;
|
||||
// First, resolve the IME converted virtual keycode to its original
|
||||
// keycode.
|
||||
if (mMsg.wParam == VK_PROCESSKEY) {
|
||||
mOriginalVirtualKeyCode =
|
||||
static_cast<uint8_t>(::ImmGetVirtualKey(mMsg.hwnd));
|
||||
} else {
|
||||
mOriginalVirtualKeyCode = static_cast<uint8_t>(mMsg.wParam);
|
||||
}
|
||||
|
||||
// Note that we don't need to compute raw virtual keycode here even when
|
||||
// it's VK_PROCESS (i.e., already handled by IME) because we need to
|
||||
// export it as DOM_VK_PROCESS and KEY_NAME_INDEX_Process.
|
||||
mOriginalVirtualKeyCode = static_cast<uint8_t>(mMsg.wParam);
|
||||
|
||||
// If the key message is sent from other application like a11y tools, the
|
||||
// scancode value might not be set proper value. Then, probably the value
|
||||
|
||||
Reference in New Issue
Block a user