Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!).
authorRyan C. Gordon <icculus@icculus.org>
Tue, 29 Dec 2015 01:09:58 -0500
changeset 9983 bbe9ef8c2ecb
parent 9982 9145e51b15bb
child 9984 df034dc2f547
Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!). Fixes Bugzilla #3190.
src/video/cocoa/SDL_cocoawindow.m
--- a/src/video/cocoa/SDL_cocoawindow.m	Tue Dec 29 00:57:24 2015 -0500
+++ b/src/video/cocoa/SDL_cocoawindow.m	Tue Dec 29 01:09:58 2015 -0500
@@ -823,7 +823,14 @@
 
     /* Ignore events that aren't inside the client area (i.e. title bar.) */
     if ([theEvent window]) {
-        const NSRect windowRect = [[[theEvent window] contentView] frame];
+        NSRect windowRect = [[[theEvent window] contentView] frame];
+
+        /* add one to size, since NSPointInRect is exclusive of the bottom
+           edges, which mean it misses the top of the window by one pixel
+           (as the origin is the bottom left). */
+        windowRect.size.width += 1;
+        windowRect.size.height += 1;
+
         if (!NSPointInRect([theEvent locationInWindow], windowRect)) {
             return;
         }