src/video/cocoa/SDL_cocoawindow.m
changeset 9860 858a9b80e18a
parent 9841 aa1321ce8425
child 9897 b9b4c1bbb778
equal deleted inserted replaced
9859:2ec928ff921c 9860:858a9b80e18a
  1286 Cocoa_SetWindowSize(_THIS, SDL_Window * window)
  1286 Cocoa_SetWindowSize(_THIS, SDL_Window * window)
  1287 { @autoreleasepool
  1287 { @autoreleasepool
  1288 {
  1288 {
  1289     SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
  1289     SDL_WindowData *windata = (SDL_WindowData *) window->driverdata;
  1290     NSWindow *nswindow = windata->nswindow;
  1290     NSWindow *nswindow = windata->nswindow;
  1291 
  1291     NSRect rect;
  1292     NSRect frame = [nswindow frame];
  1292     Uint32 moveHack;
  1293     frame.origin.y = (frame.origin.y + frame.size.height) - ((float) window->h);
  1293 
  1294     frame.size.width = window->w;
  1294     /* Cocoa will resize the window from the bottom-left rather than the
  1295     frame.size.height = window->h;
  1295      * top-left when -[nswindow setContentSize:] is used, so we must set the
  1296 
  1296      * entire frame based on the new size, in order to preserve the position.
  1297     [nswindow setFrame:frame display:YES];
  1297      */
       
  1298     rect.origin.x = window->x;
       
  1299     rect.origin.y = window->y;
       
  1300     rect.size.width = window->w;
       
  1301     rect.size.height = window->h;
       
  1302     ConvertNSRect([nswindow screen], (window->flags & FULLSCREEN_MASK), &rect);
       
  1303 
       
  1304     moveHack = s_moveHack;
       
  1305     s_moveHack = 0;
       
  1306     [nswindow setFrame:[nswindow frameRectForContentRect:rect] display:YES];
       
  1307     s_moveHack = moveHack;
  1298 
  1308 
  1299     ScheduleContextUpdates(windata);
  1309     ScheduleContextUpdates(windata);
  1300 }}
  1310 }}
  1301 
  1311 
  1302 void
  1312 void