From a645e9a29603bca413b7d22e83ce7e8e1141295d Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Thu, 21 Jun 2018 00:13:40 +0300 Subject: [PATCH] Improve precision of grabbed scroll events on OSX server This is barrier issue #63, synergy issue #5672. --- src/lib/platform/OSXScreen.h | 4 ++-- src/lib/platform/OSXScreen.mm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/platform/OSXScreen.h b/src/lib/platform/OSXScreen.h index 27cb7dfc..6178529a 100644 --- a/src/lib/platform/OSXScreen.h +++ b/src/lib/platform/OSXScreen.h @@ -144,10 +144,10 @@ private: ButtonID mapMacButtonToBarrier(UInt16) const; // map mac scroll wheel value to a barrier scroll wheel value - SInt32 mapScrollWheelToBarrier(SInt32) const; + SInt32 mapScrollWheelToBarrier(float) const; // map barrier scroll wheel value to a mac scroll wheel value - SInt32 mapScrollWheelFromBarrier(SInt32) const; + SInt32 mapScrollWheelFromBarrier(float) const; // get the current scroll wheel speed double getScrollSpeed() const; diff --git a/src/lib/platform/OSXScreen.mm b/src/lib/platform/OSXScreen.mm index 1d80521a..1e0268ef 100644 --- a/src/lib/platform/OSXScreen.mm +++ b/src/lib/platform/OSXScreen.mm @@ -1421,7 +1421,7 @@ OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const } SInt32 -OSXScreen::mapScrollWheelToBarrier(SInt32 x) const +OSXScreen::mapScrollWheelToBarrier(float x) const { // return accelerated scrolling but not exponentially scaled as it is // on the mac. @@ -1430,7 +1430,7 @@ OSXScreen::mapScrollWheelToBarrier(SInt32 x) const } SInt32 -OSXScreen::mapScrollWheelFromBarrier(SInt32 x) const +OSXScreen::mapScrollWheelFromBarrier(float x) const { // use server's acceleration with a little boost since other platforms // take one wheel step as a larger step than the mac does. @@ -1948,9 +1948,9 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy, break; case kCGEventScrollWheel: screen->onMouseWheel(screen->mapScrollWheelToBarrier( - CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis2)), + CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis2) / 65536.0f), screen->mapScrollWheelToBarrier( - CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis1))); + CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis1) / 65536.0f)); break; case kCGEventKeyDown: case kCGEventKeyUp: