SYNERGY-988 Mac client does not scroll in natural direction (#7012)

* SYNERGY-988 - Use system preferences for horizontal scrolling

* Update changelog

* SYNERGY-988 - Invert xscroll direction

* Also revert system event xscroll

* SYNERGY-988 - Update directions

* SYNERGY-988 - Update changelog

* SYNERGY-988 - Update scrolling direction and y scrolling

* SYNERGY-988 - Update variable comment

Co-authored-by: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com>
This commit is contained in:
Igor Sikachyna 2021-05-26 22:45:45 -07:00 committed by GitHub
parent c7fd0a8e4d
commit d9b96e1988
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -3,6 +3,7 @@ v1.14.1-snapshot
Bug fixes: Bug fixes:
- #7016 Fix script that generates version number - #7016 Fix script that generates version number
- #7006 Resolve code scanning issues - #7006 Resolve code scanning issues
- #7012 Fix natural horizontal scrolling on Mac client
Enhancements: Enhancements:

View file

@ -339,6 +339,9 @@ private:
Thread* m_getDropTargetThread; Thread* m_getDropTargetThread;
String m_dropTarget; String m_dropTarget;
// -1 for natural scrolling direction, 1 otherwise
SInt32 m_scrollDirection = 1;
#if defined(MAC_OS_X_VERSION_10_7) #if defined(MAC_OS_X_VERSION_10_7)
Mutex* m_carbonLoopMutex; Mutex* m_carbonLoopMutex;

View file

@ -681,8 +681,8 @@ OSXScreen::fakeMouseWheel(SInt32 xDelta, SInt32 yDelta) const
CGEventRef scrollEvent = CGEventCreateScrollWheelEvent( CGEventRef scrollEvent = CGEventCreateScrollWheelEvent(
NULL, kCGScrollEventUnitLine, 2, NULL, kCGScrollEventUnitLine, 2,
mapScrollWheelFromSynergy(yDelta), mapScrollWheelFromSynergy(yDelta),
-mapScrollWheelFromSynergy(xDelta)); mapScrollWheelFromSynergy(xDelta));
// Fix for sticky keys // Fix for sticky keys
CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags(); CGEventFlags modifiers = m_keyState->getModifierStateAsOSXFlags();
CGEventSetFlags(scrollEvent, modifiers); CGEventSetFlags(scrollEvent, modifiers);
@ -840,6 +840,8 @@ OSXScreen::enter()
setZeroSuppressionInterval(); setZeroSuppressionInterval();
} }
else { else {
m_scrollDirection = [[[NSUserDefaults standardUserDefaults] objectForKey:@"com.apple.swipescrolldirection"] boolValue] ? -1 : 1;
// reset buttons // reset buttons
m_buttonState.reset(); m_buttonState.reset();
@ -1448,7 +1450,7 @@ OSXScreen::mapScrollWheelFromSynergy(SInt32 x) const
{ {
// use server's acceleration with a little boost since other platforms // use server's acceleration with a little boost since other platforms
// take one wheel step as a larger step than the mac does. // take one wheel step as a larger step than the mac does.
return static_cast<SInt32>(3.0 * x / 120.0); return static_cast<SInt32>(m_scrollDirection * 3.0 * x / 120.0);
} }
double double