Dynamically changing video mode flags

Is there is a way to change certain video mode flags without having to quit
and restart the video subsystem?

For example (and this is what I specifically need), lets say you want an
initial screen (such as a splashscreen) to be displayed without a window
frame (using the SDL_NOFRAME flag with SDL_SetVideoMode). After this
screen, you want to have the main window of your application (which will
likely be a different size than the splashscreen) have frames.

If you call SDL_SetVideoMode again, you can change the size of the screen,
and add additional flags, but the SDL_NOFRAME flag will still be set.

I have tried to use various bitwise operators to wipe out the SDL_NOFRAME
setting, but these haven’t worked. The only thing which has worked has been
to quit the video subsystem, and then restart it (which seems like an awful
lot of work, and can even cause a short period where the new screen cannot be
blitted to).

Barring any complaints anyone has about me using a splashscreen (trust me,
for this app, this is the way I want to do it ;-)… is there a way to
re-enable frames without stopping/restarting the video subsystem?

(For those who want to look at code, the particular project this is for is
TuxReader: http://www.geekcomix.com/dm/tuxread/ , which requires SDL,
SDL_image, SDL_net, SDL_ttf, and optionally the Festival speech synthesis
system).–
Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

I have figured out a way to do this, I change the flags member of the screen
surface’s struct:

screen->flags |= ~SDL_NOFRAME;

Actually, this is the obvious way of doing it, but I have been avoiding
trying it because the SDL docs say that this member is read only.

Can anyone give me a reason why I /shouldn’t/ do this? (What problems it may
cause? If none, then I’ll just do this…)

(my original question follows)On Wednesday 22 August 2001 11:51am, Samuel Hart wrote:

Is there is a way to change certain video mode flags without having to quit
and restart the video subsystem?

For example (and this is what I specifically need), lets say you want an
initial screen (such as a splashscreen) to be displayed without a window
frame (using the SDL_NOFRAME flag with SDL_SetVideoMode). After this
screen, you want to have the main window of your application (which will
likely be a different size than the splashscreen) have frames.

If you call SDL_SetVideoMode again, you can change the size of the screen,
and add additional flags, but the SDL_NOFRAME flag will still be set.

I have tried to use various bitwise operators to wipe out the SDL_NOFRAME
setting, but these haven’t worked. The only thing which has worked has been
to quit the video subsystem, and then restart it (which seems like an awful
lot of work, and can even cause a short period where the new screen cannot
be blitted to).

Barring any complaints anyone has about me using a splashscreen (trust me,
for this app, this is the way I want to do it ;-)… is there a way to
re-enable frames without stopping/restarting the video subsystem?

(For those who want to look at code, the particular project this is for is
TuxReader: http://www.geekcomix.com/dm/tuxread/ , which requires SDL,
SDL_image, SDL_net, SDL_ttf, and optionally the Festival speech synthesis
system).


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

Hi Samuel,On Wednesday 22 August 2001 23:26, you wrote:

I have figured out a way to do this, I change the flags member of the
screen surface’s struct:

screen->flags |= ~SDL_NOFRAME;

Actually, this is the obvious way of doing it, but I have been avoiding
trying it because the SDL docs say that this member is read only.

Can anyone give me a reason why I /shouldn’t/ do this? (What problems it
may cause? If none, then I’ll just do this…)

(my original question follows)
[snip]
I think, you just stumbled over a bug of SDL (or of your window manager??).
The way you expected it, is probably the right one. I’m not sure, if I found
the bug – all I can see is that SDL only resizes the window on the second
call of SDL_SetVideoMode(). Do window managers support it to remove/add the
border later??? Perhaps in X11_SetVideoMode() one should change

if (SDL_Window && (saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL) …

to

if (SDL_Window && (saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL)
&& (saved_flags&SDL_NOFRAME) == (flags&SDL_NOFRAME)…

to enforce recreation of the window.

c ya


Benjamin Niemann (P!\K)
pink at odahoda.de
http://www.odahoda.de

I guess that if you disable something it will not be terminated at SDL_Quit(),
the same for enabling, right?
—end quoted text—On Wed, Aug 22, 2001 at 02:26:17PM -0700, Samuel Hart wrote:

I have figured out a way to do this, I change the flags member of the screen
surface’s struct:

screen->flags |= ~SDL_NOFRAME;

Actually, this is the obvious way of doing it, but I have been avoiding
trying it because the SDL docs say that this member is read only.

Can anyone give me a reason why I /shouldn’t/ do this? (What problems it may
cause? If none, then I’ll just do this…)

Marcelo R Leitner
ICQ #: 29966851

I have figured out a way to do this, I change the flags member of the
screen surface’s struct:

screen->flags |= ~SDL_NOFRAME;

Actually, this is the obvious way of doing it, but I have been avoiding
trying it because the SDL docs say that this member is read only.

Can anyone give me a reason why I /shouldn’t/ do this? (What problems it
may cause? If none, then I’ll just do this…)

I think, you just stumbled over a bug of SDL (or of your window manager??).
The way you expected it, is probably the right one. I’m not sure, if I
found the bug – all I can see is that SDL only resizes the window on the
second call of SDL_SetVideoMode(). Do window managers support it to
remove/add the border later???

I am using KDE, and yes, this is supported (many, many KDE apps do this very
thing). And, actually, doing what I mention above does work.

Perhaps in X11_SetVideoMode() one should
change

if (SDL_Window && (saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL) …

to

if (SDL_Window && (saved_flags&SDL_OPENGL) == (flags&SDL_OPENGL)
&& (saved_flags&SDL_NOFRAME) == (flags&SDL_NOFRAME)…

to enforce recreation of the window.

Perhaps :wink:

Yeah, the problem is that the saved flags aren’t being completely rewritten
here after multiple calls to SDL_SetVideoMode… Not knowing the innards of
SDL too well (I try to avoid them :wink: something like this may be whats needed.

I was just curious of there was a reason this saved flags couldn’t be
removed, or if it was just something that was overlooked.On Wednesday 22 August 2001 4:20pm, Benjamin Niemann wrote:


Sam “Criswell” Hart <@Sam_Hart> AIM, Yahoo!:
Homepage: < http://www.geekcomix.com/snh/ >
PGP Info: < http://www.geekcomix.com/snh/contact/ >
Advogato: < http://advogato.org/person/criswell/ >

I have figured out a way to do this, I change the flags member of the screen
surface’s struct:

screen->flags |= ~SDL_NOFRAME;

Actually, this is the obvious way of doing it, but I have been avoiding
trying it because the SDL docs say that this member is read only.

This sounds like a bug. Yes, this is supposed to be read-only.
I’ll look into it when I get a chance.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment