Permalink
Browse files

Fixed too high mouse scrolling speed.

  • Loading branch information...
1 parent 4573db2 commit 2943bdfecb90718ebf27980b87fc1e286f2b0779 @Ollhax Ollhax committed with thefiddler Apr 22, 2014
Showing with 12 additions and 3 deletions.
  1. +12 −3 Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs
@@ -65,13 +65,14 @@ class CocoaNativeWindow : INativeWindow
static readonly IntPtr selButtonNumber = Selector.Get("buttonNumber");
static readonly IntPtr selSetStyleMask = Selector.Get("setStyleMask:");
static readonly IntPtr selStyleMask = Selector.Get("styleMask");
+ static readonly IntPtr selHasPreciseScrollingDeltas = Selector.Get("hasPreciseScrollingDeltas");
//static readonly IntPtr selIsMiniaturized = Selector.Get("isMiniaturized");
//static readonly IntPtr selIsZoomed = Selector.Get("isZoomed");
- static readonly IntPtr selPerformMiniaturize = Selector.Get("performMiniaturize:");
+ //static readonly IntPtr selPerformMiniaturize = Selector.Get("performMiniaturize:");
static readonly IntPtr selMiniaturize = Selector.Get("miniaturize:");
static readonly IntPtr selDeminiaturize = Selector.Get("deminiaturize:");
//static readonly IntPtr selPerformZoom = Selector.Get("performZoom:");
- static readonly IntPtr selZoom = Selector.Get("zoom:");
+ //static readonly IntPtr selZoom = Selector.Get("zoom:");
static readonly IntPtr selLevel = Selector.Get("level");
static readonly IntPtr selSetLevel = Selector.Get("setLevel:");
static readonly IntPtr selPresentationOptions = Selector.Get("presentationOptions");
@@ -110,6 +111,7 @@ static CocoaNativeWindow()
private int normalLevel;
private bool shouldClose;
private int suppressResize;
+ private float scrollFactor = 1.0f;
private const bool exclusiveFullscreen = false;
@@ -436,7 +438,14 @@ public void ProcessEvents()
case NSEventType.ScrollWheel:
{
var scrollingDelta = Cocoa.SendFloat(e, selScrollingDeltaY);
- InputDriver.Mouse[0].WheelPrecise += scrollingDelta;
+ var factor = 1.0f;
+
+ if (Cocoa.SendBool(e, selHasPreciseScrollingDeltas))
+ {
+ factor = 1.0f / 120.0f; // Problem: Don't know what factor to use here, but this seems to work.
+ }
+
+ InputDriver.Mouse[0].WheelPrecise += scrollingDelta * factor;
}
break;

0 comments on commit 2943bdf

Please sign in to comment.