The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Kenneth Bull
Guest

This code never gives me an error message, but never switches to/from
fullscreen mode either:
while(SDL_WaitEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
return 0;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case 'f':
fullscreen = !fullscreen;
if (SDL_SetWindowFullscreen(event.key.windowID, fullscreen) != 0) {
printf ("Unable to switch window to fullscreen mode:
%s\n", SDL_GetError());
SDL_ClearError();
}
break;
case 'q':
case SDLK_ESCAPE:
return 0;
}
break;
case SDL_WINDOWEVENT:
switch (event.window.event) {
case SDL_WINDOWEVENT_RESIZED:
printf("Window %u resized to %d x %d.\n",
event.window.windowID, event.window.data1, event.window.data2);
break;
case SDL_WINDOWEVENT_CLOSE:
SDL_HideWindow(event.window.windowID);
return 0;
}
break;
}
}

Also, the SDL_WINDOW_FULLSCREEN flag, when used with SDL_CreateWindow,
produces a window with no border or window decorations centered in the
middle of the screen instead of a fullscreen window.

The full test program is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fullscreentest.c
Type: text/x-csrc
Size: 1714 bytes
Desc: not available
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090730/2fa66b67/attachment.c>
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Sam Lantinga
Guest

Yeah, the fullscreen stuff isn't completely implemented yet, although I'll
fix the API call to return the correct status. What platform are you
running on?

Thanks!

On Thu, Jul 30, 2009 at 2:25 AM, Kenneth Bull <llubnek at gmail.com> wrote:

Quote:
This code never gives me an error message, but never switches to/from
fullscreen mode either:
while(SDL_WaitEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
return 0;
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case 'f':
fullscreen = !fullscreen;
if (SDL_SetWindowFullscreen(event.key.windowID, fullscreen) !=
0) {
printf ("Unable to switch window to fullscreen mode:
%s\n", SDL_GetError());
SDL_ClearError();
}
break;
case 'q':
case SDLK_ESCAPE:
return 0;
}
break;
case SDL_WINDOWEVENT:
switch (event.window.event) {
case SDL_WINDOWEVENT_RESIZED:
printf("Window %u resized to %d x %d.\n",
event.window.windowID, event.window.data1, event.window.data2);
break;
case SDL_WINDOWEVENT_CLOSE:
SDL_HideWindow(event.window.windowID);
return 0;
}
break;
}
}

Also, the SDL_WINDOW_FULLSCREEN flag, when used with SDL_CreateWindow,
produces a window with no border or window decorations centered in the
middle of the screen instead of a fullscreen window.

The full test program is attached.

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




--
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090802/4acf1fa8/attachment.htm>
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Kenneth Bull
Guest

2009/8/2 Sam Lantinga <slouken at libsdl.org>:
Quote:
Yeah, the fullscreen stuff isn't completely implemented yet, although I'll
fix the API call to return the correct status.? What platform are you
running on?

Linux Mint 7 Gloria x64 (based on Ubuntu 9.04 Jaunty) on an Athlon 64.
video driver would be x11
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
What is the current status of this with SDL 1.3?

I'm running with Win32, and it does switch to full screen and back again, but the fullscreen display mode and position leaves something to be desired. It's not clear to me from the source code whether I should be doing something about size and position or whether that is work that remains to be done.

I could use some guidance here.

Walt
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
Going fullscreen works on Windows and Mac OS X, but if you're
specifying a mode that isn't one of the available video modes, it
doesn't properly center the display yet.

See ya!

On Wed, Dec 23, 2009 at 11:26 AM, WaltN wrote:
Quote:
What is the current status of this with SDL 1.3?

I'm running with Win32, and it does switch to full screen and back again,
but the fullscreen display mode and position leaves something to be desired.
It's not clear to me from the source code whether I should be doing
something about size and position or whether that is work that remains to be
done.

I could use some guidance here.

Walt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
Going fullscreen works on Windows and Mac OS X, but if you're
specifying a mode that isn't one of the available video modes, it
doesn't properly center the display yet.

See ya!

