diff src/video/cocoa/SDL_cocoawindow.m @ 3517:e7eec78e4b92

Fixed mouse events for fullscreen windows on Mac OS X
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Dec 2009 08:33:39 +0000
parents 8fde6aeb58df
children 455a6c47d2c6
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoawindow.m	Thu Dec 03 05:05:26 2009 +0000
+++ b/src/video/cocoa/SDL_cocoawindow.m	Thu Dec 03 08:33:39 2009 +0000
@@ -235,17 +235,8 @@
 
     index = _data->videodata->mouse;
     mouse = SDL_GetMouse(index);
-
-    point = [NSEvent mouseLocation];
-    if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
-        NSRect rect = CGDisplayBounds(_data->display);
-
-        point.x = point.x - rect.origin.x;
-        point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - rect.origin.y;
-    } else {
-        point.x = point.x - window->x;
-        point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - window->y;
-    }
+    point = [theEvent locationInWindow];
+    point.y = window->h - point.y;
     if ( point.x < 0 || point.x >= window->w ||
          point.y < 0 || point.y >= window->h ) {
         if (mouse->focus != 0) {