diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index 0b19ff598fdb..66bc76c57287 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2285,8 +2285,8 @@ KeyboardLayout::SynthesizeNativeKeyEvent(nsWindowBase* aWidget, } ::SetKeyboardState(kbdState); ModifierKeyState modKeyState; - UINT scanCode = ComputeScanCodeForVirtualKeyCode( - argumentKeySpecific ? argumentKeySpecific : aNativeKeyCode); + UINT scanCode = + ComputeScanCodeForVirtualKeyCode(keySpecific ? keySpecific : key); LPARAM lParam = static_cast(scanCode << 16); // Add extended key flag to the lParam for right control key and right alt // key. @@ -2340,8 +2340,8 @@ KeyboardLayout::SynthesizeNativeKeyEvent(nsWindowBase* aWidget, } ::SetKeyboardState(kbdState); ModifierKeyState modKeyState; - UINT scanCode = ComputeScanCodeForVirtualKeyCode( - argumentKeySpecific ? argumentKeySpecific : aNativeKeyCode); + UINT scanCode = + ComputeScanCodeForVirtualKeyCode(keySpecific ? keySpecific : key); LPARAM lParam = static_cast(scanCode << 16); // Add extended key flag to the lParam for right control key and right alt // key. diff --git a/widget/windows/KeyboardLayout.h b/widget/windows/KeyboardLayout.h index 429f26f443e0..17825ff92dc4 100644 --- a/widget/windows/KeyboardLayout.h +++ b/widget/windows/KeyboardLayout.h @@ -304,7 +304,7 @@ public: msg.hwnd = aWnd; msg.message = mIsDeadKey ? WM_DEADCHAR : WM_CHAR; msg.wParam = static_cast(mCharCode); - msg.lParam = static_cast(mScanCode); + msg.lParam = static_cast(mScanCode << 16); msg.time = 0; msg.pt.x = msg.pt.y = 0; return msg;