On Wed, Dec 23, 2009 at 11:26 AM, WaltN wrote:
Quote:
What is the current status of this with SDL 1.3?

I'm running with Win32, and it does switch to full screen and back again,
but the fullscreen display mode and position leaves something to be desired.
It's not clear to me from the source code whether I should be doing
something about size and position or whether that is work that remains to be
done.

I could use some guidance here.

Walt
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
What I'm experiencing (with Windows Vista and SVN 5431) is that I have to set the window size following an SDL_SetWindowFullscreen in order to get a window of the proper size. I am specifying a proper display mode (one of those enumerated).

And, just to make sure we're on the same wavelength, what I get following an SDL_SetWindowFullscreen is a correct change of the Desktop display mode. The SDL window has a border and it needs to be resized and positioned in order to "fool" a user into seeing fullscreen mode.
hardcoder


Joined: 06 Jan 2010
Posts: 84
Location: Poznan, Poland
In my case fullscreen on Windows starts correctly only with "d3d" renderer selected. For "gdi" or "opengl" window has correct size but is not correctly positioned.
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
I thought it might be worthwhile for me to post fragments of my code. First, here is my default window creation:
Code:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

Uint32 flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;

 window=SDL_CreateWindow("GLTest3[__cdecl]",
   lastWindowedPosSize.x, lastWindowedPosSize.y, lastWindowedPosSize.w, lastWindowedPosSize.h,
   flags);

Desired fullscreen characteristics:
Code:
// Make fullscreen mode same as Desktop
SDL_GetDesktopDisplayMode(&fsmode);
SDL_SetWindowDisplayMode(window, &fsmode); // Set fullscreen mode characteristics

When I want to switch to fullscreen mode:
Code:
SDL_SetWindowFullscreen(windowID, 1); // Go to fullscreen mode

The fullscreen characteristics I get are a window with a resizeable border, and whose position is way off. I work around this by setting the size and position AFTER the call to SDL_SetWindow DisplayMode. But, the window I get is never a real borderless fullscreen window. (This with Vista.)

It would be nice to have an example of code that works with the desired behavior.
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Terry Welsh
Guest

Quote:
The fullscreen characteristics I get are a window with a resizeable border, and whose position is way off. I work around this by setting the size and position AFTER the call to SDL_SetWindow DisplayMode. But, the window I get is never a real borderless fullscreen window. (This with Vista.)

It would be nice to have an example of code that works with the desired behavior.


I also cannot get fullscreen mode to work with SDL 1.3. I wrote a
stripped down program which you can see below.

This program starts up in windowed mode. If I press F1 to go
fullscreen, nothing happens. But if I then move the mouse outside the
window, it disappears and the program is still running. Creating the
window with SDL_WINDOW_FULLSCREEN gives me a borderless window of the
size specified (it does not fill the screen) that does not accept
keyboard input.

Is there something I'm missing? I haven't found much sample code for
windowing with 1.3, so this is the best I've come up with so far.
--
Terry Welsh / mogumbo 'at' gmail.com
www.reallyslick.com / www.mogumbo.com



#include <SDL.h>
#include <iostream>
#include <GL/gl.h>

#define SDL_NO_COMPAT

using namespace std;

static bool gQuit(false);
static SDL_WindowID gWindow;
static SDL_GLContext gGLContext;

int gWinW = 640;
int gWinH = 480;
bool gFullscreen = false;


void resize(int w, int h){
if(gFullscreen)
SDL_SetWindowFullscreen(gWindow, 1);
else{
SDL_SetWindowFullscreen(gWindow, 0);
SDL_SetWindowSize(gWindow, w, h);
gWinW = w;
gWinH = h;
}

glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glOrtho(-1,1,-1,1,-1,1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}


void toggleFullscreen(){
gFullscreen = !gFullscreen;
resize(gWinW, gWinH);
cout << "fullscreen = " << int(gFullscreen) << endl;
}



void processEvents(){
SDL_Event event;
while(SDL_PollEvent(&event)){
switch(event.type){
case SDL_WINDOWEVENT:
switch(event.window.event){
case SDL_WINDOWEVENT_RESIZED:
resize(event.window.data1, event.window.data2);
break;
}
break;
case SDL_QUIT:
gQuit = true;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym){
case SDLK_ESCAPE:
gQuit = true;
break;
case SDLK_F1:
toggleFullscreen();
break;
}
break;
}
}
}


