diff --git a/windows/src/engine/keyman32/k32_globals.cpp b/windows/src/engine/keyman32/k32_globals.cpp index 32cea01c4c..e8e49ed6bc 100644 --- a/windows/src/engine/keyman32/k32_globals.cpp +++ b/windows/src/engine/keyman32/k32_globals.cpp @@ -72,8 +72,8 @@ UINT //TODO: consolidate these messages -- they are probably not all required now wm_keyman = 0, // user message - ignore msg // I3594 - wm_keyman_keyevent = 0, // for serialized input - wm_keyman_modifierevent = 0, + wm_keyman_keyevent = 0, // for serialized input + wm_keyman_modifierevent = 0, // for serialized input wm_kmdebug = 0, // " " " " - debugging wm_keymankeydown = 0, diff --git a/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp b/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp index fe137a9eb7..2574ca1b9c 100644 --- a/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp +++ b/windows/src/engine/keyman32/k32_lowlevelkeyboardhook.cpp @@ -202,6 +202,10 @@ LRESULT _kmnLowLevelKeyboardProc( if(isUp) FHotkeyShiftState &= ~Flag; else FHotkeyShiftState |= Flag; // #7337 Post the modifier state ensuring the serialized queue is in sync + // Note that the modifier key may be posted again with wm_keyman_keyevent, + // later in this function. This is intentional, as the wm_keyman_modifier + // event message only updates our internal modifier state, and does not do + // any additional processing or other serialization of the input queue. if (flag_ShouldSerializeInput) { PostMessage(ISerialKeyEventServer::GetServer()->GetWindow(), wm_keyman_modifierevent, hs->vkCode, LLKHFFlagstoWMKeymanKeyEventFlags(hs)); } diff --git a/windows/src/engine/keyman32/serialkeyeventserver.cpp b/windows/src/engine/keyman32/serialkeyeventserver.cpp index 3faa515022..affcb6652f 100644 --- a/windows/src/engine/keyman32/serialkeyeventserver.cpp +++ b/windows/src/engine/keyman32/serialkeyeventserver.cpp @@ -485,7 +485,10 @@ private: input[1].ki.dwExtraInfo = EXTRAINFO_FLAG_SERIALIZED_USER_KEY_EVENT; input[1].ki.dwFlags = lParam & 0xFFFF; - if (msg == wm_keyman_keyevent){ + if (msg == wm_keyman_keyevent) { + // We track changes to modifiers with wm_keyman_modifierevent, but only ever + // pass them on to the app when we receive them with the wm_keyman_keyevent + // message. if (!SendInput(2, input, sizeof(INPUT))) { DebugLastError("SendInput"); }