Commit 9dd923fb9a34352a382be0c3e8efa7ac54a3895c

Sam Lantinga 2013-11-16T21:19:16

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/video/cocoa/SDL_cocoamousetap.m b/src/video/cocoa/SDL_cocoamousetap.m
index fd79296..8f95ac3 100644
--- a/src/video/cocoa/SDL_cocoamousetap.m
+++ b/src/video/cocoa/SDL_cocoamousetap.m
@@ -63,6 +63,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
     SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)refcon;
     SDL_Mouse *mouse = SDL_GetMouse();
     SDL_Window *window = SDL_GetKeyboardFocus();
+    NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
     NSRect windowRect;
     CGPoint eventLocation;
 
@@ -93,7 +94,7 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event
 
     /* This is the same coordinate system as Cocoa uses. */
     eventLocation = CGEventGetUnflippedLocation(event);
-    windowRect = [((SDL_WindowData *) window->driverdata)->nswindow frame];
+    windowRect = [nswindow contentRectForFrameRect:[nswindow frame]];
 
     if (!NSPointInRect(NSPointFromCGPoint(eventLocation), windowRect)) {