fix(windows): Add review suggestions

Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
rc-swag 2022-10-14 16:14:51 +10:00 • committed by GitHub
parent 90eb7c77ec
commit b6722f6a0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -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,

View file

@ -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));
}

View file

@ -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");
}