src/video/cocoa/SDL_cocoawindow.m
changeset 6489 31449ea8f934
parent 6426 38ed71d9ae5f
child 6514 e94c2eaaa1ab
--- a/src/video/cocoa/SDL_cocoawindow.m	Fri Sep 28 02:15:44 2012 -0700
+++ b/src/video/cocoa/SDL_cocoawindow.m	Fri Sep 28 02:33:42 2012 -0700
@@ -530,14 +530,6 @@
     /* Fill in the SDL window with the window data */
     {
         NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
-        NSView *contentView = [ nswindow contentView ];
-        /* Create view if not already exists */
-        if (!contentView) {
-            contentView = [[SDLView alloc] initWithFrame:rect];
-            [nswindow setContentView: contentView];
-            [contentView release];
-        }
-
         ConvertNSRect(&rect);
         window->x = (int)rect.origin.x;
         window->y = (int)rect.origin.y;
@@ -627,6 +619,12 @@
     }
     nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:YES screen:screen];
 
+    // Create a default view for this window
+    rect = [nswindow contentRectForFrameRect:[nswindow frame]];
+    NSView *contentView = [[SDLView alloc] initWithFrame:rect];
+    [nswindow setContentView: contentView];
+    [contentView release];
+
     [pool release];
 
     if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {