diff --git a/src/video/cocoa/SDL_cocoamouse.m b/src/video/cocoa/SDL_cocoamouse.m index 9949c795a..24a705bed 100644 --- a/src/video/cocoa/SDL_cocoamouse.m +++ b/src/video/cocoa/SDL_cocoamouse.m @@ -315,14 +315,8 @@ Cocoa_GetGlobalMouseState(int *x, int *y) const NSPoint cocoaLocation = [NSEvent mouseLocation]; Uint32 retval = 0; - for (NSScreen *screen in [NSScreen screens]) { - NSRect frame = [screen frame]; - if (NSMouseInRect(cocoaLocation, frame, NO)) { - *x = (int) cocoaLocation.x; - *y = (int) ((frame.origin.y + frame.size.height) - cocoaLocation.y); - break; - } - } + *x = (int) cocoaLocation.x; + *y = (int) (CGDisplayPixelsHigh(kCGDirectMainDisplay) - cocoaLocation.y); retval |= (cocoaButtons & (1 << 0)) ? SDL_BUTTON_LMASK : 0; retval |= (cocoaButtons & (1 << 1)) ? SDL_BUTTON_RMASK : 0;