Added modifier flags to mouse events as a fix for sticky keys.
This commit is contained in:
parent
1a05bed6da
commit
9978a85a4f
|
@ -189,7 +189,7 @@ OSXKeyState::OSXKeyState(IEventQueue* events) :
|
||||||
OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) :
|
OSXKeyState::OSXKeyState(IEventQueue* events, synergy::KeyMap& keyMap) :
|
||||||
KeyState(events, keyMap)
|
KeyState(events, keyMap)
|
||||||
{
|
{
|
||||||
init();
|
init();a
|
||||||
}
|
}
|
||||||
|
|
||||||
OSXKeyState::~OSXKeyState()
|
OSXKeyState::~OSXKeyState()
|
||||||
|
@ -390,6 +390,34 @@ OSXKeyState::fakeCtrlAltDel()
|
||||||
return false;
|
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
|
KeyModifierMask
|
||||||
OSXKeyState::pollActiveModifiers() const
|
OSXKeyState::pollActiveModifiers() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -100,6 +100,7 @@ public:
|
||||||
virtual SInt32 pollActiveGroup() const;
|
virtual SInt32 pollActiveGroup() const;
|
||||||
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
|
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
|
||||||
|
|
||||||
|
CGEventFlags getModifierStateAsOSXFlags();
|
||||||
protected:
|
protected:
|
||||||
// KeyState overrides
|
// KeyState overrides
|
||||||
virtual void getKeyMap(synergy::KeyMap& keyMap);
|
virtual void getKeyMap(synergy::KeyMap& keyMap);
|
||||||
|
|
|
@ -528,6 +528,10 @@ OSXScreen::postMouseEvent(CGPoint& pos) const
|
||||||
// Dragging events also need the click state
|
// Dragging events also need the click state
|
||||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
|
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
|
||||||
|
|
||||||
|
// Fix for sticky keys
|
||||||
|
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
|
||||||
|
CGEventSetFlags(event, modifiers);
|
||||||
|
|
||||||
CGEventPost(kCGHIDEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
|
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
|
@ -595,6 +599,10 @@ OSXScreen::fakeMouseButton(ButtonID id, bool press)
|
||||||
|
|
||||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
|
CGEventSetIntegerValueField(event, kCGMouseEventClickState, m_clickState);
|
||||||
|
|
||||||
|
// Fix for sticky keys
|
||||||
|
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
|
||||||
|
CGEventSetFlags(event, modifiers);
|
||||||
|
|
||||||
m_buttonState.set(index, state);
|
m_buttonState.set(index, state);
|
||||||
CGEventPost(kCGHIDEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
|
|
||||||
|
@ -705,6 +713,10 @@ OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
|
||||||
mapScrollWheelFromSynergy(yDelta),
|
mapScrollWheelFromSynergy(yDelta),
|
||||||
-mapScrollWheelFromSynergy(xDelta));
|
-mapScrollWheelFromSynergy(xDelta));
|
||||||
|
|
||||||
|
// Fix for sticky keys
|
||||||
|
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
|
||||||
|
CGEventSetFlags(scrollEvent, modifiers);
|
||||||
|
|
||||||
CGEventPost(kCGHIDEventTap, scrollEvent);
|
CGEventPost(kCGHIDEventTap, scrollEvent);
|
||||||
CFRelease(scrollEvent);
|
CFRelease(scrollEvent);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue