Merge pull request #7094 from symless/SYNERGY-1247-CapsLock-doesn’t-work-on-Microsoft-Remote-Desktop

SYNERGY-1247 CapsLock doesn't work on Microsoft Remote Desktop
This commit is contained in:
Andrey Batyiev
2021-09-27 19:30:56 +03:00
committed by GitHub
3 changed files with 47 additions and 9 deletions

View File

@ -7,7 +7,7 @@ Bug fixes:
- #7080 Add trace if the system can't open file with trusted fingerprints
- #7081 Fix autoconfig after SYNERGY-1161
- #7082 Windows client doesn't resume connection after sleep
- #7089 Modifier keys don't work on Microsoft Remote Desktop
- #7089 | #7094 Modifier keys don't work on Microsoft Remote Desktop
- #7091 Fix CMakeFileList for unittests
- #7092 Synergy is running after quit on Linux
- #7096 The system duplicates hotkeys in setup

View File

@ -476,31 +476,67 @@ OSXKeyState::getKeyMap(synergy::KeyMap& keyMap)
}
CGEventFlags
OSXKeyState::getKeyboardEventFlags()
OSXKeyState::getDeviceIndependedFlags() const
{
// set the event flags for special keys
// http://tinyurl.com/pxl742y
CGEventFlags modifiers = 0;
if (m_shiftPressed) {
modifiers |= kCGEventFlagMaskShift | NX_DEVICELSHIFTKEYMASK;
modifiers |= kCGEventFlagMaskShift;
}
if (m_controlPressed) {
modifiers |= kCGEventFlagMaskControl | NX_DEVICELCTLKEYMASK;
modifiers |= kCGEventFlagMaskControl;
}
if (m_altPressed) {
modifiers |= kCGEventFlagMaskAlternate | NX_DEVICELALTKEYMASK;
modifiers |= kCGEventFlagMaskAlternate;
}
if (m_superPressed) {
modifiers |= kCGEventFlagMaskCommand | NX_DEVICELCMDKEYMASK;
modifiers |= kCGEventFlagMaskCommand;
}
return modifiers;
}
CGEventFlags
OSXKeyState::getDeviceDependedFlags() const
{
CGEventFlags modifiers = 0;
if (m_shiftPressed) {
modifiers |= NX_DEVICELSHIFTKEYMASK;
}
if (m_controlPressed) {
modifiers |= NX_DEVICELCTLKEYMASK;
}
if (m_altPressed) {
modifiers |= NX_DEVICELALTKEYMASK;
}
if (m_superPressed) {
modifiers |= NX_DEVICELCMDKEYMASK;
}
return modifiers;
}
CGEventFlags
OSXKeyState::getKeyboardEventFlags() const
{
// set the event flags for special keys
// http://tinyurl.com/pxl742y
CGEventFlags modifiers = getDeviceIndependedFlags();
if (m_capsPressed) {
modifiers |= kCGEventFlagMaskAlphaShift;
}
else {
modifiers |= getDeviceDependedFlags();
}
return modifiers;
}

View File

@ -151,7 +151,9 @@ private:
void init();
// Get keyboard event flags accorfing to keyboard modifiers
CGEventFlags getKeyboardEventFlags();
CGEventFlags getKeyboardEventFlags() const;
CGEventFlags getDeviceIndependedFlags() const;
CGEventFlags getDeviceDependedFlags() const;
void setKeyboardModifiers(CGKeyCode virtualKey, bool keyDown);