When the mouse is grabbed it's constrained to the client area, not the window frame.

main
Sam Lantinga 2013-11-16 21:19:16 -08:00
parent e4146267fa
commit 9dd923fb9a
1 changed files with 2 additions and 1 deletions

View File

@ -63,6 +63,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon; SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
SDL_Window *window = SDL_GetKeyboardFocus(); SDL_Window *window = SDL_GetKeyboardFocus();
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSRect windowRect; NSRect windowRect;
CGPoint eventLocation; CGPoint eventLocation;
@ -93,7 +94,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
/* This is the same coordinate system as Cocoa uses. */ /* This is the same coordinate system as Cocoa uses. */
eventLocation = CGEventGetUnflippedLocation(event); eventLocation = CGEventGetUnflippedLocation(event);
windowRect = [((SDL_WindowData *) window->driverdata)->nswindow frame]; windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) { if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) {