From 564d9b894e410ed264fcc421257f4f0d12e749b6 Mon Sep 17 00:00:00 2001 From: jpmcmu Date: Wed, 22 Apr 2015 19:13:41 -0400 Subject: [PATCH 1/3] Added entry into gitignore for Samba temporary files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 6fa84a3b..1f0c1a36 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ src/gui/gui.pro.user src/gui/.qmake.stash src/gui/.rnd src/setup/win32/synergy.suo +*.smbdelete* From 9978a85a4fc163015c82670e79fb7dc0836820ce Mon Sep 17 00:00:00 2001 From: jpmcmu Date: Wed, 22 Apr 2015 19:33:25 -0400 Subject: [PATCH 2/3] Added modifier flags to mouse events as a fix for sticky keys. --- src/lib/platform/OSXKeyState.cpp | 30 +++++++++++++++++++++++++++++- src/lib/platform/OSXKeyState.h | 1 + src/lib/platform/OSXScreen.cpp | 12 ++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index a40ad16c..60d57673 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -189,7 +189,7 @@ OSXKeyState::OSXKeyState(IEventQueue* events) : OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) : KeyState(events, keyMap) { - init(); + init();a } OSXKeyState::~OSXKeyState() @@ -390,6 +390,34 @@ OSXKeyState::fakeCtrlAltDel() return false; } +CGEventFlags +OSXKeyState::getModifierStateAsOSXFlags() +{ + CGEventFlags modifiers = 0; + + if (m_shiftPressed) { + modifiers |= kCGEventFlagMaskShift; + } + + if (m_controlPressed) { + modifiers |= kCGEventFlagMaskControl; + } + + if (m_altPressed) { + modifiers |= kCGEventFlagMaskAlternate; + } + + if (m_superPressed) { + modifiers |= kCGEventFlagMaskCommand; + } + + if (m_capsPressed) { + modifiers |= kCGEventFlagMaskAlphaShift; + } + + return modifiers; +} + KeyModifierMask OSXKeyState::pollActiveModifiers() const { diff --git a/src/lib/platform/OSXKeyState.h b/src/lib/platform/OSXKeyState.h index fd481080..207d0738 100644 --- a/src/lib/platform/OSXKeyState.h +++ b/src/lib/platform/OSXKeyState.h @@ -100,6 +100,7 @@ public: virtual SInt32 pollActiveGroup() const; virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const; + CGEventFlags getModifierStateAsOSXFlags(); protected: // KeyState overrides virtual void getKeyMap(synergy::KeyMap& keyMap); diff --git a/src/lib/platform/OSXScreen.cpp b/src/lib/platform/OSXScreen.cpp index 3869d24f..bf536f70 100644 --- a/src/lib/platform/OSXScreen.cpp +++ b/src/lib/platform/OSXScreen.cpp @@ -528,6 +528,10 @@ OSXScreen::postMouseEvent(CGPoint& pos) const // Dragging events also need the click state CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState); + // Fix for sticky keys + CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); + CGEventSetFlags(event, modifiers); + CGEventPost(kCGHIDEventTap, event); CFRelease(event); @@ -595,6 +599,10 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press) CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState); + // Fix for sticky keys + CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); + CGEventSetFlags(event, modifiers); + m_buttonState.set(index, state); CGEventPost(kCGHIDEventTap, event); @@ -705,6 +713,10 @@ OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const mapScrollWheelFromSynergy(yDelta), -mapScrollWheelFromSynergy(xDelta)); + // Fix for sticky keys + CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); + CGEventSetFlags(scrollEvent, modifiers); + CGEventPost(kCGHIDEventTap, scrollEvent); CFRelease(scrollEvent); #else From 8cd256a0b2fae2dd58eb837b896106d337fbf18d Mon Sep 17 00:00:00 2001 From: jpmcmu Date: Thu, 23 Apr 2015 07:04:29 -0400 Subject: [PATCH 3/3] Removed stray character. --- src/lib/platform/OSXKeyState.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/platform/OSXKeyState.cpp b/src/lib/platform/OSXKeyState.cpp index 60d57673..8317a8d7 100644 --- a/src/lib/platform/OSXKeyState.cpp +++ b/src/lib/platform/OSXKeyState.cpp @@ -189,7 +189,7 @@ OSXKeyState::OSXKeyState(IEventQueue* events) : OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) : KeyState(events, keyMap) { - init();a + init(); } OSXKeyState::~OSXKeyState()