int main(int argc, char* argv[]){
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC) < 0){
cout << "Unable to init SDL: " << SDL_GetError() << endl;
exit(1);
}
atexit(SDL_Quit);

SDL_GL_SetAttribute(SDL_GL_RED_SIZE, Cool;
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, Cool;
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, Cool;
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
gWindow = SDL_CreateWindow("Retrobooster", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, gWinW, gWinH, SDL_WINDOW_OPENGL |
SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
gGLContext = SDL_GL_CreateContext(gWindow);
SDL_GL_SetSwapInterval(1); // v-sync on

resize(gWinW, gWinH);

while(!gQuit){
processEvents();

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor4f(1,1,1,1);
glBegin(GL_TRIANGLE_STRIP);
glVertex3f(-0.5f, -0.5f, 0.0f);
glVertex3f(0.5f, -0.5f, 0.0f);
glVertex3f(0.5f, 0.5f, 0.0f);
glEnd();

SDL_GL_SwapWindow(gWindow);
}

SDL_GL_DeleteContext(gGLContext);
SDL_DestroyWindow(gWindow);

return 1;
}
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
Quote:
This program starts up in windowed mode. If I press F1 to go
fullscreen, nothing happens.
When I build my code (above) without specifying an SDL_DisplayMode structure (as I believe you have done), SDL 1.3 is supposed to select a default display mode. When I do this, I don't get nothing. Rather, I get what looks to be 640x480 and a poorly positioned SDL window with a border.

You might try specifying an SDL_DisplayMode structure either as I have (Desktop mode) or explicitly (e.g., pixel format of SDL_RGB888). Also, I've seen statements that suggest playing with depth buffer size (16, 24, 32).
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Terry Welsh
Guest

Thanks for the ideas Walt. No luck, though. I added this during
initialization:

SDL_DisplayMode fsmode;
SDL_GetDesktopDisplayMode(&fsmode);
cout << fsmode.format << " " << fsmode.w << " " << fsmode.h << " " <<
fsmode.refresh_rate << " " << int(fsmode.driverdata) << endl;
cout << "SDL_SetWindowDisplayMode = " <<
SDL_SetWindowDisplayMode(gWindow, &fsmode) << endl;

The output I get is this:

2249594884 1920 1200 0 0
SDL_SetWindowDisplayMode = 0

Looks like my format was already set to SDL_PIXELFORMAT_RGB888.
--
Terry Welsh / mogumbo 'at' gmail.com
www.reallyslick.com / www.mogumbo.com


Quote:
Message: 1
Date: Wed, 20 Jan 2010 08:09:50 -0800
From: "WaltN"
To:
Subject: Re: [SDL] SDL_SetWindowFullscreen fails to set window to
fullscreen mo
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"


Quote:
This program starts up in windowed mode. If I press F1 to go
fullscreen, nothing happens.
When I build my code (above) without specifying an SDL_DisplayMode structure (as I believe you have done), SDL 1.3 is supposed to select a default display mode. When I do this, I don't get nothing. Rather, I get what looks to be 640x480 and a poorly positioned SDL window with a border.

You might try specifying an SDL_DisplayMode structure either as I have (Desktop mode) or explicitly (e.g., pixel format of SDL_RGB888). Also, I've seen statements that suggest playing with depth buffer size (16, 24, 32).


_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Forest Hale
Guest

On 01/19/2010 06:53 PM, Terry Welsh wrote:
Quote:
#include <SDL.h>
#include <iostream>
#include <GL/gl.h>

#define SDL_NO_COMPAT

I could be wrong, but shouldn't SDL_NO_COMPAT be defined before including <SDL.h> ? A quick search indicates this is the case.

--
Forest 'LordHavoc' Hale
Author of DarkPlaces Quake1 engine and mod
http://icculus.org/twilight/darkplaces
Address: 94340 Horton Road Blachly OR 97412
Phone/Fax: 541-925-4130

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
In my case, #define SDL_NO_COMPAT doesn't make any difference. When I don't set size and position following a toggle to fullscreen, I get the same result as Terry Welsh -- no apparent effect. But, if I include setting size and position, the window is still bordered and resizeable. If I accept the default fullscreen mode, I get what looks like a 640x480 bordered window badly placed on a 640x480 desktop.

I get the feeling we're doing something basic that is dead wrong; hence the plea for sample code of the correct way to get the correct behavior.
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Terry Welsh
Guest

That's correct, I have SDL_NO_COMPAT in the wrong place. I'll switch
it when I get home tonight but it shouldn't make any difference. The
code I sent was stripped down from my game code where SDL_NO_COMPAT is
part of the makefile. I just got it in the wrong order when I
stripped it down.

I tried stepping through the code to compare the SDL_compat path with
my new 1.3-based code. Unfortunately, ddd wasn't cooperating and
skipping around a lot (reminded me of debugging in VS). Anyway, as
best I can tell in the SDL_compat path the window is destroyed and
created again as a fullscreen window, a behavior I couldn't manage to
mimic properly. My new 1.3-based path goes through the
SDL_SetWindowFullscreen() but never seems to do any of the necessary
things I'd expect, such as calling SDL_SetWindowPosition() and
SDL_SetWindowSize(). Maybe that code is just unfinished.

Still stumped. I'll probably try harder to mimic what SDL_compat
does. I can't think of anything else to try without a good example
program or documentation that says how to go fullscreen.
--
Terry


Quote:
------------------------------

Message: 9
Date: Thu, 21 Jan 2010 05:54:09 -0800
From: "WaltN"
To:
Subject: Re: [SDL] SDL_SetWindowFullscreen fails to set window to
       fullscreen      mo
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"

In my case, #define SDL_NO_COMPAT doesn't make any difference.  When I don't set size and position following a toggle to fullscreen, I get the same result as Terry Welsh -- no apparent effect.  But, if I include setting size and position, the window is still bordered and resizeable.  If I accept the default fullscreen mode, I get what looks like a 640x480 bordered window badly placed on a 640x480 desktop.

I get the feeling we're doing something basic that is dead wrong; hence the plea for sample code of the correct way to get the correct behavior.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
WaltN


Joined: 21 Sep 2009
Posts: 20
Location: Vestal, New York USA
Terry, I don't think our problem has anything to do with 1.2 compatibility. Except for not seeing any change when fullscreen mode = Desktop mode, I really don't see any difference in behavior with other modes. On inspection, I really don't think that either of us is using any 1.2 functionality. Strangely, with Visual C++ 2009 Express, when I define SDL_NO_COMPAT, I loose Intellisense knowledge of almost all SDL names. And yet the program builds successfully. Given that, I don't view SDL_NO_COMPAT as helpful. (I suppose it could be a VC++ bug or even due to my ignorance.)
Quote:
Anyway, as
best I can tell in the SDL_compat path the window is destroyed and
created again as a fullscreen window, a behavior I couldn't manage to
mimic properly.

How can you tell? I've verified that the SDL_WINDOW_FULLSCREEN flag is getting set, but RESIZEABLE remains set. (OPENGL, SHOWN, INPUT_FOCUS, and MOUSE_FOCUS also set). I have not tried to verify whether the "real" window flags are getting altered. Certainly the display mode is changing if I request a size different from the Desktop mode. But, I see no signs of the window being destroyed and created.

I believe that I'm getting a legitimate fullscreen window in that the window will cover up the Windows Taskbar. The shortcoming is that it's bordered and resizeable, and it's positioned badly.
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Terry Welsh
Guest

Hi Walt,
I think I was unclear in my previous post. The reason I was comparing
the 1.3-based version of my code to my SDL_compat version is because
in the compat version my window successfully goes fullscreen.
...well, almost successfully; I still have this input problem in
Linux: http://lists.libsdl.org/pipermail/sdl-libsdl.org/2009-December/073848.html

But the important part is that I do get a fullscreen Window, so I
figured the SDL_compat code should hold a good method for doing
fullscreen windows. Although, destroying the old window and creating
a new one seems heavy-handed to me if that's what's actually going on
(still need more time to examine what's going on).
--
Terry Welsh / mogumbo 'at' gmail.com
www.reallyslick.com / www.mogumbo.com

Quote:

Message: 1
Date: Thu, 21 Jan 2010 11:44:10 -0800
From: "WaltN"
To:
Subject: Re: [SDL] SDL_SetWindowFullscreen fails to set window to
       fullscreen      mo
Message-ID:
Content-Type: text/plain; charset="iso-8859-1"

Terry, I don't think our problem has anything to do with 1.2 compatibility.  Except for not seeing any change when fullscreen mode = Desktop mode, I really don't see any difference in behavior with other modes.  On inspection, I really don't think that either of us is using any 1.2 functionality.  Strangely, with Visual C++ 2009 Express, when I define SDL_NO_COMPAT, I loose Intellisense knowledge of almost all SDL names.  And yet the program builds successfully.  Given that, I don't view SDL_NO_COMPAT as helpful.  (I suppose it could be a VC++ bug or even due to my ignorance.)

Quote:
Anyway, as
best I can tell in the SDL_compat path the window is destroyed and
created again as a fullscreen window, a behavior I couldn't manage to
mimic properly.

How can you tell?  I've verified that the SDL_WINDOW_FULLSCREEN flag is getting set, but RESIZEABLE remains set. (OPENGL, SHOWN, INPUT_FOCUS, and MOUSE_FOCUS also set).  I have not tried to verify whether the "real" window flags are getting altered.  Certainly the display mode is changing if I request a size different from the Desktop mode.  But, I see no signs of the window being destroyed and created.

I believe that I'm getting a legitimate fullscreen window in that the window will cover up the Windows Taskbar.  The shortcoming is that it's bordered and resizeable, and it's positioned badly.

_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
can't switch to fullscreen
augzilla


Joined: 31 Jan 2010
Posts: 1
I think I ran into the same issue as you..; I couldn't switch to fullscreen from windowed. Specifically, I was creating a non-shown window first so that I could select the display mode with SDL_SetWindowDisplayMode (I couldn't find a better way -- and the ability to select refresh rate through the display mode is the reason that I am using SDL 1.3), and following it up with a call to SDL_SetWindowFullscreen.

I debugged it a bit and I think I found the main issue.. I didn't read the thread in detail, but I imagine you might have found it too. The display's num_windows member never got incremented on creation of a window (and also never gets decremented on killing of a window). Rather than risk missing places where it should be incremented or decremented, I added this simple function to SDL_video.c to work around the issue..:

Code:
int
SDL_GetNumWindowsForDisplay(SDL_VideoDisplay * display)
{
   /* Count the windows associated with this display */
   int num_windows = 0;
   SDL_Window *cur_window = display->windows;
   while (cur_window)
   {
      num_windows++;
      cur_window = cur_window->next;
   }
   return num_windows;
}



.. and I removed num_windows from the SDL_VideoDisplay struct (and of course, I made use of this function to replace the references to num_windows in SDL_UpdateFullscreenMode). Having the proper window count allows it to transition to fullscreen and back.
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Sam Lantinga


Joined: 10 Sep 2009
Posts: 1765
This should be fixed in revision 5544, thanks!

On Sat, Jan 30, 2010 at 7:33 PM, augzilla wrote:
Quote:
I think I ran into the same issue as you..; I couldn't switch to fullscreen
from windowed. Specifically, I was creating a non-shown window first so that
I could select the display mode with SDL_SetWindowDisplayMode (I couldn't
find a better way -- and the ability to select refresh rate through the
display mode is the reason that I am using SDL 1.3), and following it up
with a call to SDL_SetWindowFullscreen.

I debugged it a bit and I think I found the main issue.. I didn't read the
thread in detail, but I imagine you might have found it too. The display's
num_windows member never got incremented on creation of a window (and also
never gets decremented on killing of a window). Rather than risk missing
places where it should be incremented or decremented, I added this simple
function to work around the issue..:

int
SDL_GetNumWindowsForDisplay(SDL_VideoDisplay * display)
{
/* Count the windows associated with this display */
int num_windows = 0;
SDL_Window *cur_window = display->windows;
while (cur_window)
{
num_windows++;
cur_window = cur_window->next;
}
return num_windows;
}


.. and I removed num_windows from the SDL_VideoDisplay struct. This allows
it to transition to fullscreen and back.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org





--
-Sam Lantinga, Founder and President, Galaxy Gameworks LLC
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
SDL_SetWindowFullscreen fails to set window to fullscreen mo
Terry Welsh
Guest

Unfortunately, rev 5544 didn't change anything for me. Maybe I have a
different problem. My window still doesn't go fullscreen when
commanded to and then disappears if I move the mouse out of it. I
took a good hard look at the video code a couple weeks ago and
couldn't figure out where the problem was. Hopefully I'll get to look
at it again soon.
--
Terry

Quote:

Message: 3
Date: Sun, 31 Jan 2010 17:19:17 -0800
From: Sam Lantinga
To:
Subject: Re: [SDL] SDL_SetWindowFullscreen fails to set window to
       fullscreen      mo
Message-ID:
       
Content-Type: text/plain; charset=ISO-8859-1

This should be fixed in revision 5544, thanks!

On Sat, Jan 30, 2010 at 7:33 PM, augzilla wrote:
Quote:
I think I ran into the same issue as you..; I couldn't switch to fullscreen
from windowed. Specifically, I was creating a non-shown window first so that
I could select the display mode with SDL_SetWindowDisplayMode (I couldn't
find a better way -- and the ability to select refresh rate through the
display mode is the reason that I am using SDL 1.3), and following it up
with a call to SDL_SetWindowFullscreen.

I debugged it a bit and I think I found the main issue.. I didn't read the
thread in detail, but I imagine you might have found it too. The display's
num_windows member never got incremented on creation of a window (and also
never gets decremented on killing of a window). Rather than risk missing
places where it should be incremented or decremented, I added this simple
function to work around the issue..:

int
SDL_GetNumWindowsForDisplay(SDL_VideoDisplay * display)
{
/* Count the windows associated with this display */
int num_windows = 0;
SDL_Window *cur_window = display->windows;
while (cur_window)
{
num_windows++;
cur_window = cur_window->next;
}
return num_windows;
}


.. and I removed num_windows from the SDL_VideoDisplay struct. This allows
it to transition to fullscreen and back.
_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
me too
fareed_dudhia


Joined: 09 Feb 2010
Posts: 1
having exactly the same problem at rev 5549.

compiled the tests and I get the exact same result when i use --fullscreen on the testgl2.exe.

edit: screenshot

edit #2: lines up properly in my desktop resolution (1280x1024)

edit #3: GetWindowPosition tells me that the window is at (240,212). A call to SetWindowPosition does not move the window, but subsequent calls to GetWindowPosition reports it to be at (0,0)

code:

Code:

    SDL_GLContext context;
    SDL_Init(SDL_INIT_VIDEO);

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);

   uint32 flags = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN;

   mWindow = SDL_CreateWindow(   settings.caption,
                        0, 0,
                        settings.screenW,
                        settings.screenH,
                        flags);

        // Below tells me window is at (240,212)

   int px=0, py=0;
   SDL_GetWindowPosition(mWindow,&px,&py);
   std::cout << "\n" << px << ", " << py << "\n";

   if (settings.fullscreen)
      SDL_SetWindowPosition(mWindow,0,0);

        //Below tells me window is at (0,0) but does not change from screenshot

   SDL_GetWindowPosition(mWindow,&px,&py);
   std::cout << "\n" << px << ", " << py << "\n";

   context = SDL_GL_CreateContext(mWindow);


[/code]