diff options
Diffstat (limited to 'src/newt/native')
-rw-r--r-- | src/newt/native/NewtMacWindow.m | 18 | ||||
-rw-r--r-- | src/newt/native/WindowsWindow.c | 2 |
2 files changed, 7 insertions, 13 deletions
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m index 1018633b1..ce41673c4 100644 --- a/src/newt/native/NewtMacWindow.m +++ b/src/newt/native/NewtMacWindow.m @@ -44,15 +44,17 @@ jint GetDeltaY(NSEvent *event, jint javaMods) { // mouse pad case deltaY = CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1); + // fprintf(stderr, "WHEEL/PAD: %lf\n", (double)deltaY); } else { // traditional mouse wheel case deltaY = [event deltaY]; + // fprintf(stderr, "WHEEL/TRAD: %lf\n", (double)deltaY); if (deltaY == 0.0 && (javaMods & EVENT_SHIFT_MASK) != 0) { // shift+vertical wheel scroll produces horizontal scroll // we convert it to vertical deltaY = [event deltaX]; } - if (deltaY < 1.0 && deltaY > -1.0) { + if (-1.0 < deltaY && deltaY < 1.0) { deltaY *= 10.0; } else { if (deltaY < 0.0) { @@ -62,14 +64,8 @@ jint GetDeltaY(NSEvent *event, jint javaMods) { } } } - - if (deltaY > 0) { - return (NSInteger)deltaY; - } else if (deltaY < 0) { - return -(NSInteger)deltaY; - } - - return 0; + // fprintf(stderr, "WHEEL/res: %d\n", (int)deltaY); + return (jint) deltaY; } static jmethodID enqueueMouseEventID = NULL; @@ -581,6 +577,7 @@ static jint mods2JavaMods(NSUInteger mods) switch ([event type]) { case NSScrollWheel: { scrollDeltaY = GetDeltaY(event, javaMods); + javaButtonNum = 1; break; } case NSLeftMouseDown: @@ -598,9 +595,6 @@ static jint mods2JavaMods(NSUInteger mods) case NSOtherMouseDragged: javaButtonNum = 2; break; - default: - javaButtonNum = 0; - break; } if (evType == EVENT_MOUSE_WHEEL_MOVED && scrollDeltaY == 0) { diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index b654fbe85..9b97895c6 100644 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -953,7 +953,7 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, (jint) EVENT_MOUSE_WHEEL_MOVED, GetModifiers(), (jint) eventPt.x, (jint) eventPt.y, - (jint) 0, (jint) (GET_WHEEL_DELTA_WPARAM(wParam)/120.0f)); + (jint) 1, (jint) (GET_WHEEL_DELTA_WPARAM(wParam)/120.0f)); useDefWindowProc = 1; break; } |