[PATCH] SetWindowSize and SetWindowDisplayMode should take effect immediately

Hi all,

At the moment, SDL_SetWindowSize and SDL_SetWindowDisplayMode do not
change the resolution of a fullscreen window: you have to disable
fullscreen, change either the size or display mode and then re-enable
fullscreen. It seems to me that one (or both) of them should immediately
update the screen resolution, rather than waiting until the fullscreen
flag is next set.

In particular, if SDL_SetWindowSize changes the fullscreen resolution,
it’s easy to write code to change resolution that works independently of
fullscreen mode. We’re hoping to use this in an SDL2 OpenTK backend[1]
to fix some MonoGame issues, and it certainly makes things much easier
there! There’s a FIXME in the code which seems to suggest that this was
the intended behaviour, is this a change you guys want?

I’ve attached a patch that implements this, though it could probably do
with some more testing, particularly on non-Linux/X11 platforms. There’s
no platform specific stuff there, but I’ve learned never to trust window
managers. :slight_smile:

– David
-------------- next part --------------
A non-text attachment was scrubbed…
Name: sdl-windowsize-displaymode-fix.patch
Type: text/x-patch
Size: 1602 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20130222/4d3e5a4a/attachment.bin

Can we please not do that?? Games that change my screen resolution on me are a huge pet peeve, because I’m always alt-tabbing in and out of fullscreen games to deal with other things, and changing resolutions tends to have nasty side effects, such as resizing my other windows.

If you want a different apparent resolution than the physical resolution, that’s what the Logical Size feature is for.? (Did that ever get officially merged into SDL2? I think it did…)

Mason________________________________
From: David Gow
To: SDL Development List
Sent: Thursday, February 21, 2013 8:09 AM
Subject: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode should take effect immediately

Hi all,

At the moment, SDL_SetWindowSize and SDL_SetWindowDisplayMode do not
change the resolution of a fullscreen window: you have to disable
fullscreen, change either the size or display mode and then re-enable
fullscreen. It seems to me that one (or both) of them should immediately
update the screen resolution, rather than waiting until the fullscreen
flag is next set.

In particular, if SDL_SetWindowSize changes the fullscreen resolution,
it’s easy to write code to change resolution that works independently of
fullscreen mode. We’re hoping to use this in an SDL2 OpenTK backend[1]
to fix some MonoGame issues, and it certainly makes things much easier
there! There’s a FIXME in the code which seems to suggest that this was
the intended behaviour, is this a change you guys want?

I’ve attached a patch that implements this, though it could probably do
with some more testing, particularly on non-Linux/X11 platforms. There’s
no platform specific stuff there, but I’ve learned never to trust window
managers. :slight_smile:

– David


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

Can we please not do that? Games that change my screen resolution on
me are a huge pet peeve, because I’m always alt-tabbing in and out of
fullscreen games to deal with other things, and changing resolutions
tends to have nasty side effects, such as resizing my other windows.

I agree entirely that it’s a pain, but that’s the way most (especially
older) games expect to work, and it’s not always practical to rewrite
things to use FBOs to simulate resolution changes, particularly if you
want to support systems which might not support framebuffers. Believe me
when I say that changing resolutions is something I’d much rather avoid
doing.

If you want a different apparent resolution than the physical
resolution, that’s what the Logical Size feature is for. (Did that ever
get officially merged into SDL2? I think it did…)

I’m not sure about the SDL render API, but certainly there’s no way of
getting SDL to fake resolution changes in OpenGL: it has to be
implemented manually on a game-by-game basis, which is far from
practical on older titles, and can incur a performance hit or reduction
in visual quality.

This patch really just fixes issues with the existing behaviour:
FULLSCREEN_DESKTOP still exists if you’re not going to change the
hardware resolution (this is, I believe, what Half-Life does), but if
it’s not possible, it’d be nice to have the resolution changing code as
good as possible, such that the problems you mentioned are minimised.

– David> Mason


