changeset 3508:a12068b6f44f

Fixed mouse coordinates for fullscreen mode
author Sam Lantinga <slouken@libsdl.org>
date Wed, 02 Dec 2009 06:10:18 +0000
parents 3712547eac4f
children 8fde6aeb58df
files src/video/cocoa/SDL_cocoawindow.m
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoawindow.m	Tue Dec 01 12:08:34 2009 +0000
+++ b/src/video/cocoa/SDL_cocoawindow.m	Wed Dec 02 06:10:18 2009 +0000
@@ -232,17 +232,16 @@
     int index;
     SDL_Mouse *mouse;
     NSPoint point;
-    NSRect rect;
 
     index = _data->videodata->mouse;
     mouse = SDL_GetMouse(index);
 
     point = [NSEvent mouseLocation];
     if ( (window->flags & SDL_WINDOW_FULLSCREEN) ) {
-        rect.size.width = CGDisplayPixelsWide(kCGDirectMainDisplay);
-        rect.size.height = CGDisplayPixelsHigh(kCGDirectMainDisplay);
+        NSRect rect = CGDisplayBounds(_data->display);
+
         point.x = point.x - rect.origin.x;
-        point.y = rect.size.height - point.y;
+        point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - rect.origin.y;
     } else {
         point.x -= window->x;
         point.y = CGDisplayPixelsHigh(kCGDirectMainDisplay) - point.y - window->y;