src/video/cocoa/SDL_cocoawindow.m
changeset 6489 31449ea8f934
parent 6426 38ed71d9ae5f
child 6514 e94c2eaaa1ab
equal deleted inserted replaced
6488:7b2f712bdf1a 6489:31449ea8f934
   528     data->listener = [[Cocoa_WindowListener alloc] init];
   528     data->listener = [[Cocoa_WindowListener alloc] init];
   529 
   529 
   530     /* Fill in the SDL window with the window data */
   530     /* Fill in the SDL window with the window data */
   531     {
   531     {
   532         NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
   532         NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]];
   533         NSView *contentView = [ nswindow contentView ];
       
   534         /* Create view if not already exists */
       
   535         if (!contentView) {
       
   536             contentView = [[SDLView alloc] initWithFrame:rect];
       
   537             [nswindow setContentView: contentView];
       
   538             [contentView release];
       
   539         }
       
   540 
       
   541         ConvertNSRect(&rect);
   533         ConvertNSRect(&rect);
   542         window->x = (int)rect.origin.x;
   534         window->x = (int)rect.origin.x;
   543         window->y = (int)rect.origin.y;
   535         window->y = (int)rect.origin.y;
   544         window->w = (int)rect.size.width;
   536         window->w = (int)rect.size.width;
   545         window->h = (int)rect.size.height;
   537         window->h = (int)rect.size.height;
   625             rect.origin.y -= screenRect.origin.y;
   617             rect.origin.y -= screenRect.origin.y;
   626         }
   618         }
   627     }
   619     }
   628     nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:YES screen:screen];
   620     nswindow = [[SDLWindow alloc] initWithContentRect:rect styleMask:style backing:NSBackingStoreBuffered defer:YES screen:screen];
   629 
   621 
       
   622     // Create a default view for this window
       
   623     rect = [nswindow contentRectForFrameRect:[nswindow frame]];
       
   624     NSView *contentView = [[SDLView alloc] initWithFrame:rect];
       
   625     [nswindow setContentView: contentView];
       
   626     [contentView release];
       
   627 
   630     [pool release];
   628     [pool release];
   631 
   629 
   632     if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
   630     if (SetupWindowData(_this, window, nswindow, SDL_TRUE) < 0) {
   633         [nswindow release];
   631         [nswindow release];
   634         return -1;
   632         return -1;