From: David Gow <@David_Gow>
To: SDL Development List
Sent: Thursday, February 21, 2013 8:09 AM
Subject: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode should
take effect immediately

Hi all,

At the moment, SDL_SetWindowSize and SDL_SetWindowDisplayMode do not
change the resolution of a fullscreen window: you have to disable
fullscreen, change either the size or display mode and then re-enable
fullscreen. It seems to me that one (or both) of them should immediately
update the screen resolution, rather than waiting until the fullscreen
flag is next set.

In particular, if SDL_SetWindowSize changes the fullscreen resolution,
it’s easy to write code to change resolution that works independently of
fullscreen mode. We’re hoping to use this in an SDL2 OpenTK backend[1]
to fix some MonoGame issues, and it certainly makes things much easier
there! There’s a FIXME in the code which seems to suggest that this was
the intended behaviour, is this a change you guys want?

I’ve attached a patch that implements this, though it could probably do
with some more testing, particularly on non-Linux/X11 platforms. There’s
no platform specific stuff there, but I’ve learned never to trust window
managers. :slight_smile:

– David


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


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

There is a way to get SDL to fake resolution changes on OpenGL, with the Logical Size
patch I submitted a while back, that I think ended up getting merged into the codebase.
(Not sure though.)? Basically, it calls glOrtho with a different size than the pixel size of
the window, and it’s as simple as that.? (As long as you’re staying in SDL’s 2D drawing,
of course.)

Mason________________________________
From: David Gow
To: sdl at lists.libsdl.org
Sent: Thursday, February 21, 2013 8:58 AM
Subject: Re: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode should take effect immediately

Can we please not do that?? Games that change my screen resolution on
me are a huge pet peeve, because I’m always alt-tabbing in and out of
fullscreen games to deal with other things, and changing resolutions
tends to have nasty side effects, such as resizing my other windows.

I agree entirely that it’s a pain, but that’s the way most (especially
older) games expect to work, and it’s not always practical to rewrite
things to use FBOs to simulate resolution changes, particularly if you
want to support systems which might not support framebuffers. Believe me
when I say that changing resolutions is something I’d much rather avoid
doing.

If you want a different apparent resolution than the physical
resolution, that’s what the Logical Size feature is for.? (Did that ever
get officially merged into SDL2? I think it did…)

I’m not sure about the SDL render API, but certainly there’s no way of
getting SDL to fake resolution changes in OpenGL: it has to be
implemented manually on a game-by-game basis, which is far from
practical on older titles, and can incur a performance hit or reduction
in visual quality.

This patch really just fixes issues with the existing behaviour:
FULLSCREEN_DESKTOP still exists if you’re not going to change the
hardware resolution (this is, I believe, what Half-Life does), but if
it’s not possible, it’d be nice to have the resolution changing code as
good as possible, such that the problems you mentioned are minimised.

– David

Mason


From: David Gow
To: SDL Development List
Sent: Thursday, February 21, 2013 8:09 AM
Subject: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode should
take effect immediately

Hi all,

At the moment, SDL_SetWindowSize and SDL_SetWindowDisplayMode do not
change the resolution of a fullscreen window: you have to disable
fullscreen, change either the size or display mode and then re-enable
fullscreen. It seems to me that one (or both) of them should immediately
update the screen resolution, rather than waiting until the fullscreen
flag is next set.

In particular, if SDL_SetWindowSize changes the fullscreen resolution,
it’s easy to write code to change resolution that works independently of
fullscreen mode. We’re hoping to use this in an SDL2 OpenTK backend[1]
to fix some MonoGame issues, and it certainly makes things much easier
there! There’s a FIXME in the code which seems to suggest that this was
the intended behaviour, is this a change you guys want?

I’ve attached a patch that implements this, though it could probably do
with some more testing, particularly on non-Linux/X11 platforms. There’s
no platform specific stuff there, but I’ve learned never to trust window
managers. :slight_smile:

– David


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


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


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

2013/2/21, Mason Wheeler :

