We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 196 - SDL_WM_SetCaption behaviour varies...
Summary: SDL_WM_SetCaption behaviour varies...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 1.2
Hardware: All All
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-09 09:24 UTC by Ryan C. Gordon
Modified: 2006-05-05 01:09 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryan C. Gordon 2006-04-09 09:24:25 UTC
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.
Comment 1 Sam Lantinga 2006-04-13 09:13:10 UTC
The correct behavior is to have the window and icon titles persist.  They are stored in SDL_VideoDevice so this is possible.
Comment 2 Max Horn 2006-04-15 08:02:15 UTC
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.
Comment 3 Ryan C. Gordon 2006-04-15 11:29:19 UTC
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.
Comment 4 Sam Lantinga 2006-04-15 12:05:03 UTC
They should all probably use wm_title and wm_icon.  I'm not sure why the X11 driver doesn't...
Comment 5 Sam Lantinga 2006-04-17 02:48:59 UTC
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.
Comment 6 Sam Lantinga 2006-05-05 01:09:37 UTC
This is fixed in subversion.  As Max mentioned, you need to call SDL_Init(SDL_INIT_VIDEO) first.