diff src/video/cocoa/SDL_cocoawindow.m @ 3414:1e45c3012a4f

Adam Strzelecki to SDL I think something is wrong (look at the fix patch below): (1) NSRect rect shouldn't be initialized with contentRectForFrameRect: at the top of the function, contentRectForFrameRect is called in non-fullscreen case anyway (1st @@) (2) I think you've left two lines that should be removed completely (2nd @@)
author Sam Lantinga <slouken@libsdl.org>
date Fri, 23 Oct 2009 04:08:32 +0000
parents c8f580ebc96a
children e829b6098435
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoawindow.m	Fri Oct 23 03:58:23 2009 +0000
+++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Oct 23 04:08:32 2009 +0000
@@ -233,7 +233,7 @@
     int index;
     SDL_Mouse *mouse;
     NSPoint point;
-    NSRect rect = [_data->window contentRectForFrameRect:[_data->window frame]];
+    NSRect rect;
 
     index = _data->videodata->mouse;
     mouse = SDL_GetMouse(index);
@@ -242,14 +242,12 @@
     if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
         rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
         rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
+        point.x = point.x - rect.origin.x;
         point.y = rect.size.height - point.y;
     } else {
         rect = [_data->window contentRectForFrameRect:[_data->window frame]];
-        point.x = point.x - rect.origin.x;
         point.y = rect.size.height - (point.y - rect.origin.y);
     }
-    point.x = point.x - rect.origin.x;
-    point.y = rect.size.height - (point.y - rect.origin.y);
     if ( point.x < 0 || point.x >= rect.size.width ||
          point.y < 0 || point.y >= rect.size.height ) {
         if (mouse->focus != 0) {