From 870df8adabc86fca9067a69313c1afc9e8dc3241 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sun, 31 May 2015 00:50:30 -0400 Subject: [PATCH] Cocoa: ignore mouseDown events in a window's titlebar. These events accidentally slipping in sometimes appears to be a bug (or maybe new behavior) in 10.10, as previous versions of Mac OS X don't appear to ever trigger this. Thanks to Paulo Marques for pointing out the fix on the SDL mailing list! Fixes Bugzilla #2842 (again). --- src/video/cocoa/SDL_cocoawindow.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index eff5b0c41..dabbf83ce 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -751,6 +751,14 @@ SetWindowStyle(SDL_Window * window, unsigned int style) { int button; + /* Ignore events that aren't inside the client area (i.e. title bar.) */ + if ([theEvent window]) { + const NSRect windowRect = [[[theEvent window] contentView] frame]; + if (!NSPointInRect([theEvent locationInWindow], windowRect)) { + return; + } + } + if ([self processHitTest:theEvent]) { return; /* dragging, drop event. */ }