SDL_SetDisplayMode without a window

Is there a way to change the display mode of a video display without
creating a window?

There are some references to functions such as SDL_SetDisplayMode()
and SDL_SetDisplayModeForDisplay(), but the only function I can find
in the public APIs is SDL_SetWindowDisplayMode() which does not really
do what I need.

Any ideas?

The old SDL_SetDisplayMode (SDL 1.2) depended on having a window, and
you could only have one.

Changing resolutions, except when taking a window full-screen, is and
should be considered a no-no since it does things like resize
people’s web browsers, email clients, move their desktop icons? I
used to HATE SDL games on the Mac because a bug in how SDL handled
resizing full-screen windows did exactly that. Thankfully, it was
fixed pretty soon after I discovered it.

JosephOn Thu, Oct 24, 2013 at 08:36:39AM +0200, Stefanos A. wrote:

Is there a way to change the display mode of a video display without
creating a window?

There are some references to functions such as SDL_SetDisplayMode()
and SDL_SetDisplayModeForDisplay(), but the only function I can find
in the public APIs is SDL_SetWindowDisplayMode() which does not really
do what I need.

Any ideas?

Browsing through the source code, this functionality is actually
implemented in SDL_SetDisplayModeForDisplay().

It is absolutely right that a game should not call this function. The
thing is SDL is used for more than just games, and there are still
valid reasons why the resolution of a monitor should be change-able
independent of any window.

For instance, applications with strict latency requirements for
conducting visual experiments, just to name one example.

In this specific case, I could probably override SDL and fall back to
my native code-paths which do support changing the resolution, but it
would be much nicer if SDL supported this out of the box.

Would you be willing to review patches for this feature?

2013/10/24 T. Joseph Carter :> The old SDL_SetDisplayMode (SDL 1.2) depended on having a window, and you

could only have one.

Changing resolutions, except when taking a window full-screen, is and should
be considered a no-no since it does things like resize people’s web
browsers, email clients, move their desktop icons? I used to HATE SDL games
on the Mac because a bug in how SDL handled resizing full-screen windows did
exactly that. Thankfully, it was fixed pretty soon after I discovered it.

Joseph

On Thu, Oct 24, 2013 at 08:36:39AM +0200, Stefanos A. wrote:

Is there a way to change the display mode of a video display without
creating a window?

There are some references to functions such as SDL_SetDisplayMode()
and SDL_SetDisplayModeForDisplay(), but the only function I can find
in the public APIs is SDL_SetWindowDisplayMode() which does not really
do what I need.

Any ideas?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I suspect if you submit a bug report with a patch and an explanation
of why it’s a good thing, it might get applied. :slight_smile:

I wouldn’t be the one applying it?ultimately it’d be up to Sam and
Ryan whether or not it goes in, and I told Sam I wouldn’t actually
want commit access until I were a little more comfortable working
with hg. (I’m getting there, but not quite 100% yet.)

JosephOn Thu, Oct 24, 2013 at 10:45:12AM +0200, Stefanos A. wrote:

Browsing through the source code, this functionality is actually
implemented in SDL_SetDisplayModeForDisplay().

It is absolutely right that a game should not call this function. The
thing is SDL is used for more than just games, and there are still
valid reasons why the resolution of a monitor should be change-able
independent of any window.

For instance, applications with strict latency requirements for
conducting visual experiments, just to name one example.

In this specific case, I could probably override SDL and fall back to
my native code-paths which do support changing the resolution, but it
would be much nicer if SDL supported this out of the box.

Would you be willing to review patches for this feature?

I never thought of it that way. But what if we want a different resolution in fullscreen? Also should’t we leave this for the player’s control?
Usually what I do is auto-detect the current desktop resolution and use it for fullscreen. After that the player can choose a different one in the game’s options.
Right now SDL2 has some issues changing resolutions while in fullscreen but hopefully it will be fixed soon

Joseph Carter wrote:> The old SDL_SetDisplayMode (SDL 1.2) depended on having a window, and

you could only have one.

Changing resolutions, except when taking a window full-screen, is and
should be considered a no-no since it does things like resize
people’s web browsers, email clients, move their desktop icons??? I
used to HATE SDL games on the Mac because a bug in how SDL handled
resizing full-screen windows did exactly that. Thankfully, it was
fixed pretty soon after I discovered it.

Joseph


@DJ_Link

www.david-amador.com

2013/10/24, T. Joseph Carter :

Changing resolutions, except when taking a window full-screen, is and
should be considered a no-no since it does things like resize
people’s web browsers, email clients, move their desktop icons? I
used to HATE SDL games on the Mac because a bug in how SDL handled
resizing full-screen windows did exactly that. Thankfully, it was
fixed pretty soon after I discovered it.

That happens when there isn’t a way to tell the operating system that
the resolution change is temporary (see: the whole bullshit that’s
going on with X11, which was never designed to allow changing video
modes in the first place).

Have you tried SDL_WINDOW_FULLSCREEN_DESKTOP? It works cleanly for me on
Linux and Windows, if you’re having problems with messing up other program
windows and the desktop resolution.

Jonny DOn Fri, Oct 25, 2013 at 8:26 AM, Sik the hedgehog < sik.the.hedgehog at gmail.com> wrote:

2013/10/24, T. Joseph Carter :

Changing resolutions, except when taking a window full-screen, is and
should be considered a no-no since it does things like resize
people’s web browsers, email clients, move their desktop icons? I
used to HATE SDL games on the Mac because a bug in how SDL handled
resizing full-screen windows did exactly that. Thankfully, it was
fixed pretty soon after I discovered it.

That happens when there isn’t a way to tell the operating system that
the resolution change is temporary (see: the whole bullshit that’s
going on with X11, which was never designed to allow changing video
modes in the first place).


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

In fullscreen mode, change the resolution to your heart’s content.
That’s what fullscreen apps do. :slight_smile:

JosephOn Fri, Oct 25, 2013 at 09:52:59AM +0000, ^DJ_Link^ wrote:

I never thought of it that way. But what if we want a different resolution in fullscreen? Also should’t we leave this for the player’s control?
Usually what I do is auto-detect the current desktop resolution and use it for fullscreen. After that the player can choose a different one in the game’s options.
Right now SDL2 has some issues changing resolutions while in fullscreen but hopefully it will be fixed soon

Joseph Carter wrote:

The old SDL_SetDisplayMode (SDL 1.2) depended on having a window, and
you could only have one.

Changing resolutions, except when taking a window full-screen, is and
should be considered a no-no since it does things like resize
people’s web browsers, email clients, move their desktop icons??? I
used to HATE SDL games on the Mac because a bug in how SDL handled
resizing full-screen windows did exactly that. Thankfully, it was
fixed pretty soon after I discovered it.

Joseph


@DJ_Link

www.david-amador.com


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org