SDL_SetWindowFullscreen & changing window size

Hi,

This is on Windows 7, with SDL2 revision 7020:a500a9dbfb41.

For application A, the following sequence of calls are made:

SDL_CreateWindow(…, 800, 500, …)
SDL_SetWindowFullscreen(window, 1);
SDL_SetWindowFullscreen(window, 0);

This leaves it with a window of size 800x600, with a new black border
at the bottom of the window.

For application B, the following sequence of calls are made:

SDL_CreateWindow(…, 1200, 714, …)
SDL_SetWindowFullscreen(window, 1);
SDL_SetWindowFullscreen(window, 0);

This leaves it with a window of size 1280x720, with new black borders
to the bottom and right of the window.

For what it’s worth here’s my local printfs for the 800x500
application, which I have no idea how to take further:

SDL: SDL_windowswindow.c: WIN_SetWindowFullscreen: rect.left 0
rect.top 0 rect.right 800 rect.bottom 500
SDL: SDL_windowswindow.c: WIN_SetWindowFullscreen: x 280 y 109 w 806 h 528
SDL: SDL_windowsevents.c: WIN_WindowProc: WM_WINDOWPOSCHANGED: w 800 h 600
SDL: SDL_events.c: SDL_SendWindowEvent(SDL_WINDOWEVENT_RESIZED):
original windowed size = 800,
500 -> 800, 600

Cheers,
Richard.

I would expect that behavior as those are not valid full-screen resolutions on your monitor. When SDL goes full-screen it first validates the resolution against the supported resolutions of the monitor (as provided by the OS) and “adjusts” the width/height accordingly.

You just need to listen to the window resize SDL event to detect when this occurs and adjust your application rendering appropriately.On Mar 21, 2013, at 18:16 , Richard Tew wrote:

Hi,

This is on Windows 7, with SDL2 revision 7020:a500a9dbfb41.

For application A, the following sequence of calls are made:

SDL_CreateWindow(…, 800, 500, …)
SDL_SetWindowFullscreen(window, 1);
SDL_SetWindowFullscreen(window, 0);

This leaves it with a window of size 800x600, with a new black border
at the bottom of the window.

For application B, the following sequence of calls are made:

SDL_CreateWindow(…, 1200, 714, …)
SDL_SetWindowFullscreen(window, 1);
SDL_SetWindowFullscreen(window, 0);

This leaves it with a window of size 1280x720, with new black borders
to the bottom and right of the window.

For what it’s worth here’s my local printfs for the 800x500
application, which I have no idea how to take further:

SDL: SDL_windowswindow.c: WIN_SetWindowFullscreen: rect.left 0
rect.top 0 rect.right 800 rect.bottom 500
SDL: SDL_windowswindow.c: WIN_SetWindowFullscreen: x 280 y 109 w 806 h 528
SDL: SDL_windowsevents.c: WIN_WindowProc: WM_WINDOWPOSCHANGED: w 800 h 600
SDL: SDL_events.c: SDL_SendWindowEvent(SDL_WINDOWEVENT_RESIZED):
original windowed size = 800,
500 -> 800, 600

Cheers,
Richard.


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

Edward Rudd
OutOfOrder.cc
Skype: outoforder_cc
317-674-3296