Skip to content

Commit

Permalink
Fix mouse wheel events on macOS 10.12 (thanks Eric Wasylishen!)
Browse files Browse the repository at this point in the history
Fixes bug #3432
  • Loading branch information
slime73 committed Sep 24, 2016
1 parent 89c538a commit bac5394
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/video/cocoa/SDL_cocoamouse.m
Expand Up @@ -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)]) {
Expand All @@ -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);
}
Expand Down

0 comments on commit bac5394

Please sign in to comment.