src/video/cocoa/SDL_cocoawindow.m
changeset 5380 2de85077eb0b
parent 5379 78c071fe4c37
child 5388 6e586f65f8ef
--- a/src/video/cocoa/SDL_cocoawindow.m	Mon Feb 21 21:32:11 2011 -0800
+++ b/src/video/cocoa/SDL_cocoawindow.m	Mon Feb 21 22:03:39 2011 -0800
@@ -516,7 +516,7 @@
     {
         unsigned int style = [nswindow styleMask];
 
-        if ((style & ~NSResizableWindowMask) == NSBorderlessWindowMask) {
+        if (style == NSBorderlessWindowMask) {
             window->flags |= SDL_WINDOW_BORDERLESS;
         } else {
             window->flags &= ~SDL_WINDOW_BORDERLESS;
@@ -527,7 +527,8 @@
             window->flags &= ~SDL_WINDOW_RESIZABLE;
         }
     }
-    if ([nswindow isZoomed]) {
+    /* isZoomed always returns true if the window is not resizable */
+    if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
         window->flags |= SDL_WINDOW_MAXIMIZED;
     } else {
         window->flags &= ~SDL_WINDOW_MAXIMIZED;
@@ -540,10 +541,6 @@
     if ([nswindow isKeyWindow]) {
         window->flags |= SDL_WINDOW_INPUT_FOCUS;
         SDL_SetKeyboardFocus(data->window);
-
-        if (window->flags & SDL_WINDOW_INPUT_GRABBED) {
-            /* FIXME */
-        }
     }
 
     /* All done! */
@@ -563,20 +560,8 @@
     unsigned int style;
 
     Cocoa_GetDisplayBounds(_this, display, &bounds);
-    if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
-        rect.origin.x = bounds.x + (bounds.w - window->w) / 2;
-    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
-        rect.origin.x = bounds.x;
-    } else {
-        rect.origin.x = window->x;
-    }
-    if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
-        rect.origin.y = bounds.y + (bounds.h - window->h) / 2;
-    } else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
-        rect.origin.y = bounds.y;
-    } else {
-        rect.origin.y = window->y;
-    }
+    rect.origin.x = window->x;
+    rect.origin.y = window->y;
     rect.size.width = window->w;
     rect.size.height = window->h;
     ConvertNSRect(&rect);
@@ -763,7 +748,7 @@
 
     if ([nswindow isMiniaturized]) {
         [nswindow deminiaturize:nil];
-    } else if ([nswindow isZoomed]) {
+    } else if ((window->flags & SDL_WINDOW_RESIZABLE) && [nswindow isZoomed]) {
         [nswindow zoom:nil];
     }
     [pool release];