Mercurial > sdl-ios-xcode
comparison src/video/cocoa/SDL_cocoawindow.m @ 3075:4c28a9655933
Fixed bug using SDL_WINDOWPOS_CENTERED with SDL_SetWindowPosition()
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 19 Feb 2009 04:15:04 +0000 |
parents | 089a77aebb7d |
children | c8f580ebc96a |
comparison
equal
deleted
inserted
replaced
3074:caffd6a5555d | 3075:4c28a9655933 |
---|---|
385 NSString *title; | 385 NSString *title; |
386 int status; | 386 int status; |
387 | 387 |
388 pool = [[NSAutoreleasePool alloc] init]; | 388 pool = [[NSAutoreleasePool alloc] init]; |
389 | 389 |
390 if (window->x == SDL_WINDOWPOS_CENTERED) { | 390 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
391 || window->x == SDL_WINDOWPOS_CENTERED) { | |
391 rect.origin.x = (CGDisplayPixelsWide(kCGDirectMainDisplay) - window->w) / 2; | 392 rect.origin.x = (CGDisplayPixelsWide(kCGDirectMainDisplay) - window->w) / 2; |
392 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { | 393 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { |
393 rect.origin.x = 0; | 394 rect.origin.x = 0; |
394 } else { | 395 } else { |
395 rect.origin.x = window->x; | 396 rect.origin.x = window->x; |
396 } | 397 } |
397 if (window->y == SDL_WINDOWPOS_CENTERED) { | 398 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
399 || window->y == SDL_WINDOWPOS_CENTERED) { | |
398 rect.origin.y = (CGDisplayPixelsHigh(kCGDirectMainDisplay) - window->h) / 2; | 400 rect.origin.y = (CGDisplayPixelsHigh(kCGDirectMainDisplay) - window->h) / 2; |
399 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { | 401 } else if (window->y == SDL_WINDOWPOS_UNDEFINED) { |
400 rect.origin.y = 0; | 402 rect.origin.y = 0; |
401 } else { | 403 } else { |
402 rect.origin.y = window->y; | 404 rect.origin.y = window->y; |
469 { | 471 { |
470 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | 472 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; |
471 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window; | 473 NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->window; |
472 NSRect rect; | 474 NSRect rect; |
473 | 475 |
474 rect.origin.x = window->x; | 476 if ((window->flags & SDL_WINDOW_FULLSCREEN) |
475 rect.origin.y = window->y; | 477 || window->x == SDL_WINDOWPOS_CENTERED) { |
478 rect.origin.x = (CGDisplayPixelsWide(kCGDirectMainDisplay) - window->w) / 2; | |
479 } else { | |
480 rect.origin.x = window->x; | |
481 } | |
482 if ((window->flags & SDL_WINDOW_FULLSCREEN) | |
483 || window->y == SDL_WINDOWPOS_CENTERED) { | |
484 rect.origin.y = (CGDisplayPixelsHigh(kCGDirectMainDisplay) - window->h) / 2; | |
485 } else { | |
486 rect.origin.y = window->y; | |
487 } | |
476 rect.size.width = window->w; | 488 rect.size.width = window->w; |
477 rect.size.height = window->h; | 489 rect.size.height = window->h; |
478 ConvertNSRect(&rect); | 490 ConvertNSRect(&rect); |
479 rect = [nswindow frameRectForContentRect:rect]; | 491 rect = [nswindow frameRectForContentRect:rect]; |
480 [nswindow setFrameOrigin:rect.origin]; | 492 [nswindow setFrameOrigin:rect.origin]; |