Fixed bug 1167 (SDL_WINDOWPOS_CENTERED doesn't work if used right after fullscreen -> windowed switch)

The top level code handles SDL_WINDOWPOS_CENTERED now, and the Cocoa SetWindowPosition call will clear the moveHack before adjusting the window position.
This commit is contained in:
Sam Lantinga 2011-03-11 16:54:43 -08:00
parent 06a33455ca
commit 0eb0a30eca
5 changed files with 27 additions and 65 deletions

View file

@ -260,29 +260,11 @@ void
DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
{
SDL_DFB_WINDOWDATA(window);
SDL_DFB_DISPLAYDATA(window);
int x, y;
if (SDL_WINDOWPOS_ISCENTERED(window->x)) {
x = (dispdata->cw - window->w) / 2;
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->x)) {
x = 0;
} else {
x = window->x;
}
if (SDL_WINDOWPOS_ISCENTERED(window->y)) {
y = (dispdata->ch - window->h) / 2;
} else if (SDL_WINDOWPOS_ISUNDEFINED(window->y)) {
y = 0;
} else {
y = window->y;
}
x = window->x;
y = window->y;
if (window->flags & SDL_WINDOW_FULLSCREEN) {
x = 0;
y = 0;
}
DirectFB_WM_AdjustWindowLayout(window, window->flags, window->w, window->h);
SDL_DFB_CHECK(windata->dfbwin->MoveTo(windata->dfbwin, x, y));
}