Address issues with modifiers and dead keys (#7149)

* After getting a dead key from ToUnicodeEx, add an additional VK_SPACE
to the keyboard state so we reset the dead key flag and subsequent
calls with modifiers, like shift, return the right result (-1) instead
of 1.

This happened because without reseting the dead key status
the new one was attempted to be composed with the old one, which failed
and the end result was a single unicode codepoint not marked as a dead
key.

This opens the door to potentially use the returned unicode from the
second call as the key character instead of maintaining the
getDeadKey function.

* Update ChangeLog

Co-authored-by: Pedro Navarro <pnavarro@netflix.com>
Co-authored-by: Serhii Hadzhilov <serhii-external@symless.com>
Co-authored-by: Serhii Hadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
Pedro Navarro 2022-05-02 11:13:15 -07:00 committed by GitHub
parent 90847d064a
commit 21b0f233c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View file

@ -6,6 +6,7 @@ Enhancements:
Bug fixes:
- #7144 Fix double lines when pasting text from Linux to Windows
- #7149 Address issues with modifiers and dead keys
Github Actions:
- #7148 Fix unstable build for windows core

View file

@ -1367,9 +1367,20 @@ MSWindowsKeyState::getIDForKey(synergy::KeyMap::KeyItem& item,
KeyID id = static_cast<KeyID>(unicode[0]);
switch (n) {
case -1:
return synergy::KeyMap::getDeadKey(id);
case -1: {
// dead key. add an space to the keyboard so we exit
// the dead key mode and future calls to this function
// with different modifiers are not affected.
BYTE emptyState[256] = { };
n = m_ToUnicodeEx(VK_SPACE, 0, emptyState, unicode,
sizeof(unicode) / sizeof(unicode[0]), 0, hkl);
// as an alternative, we could use the returned
// buffer in unicode to look at the dead key character
// and not rely on getDeadKey to provide the mapping
return synergy::KeyMap::getDeadKey(id);
}
default:
case 0:
// unmapped