Can we please not do that? Games that change my screen resolution on me
are a huge pet peeve, because I’m always alt-tabbing in and out of
fullscreen games to deal with other things, and changing resolutions tends
to have nasty side effects, such as resizing my other windows.

I think your problem here is (non-fake) fullscreen, not what’s being
discussed in this thread.

And the side-effects are a result of the window manager not having
proper fullscreen support, it isn’t a problem with fullscreen itself
(in fact, it isn’t a problem in Windows at all unless you’re a playing
a very old game). This has already been discussed before and even
there has been a proposal to fix it at the root of the problem. Did
that ever pick up momentum, though?

There is a way to get SDL to fake resolution changes on OpenGL, with the
Logical Size
patch I submitted a while back, that I think ended up getting merged
into the codebase.
(Not sure though.) Basically, it calls glOrtho with a different size
than the pixel size of
the window, and it’s as simple as that. (As long as you’re staying in
SDL’s 2D drawing,
of course.)

Yeah: I’m not using SDL’s 2D drawing API, and deadlines prevent a total
rewrite to make things resolution independent in this particular project.

Basically this patch makes resolution changes work the way you’d expect,
but has no effect if the developer is not changing resolution at all.

– DavidOn 22/02/13 02:34, Mason Wheeler wrote:

Mason


From: David Gow <@David_Gow>
To: sdl at lists.libsdl.org
Sent: Thursday, February 21, 2013 8:58 AM
Subject: Re: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode
should take effect immediately

Can we please not do that? Games that change my screen resolution on
me are a huge pet peeve, because I’m always alt-tabbing in and out of
fullscreen games to deal with other things, and changing resolutions
tends to have nasty side effects, such as resizing my other windows.

I agree entirely that it’s a pain, but that’s the way most (especially
older) games expect to work, and it’s not always practical to rewrite
things to use FBOs to simulate resolution changes, particularly if you
want to support systems which might not support framebuffers. Believe me
when I say that changing resolutions is something I’d much rather avoid
doing.

If you want a different apparent resolution than the physical
resolution, that’s what the Logical Size feature is for. (Did that ever
get officially merged into SDL2? I think it did…)

I’m not sure about the SDL render API, but certainly there’s no way of
getting SDL to fake resolution changes in OpenGL: it has to be
implemented manually on a game-by-game basis, which is far from
practical on older titles, and can incur a performance hit or reduction
in visual quality.

This patch really just fixes issues with the existing behaviour:
FULLSCREEN_DESKTOP still exists if you’re not going to change the
hardware resolution (this is, I believe, what Half-Life does), but if
it’s not possible, it’d be nice to have the resolution changing code as
good as possible, such that the problems you mentioned are minimised.

– David

Mason


From: David Gow <@David_Gow
mailto:David_Gow>
To: SDL Development List <sdl at lists.libsdl.org
<mailto:sdl at lists.libsdl.org>>
Sent: Thursday, February 21, 2013 8:09 AM
Subject: [SDL] [PATCH] SetWindowSize and SetWindowDisplayMode should
take effect immediately

Hi all,

At the moment, SDL_SetWindowSize and SDL_SetWindowDisplayMode do not
change the resolution of a fullscreen window: you have to disable
fullscreen, change either the size or display mode and then re-enable
fullscreen. It seems to me that one (or both) of them should immediately
update the screen resolution, rather than waiting until the fullscreen
flag is next set.

In particular, if SDL_SetWindowSize changes the fullscreen resolution,
it’s easy to write code to change resolution that works independently of
fullscreen mode. We’re hoping to use this in an SDL2 OpenTK backend[1]
to fix some MonoGame issues, and it certainly makes things much easier
there! There’s a FIXME in the code which seems to suggest that this was
the intended behaviour, is this a change you guys want?

I’ve attached a patch that implements this, though it could probably do
with some more testing, particularly on non-Linux/X11 platforms. There’s
no platform specific stuff there, but I’ve learned never to trust window
managers. :slight_smile:

– David


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


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


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


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