diff options
author | Alex Szpakowski <slime73@gmail.com> | 2016-09-24 13:28:40 -0300 |
---|---|---|
committer | Alex Szpakowski <slime73@gmail.com> | 2016-09-24 13:28:40 -0300 |
commit | 9f537957b1493beddaacb673a40f0a865474614a (patch) | |
tree | 165248bf9564077be8066fa25bea66382d971b27 /src/video/cocoa/SDL_cocoamouse.m | |
parent | 162345fdda4ffbfbc70b7588aa642776d65a1694 (diff) | |
download | sdl-9f537957b1493beddaacb673a40f0a865474614a.tar.gz |
Fix mouse wheel events on macOS 10.12 (thanks Eric Wasylishen!)
Fixes bug #3432
Diffstat (limited to 'src/video/cocoa/SDL_cocoamouse.m')
-rw-r--r-- | src/video/cocoa/SDL_cocoamouse.m | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index aa753fc12..0a27549ae 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -421,8 +421,8 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) { 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 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) } 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); } |