| Summary: | SDL_WM_SetCaption behaviour varies... | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ryan C. Gordon <icculus> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | max |
| Version: | HG 1.2 | ||
| Hardware: | All | ||
| OS: | All | ||
The correct behavior is to have the window and icon titles persist. They are stored in SDL_VideoDevice so this is possible. Actually, the Quartz backend works correctly (no surprise, it uses wm_title / wm_icon to achieve just that), *provided* you add SDL_Init(SDL_INIT_VIDEO); to the start of your test program. Without that, it behaves indeed oddly, but I thought we are required to call SDL_Init anyway? Looking through the various video drivers, the windows one uses wm_title / wm_icon, too. No other driver seems to do that, but that doesn't mean they behave incorrectly, of course. Whoops! I'm surprised that worked at all without the SDL_Init call, too, but I'm sure I saw the wrong behaviour with an SDL_Init, too, on one of my projects. I'll have to recheck. --ryan. They should all probably use wm_title and wm_icon. I'm not sure why the X11 driver doesn't... Feel free to change the X11 driver to use wm_title and wm_icon. I'm pretty sure it wasn't done that way originally just to prevent a memory leak with the atoms when changing video modes. This is fixed in subversion. As Max mentioned, you need to call SDL_Init(SDL_INIT_VIDEO) first. |
On Mac OS X, calling SDL_WM_SetCaption() before SDL_SetVideoMode() works, but recalling SDL_SetVideoMode() (for example, to toggle fullscreen/windowed), results in a window without a caption. Should this state be kept permanently, or is it only meant to be valid until SetVideoMode returns? On Linux/x11, setting the caption before SetVideoMode results in an empty title bar...it has to be called after SetVideoMode returns successfully. Which behaviour is correct? Is either correct? Tested on Linux/x11 and Mac OS X/quartz. #include "SDL.h" int main(int argc, char **argv) { SDL_WM_SetCaption("title", "icon"); SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN); SDL_Delay(3000); SDL_SetVideoMode(640, 480, 0, 0); SDL_Delay(5000); SDL_Quit(); return 0; } --ryan.