| Summary: | SDL_WINDOWPOS_CENTERED doesn't work if used right after fullscreen -> windowed switch | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Vern Jensen <vern> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Mac OS X 10.6 | ||
Fixed, thanks! http://hg.libsdl.org/SDL/rev/6b65ff3cee62 BTW, with the latest code you shouldn't need to put the window back on the screen - it should return to its previous position. |
If my program calls SDL_SetWindowFullscreen to exit from fullscreen mode back to windowed mode, the window's position is too low on the screen. I attempted to fix this by adding a call to SDL_SetWindowPosition with SDL_WINDOWPOS_CENTERED used, but that made things far worse... the window would end up almost entirely off the screen, with just the corner of it visible in the lower-right corner of the screen. I managed to use a hack to get it to work. I found that SDL_SetWindowPosition DOES work if you use an absolute value, like 50, 50. So if I do that *first*, and *then* use SDL_WINDOWPOS_CENTERED, I get a properly centered window: // Hack to get around SDL bug, so the SECOND call works! SDL_SetWindowPosition(gSpriteWorldP->mainWindow, 50, 50); SDL_SetWindowPosition(gSpriteWorldP->mainWindow, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); Version: SDL-1.3.0-5445