From bac53941273d2c1f7f345f9cc01bbbee0c6e0886 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Sat, 24 Sep 2016 13:28:40 -0300 Subject: [PATCH] Fix mouse wheel events on macOS 10.12 (thanks Eric Wasylishen!) Fixes bug #3432 --- src/video/cocoa/SDL_cocoamouse.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index aa753fc121af6..0a27549ae4642 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -421,8 +421,8 @@ + (NSCursor *)invisibleCursor { SDL_Mouse *mouse = SDL_GetMouse(); - float x = -[event deltaX]; - float y = [event deltaY]; + CGFloat x = -[event deltaX]; + CGFloat y = [event deltaY]; SDL_MouseWheelDirection direction = SDL_MOUSEWHEEL_NORMAL; if ([event respondsToSelector:@selector(isDirectionInvertedFromDevice)]) { @@ -432,14 +432,14 @@ + (NSCursor *)invisibleCursor } if (x > 0) { - x += 0.9f; + x = SDL_ceil(x); } else if (x < 0) { - x -= 0.9f; + x = SDL_floor(x); } if (y > 0) { - y += 0.9f; + y = SDL_ceil(y); } else if (y < 0) { - y -= 0.9f; + y = SDL_floor(y); } SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction); }