diff src/video/cocoa/SDL_cocoamodes.m @ 3528:59ff7a2beb57

Added an API function to query geometry of multiple monitors: SDL_GetDisplayBounds() Implemented multi-monitor window positions on Windows
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Dec 2009 08:03:38 +0000
parents 455a6c47d2c6
children 3d91e31fcf71
line wrap: on
line diff
--- a/src/video/cocoa/SDL_cocoamodes.m	Sun Dec 06 06:21:39 2009 +0000
+++ b/src/video/cocoa/SDL_cocoamodes.m	Sun Dec 06 08:03:38 2009 +0000
@@ -200,19 +200,18 @@
     SDL_stack_free(displays);
 }
 
-/* This is needed on 10.4, where NSRect and CGRect are different */
-NSRect
-Cocoa_DisplayBounds(CGDirectDisplayID display)
+int
+Cocoa_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
 {
-    NSRect nsrect;
+    SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
     CGRect cgrect;
 
-    cgrect = CGDisplayBounds(display);
-    nsrect.origin.x = cgrect.origin.x;
-    nsrect.origin.y = cgrect.origin.y;
-    nsrect.size.width = cgrect.size.width;
-    nsrect.size.height = cgrect.size.height;
-    return nsrect;
+    cgrect = CGDisplayBounds(displaydata->display);
+    rect->x = (int)cgrect.origin.x;
+    rect->y = (int)cgrect.origin.y;
+    rect->w = (int)cgrect.size.width;
+    rect->h = (int)cgrect.size.height;
+    return 0;
 }
 
 static void