Merge pull request #64 from p12tic/osx-server-jumpy-scrolling

Improve precision of grabbed scroll events on OSX server
This commit is contained in:
walker0643 2018-06-30 16:40:10 -04:00 committed by GitHub
commit 53ee9c7803
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -144,10 +144,10 @@ private:
ButtonID mapMacButtonToBarrier(UInt16) const; ButtonID mapMacButtonToBarrier(UInt16) const;
// map mac scroll wheel value to a barrier scroll wheel value // 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 // 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 // get the current scroll wheel speed
double getScrollSpeed() const; double getScrollSpeed() const;

View File

@ -1421,7 +1421,7 @@ OSXScreen::mapMacButtonToBarrier(UInt16 macButton) const
} }
SInt32 SInt32
OSXScreen::mapScrollWheelToBarrier(SInt32 x) const OSXScreen::mapScrollWheelToBarrier(float x) const
{ {
// return accelerated scrolling but not exponentially scaled as it is // return accelerated scrolling but not exponentially scaled as it is
// on the mac. // on the mac.
@ -1430,7 +1430,7 @@ OSXScreen::mapScrollWheelToBarrier(SInt32 x) const
} }
SInt32 SInt32
OSXScreen::mapScrollWheelFromBarrier(SInt32 x) const OSXScreen::mapScrollWheelFromBarrier(float 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.
@ -1948,9 +1948,9 @@ OSXScreen::handleCGInputEvent(CGEventTapProxy proxy,
break; break;
case kCGEventScrollWheel: case kCGEventScrollWheel:
screen->onMouseWheel(screen->mapScrollWheelToBarrier( screen->onMouseWheel(screen->mapScrollWheelToBarrier(
CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis2)), CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis2) / 65536.0f),
screen->mapScrollWheelToBarrier( screen->mapScrollWheelToBarrier(
CGEventGetIntegerValueField(event, kCGScrollWheelEventDeltaAxis1))); CGEventGetIntegerValueField(event, kCGScrollWheelEventFixedPtDeltaAxis1) / 65536.0f));
break; break;
case kCGEventKeyDown: case kCGEventKeyDown:
case kCGEventKeyUp: case kCGEventKeyUp: