From 326b357804f67a80a87f17b1197bf4363c8533e6 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Tue, 29 Dec 2015 01:09:58 -0500 Subject: [PATCH] Mac: don't ignore mouse clicks on the top pixel of a window (thanks, Joshua!). Fixes Bugzilla #3190. --- src/video/cocoa/SDL_cocoawindow.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index 009d15ab5bf1e..0c5f300af38d0 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -823,7 +823,14 @@ - (void)mouseDown:(NSEvent *)theEvent /* 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; }