Fullscreen->window & compiler errors

Hello, *.

Long time listener, first time caller. :slight_smile:

I’ve been developing games using SDL 1.2.7 and, in a recent effort to
make my games more user-friendly, I’ve tried to implement in-game
switching from window to fullscreen and vice versa. My primary
development platform is Win32 but I plan to port to OSX and some linux
platforms. I quickly discovered that the only way to successfully
switch from window to fullscreen was to quit the video subsystem,
reinitialize it, and then reopen the window. I talked with a few other
SDL users and they agreed this was the best method.

HOWEVER.

This only seems to work when switching from a window to fullscreen.
When I try to do the reverse the SDL_InitVideo() says there was no
problem, the desktop returns and the window is gone. All that remains
is an icon on the taskbar.

I have been trying to dig into SDL and discover the root of the problem
but I have not had any success yet. I am in the process of trying 1.2.8
to see if the issue is fixed there. I have not yet succeeded in
implementing 1.2.8 or the latest CVS because every time I try to compile
SDL I get the following warnings in MSVC6:

…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4013: 'GetAncestor’
undefined; assuming extern returning int
…\src\Video\Windx5\SDL_dx5events.c(171) : error C2065: ‘GA_ROOT’ :
undeclared identifier
…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int '
…\src\Video\Windx5\SDL_dx5events.c(655) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int ’

Part of this might somehow be due to the fact that I canibalized the
1.2.7 Visual C dsp/dsw files I had because I could not locate them for
1.2.8. They weren’t in the distro I got off the official web page and
they weren’t in CVS.

If you or anyone you know has a (constructive) solution to my problems,
please reply! I am under a tight deadline and need to get this working.

Thank you all!

Dan R

try just calling SDL_SetVideoMode again with the new flags.
this is supposed to work.
if it doesn’t then that’s a bug.
deiniting and reiniting video may not work as expected.

-LIM-

try just calling SDL_SetVideoMode again with the new flags.
this is supposed to work.
if it doesn’t then that’s a bug.
deiniting and reiniting video may not work as expected.

Switching from full screen to windowed or vice versa definitely doesn’t
work on Mac OS X, last I checked. I can’t think of a good technical
reason why it shouldn’t, but I haven’t had time to write a patch.

-bobOn Dec 17, 2004, at 10:45 PM, Jonathan Atkins wrote:

Long time listener, first time caller. :slight_smile:

Hello Dan, nice to hear from you.

I’ve been developing games using SDL 1.2.7 and, in a recent effort to
make my games more user-friendly, I’ve tried to implement in-game
switching from window to fullscreen and vice versa. My primary
development platform is Win32 but I plan to port to OSX and some linux
platforms. I quickly discovered that the only way to successfully
switch from window to fullscreen was to quit the video subsystem,
reinitialize it, and then reopen the window. I talked with a few other
SDL users and they agreed this was the best method.

The officially recommended way is to just toggle the SDL_FULLSCREEN flag
and reset the video mode. This should work, and if it doesn’t, it’s a bug.

I have been trying to dig into SDL and discover the root of the problem
but I have not had any success yet. I am in the process of trying 1.2.8
to see if the issue is fixed there. I have not yet succeeded in
implementing 1.2.8 or the latest CVS because every time I try to compile
SDL I get the following warnings in MSVC6:

You didn’t find VisualC.zip? That’s the file I used to build the DLL on
the website.

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

Dan Royer <droyer shaw.ca> writes:

I have been trying to dig into SDL and discover the root of the problem
but I have not had any success yet. I am in the process of trying 1.2.8
to see if the issue is fixed there. I have not yet succeeded in
implementing 1.2.8 or the latest CVS because every time I try to compile
SDL I get the following warnings in MSVC6:

…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4013: 'GetAncestor’
undefined; assuming extern returning int
…\src\Video\Windx5\SDL_dx5events.c(171) : error C2065: ‘GA_ROOT’ :
undeclared identifier
…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int '
…\src\Video\Windx5\SDL_dx5events.c(655) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int ’

Part of this might somehow be due to the fact that I canibalized the
1.2.7 Visual C dsp/dsw files I had because I could not locate them for
1.2.8. They weren’t in the distro I got off the official web page and
they weren’t in CVS.

If you or anyone you know has a (constructive) solution to my problems,
please reply! I am under a tight deadline and need to get this working.

Thank you all!

Dan R

I had the same problem with GA_ROOT (SDL 1.2.8 source, WinXP, VisualC 5, using
the VisualC.zip downloaded from SDL site). Here is what I did:

In file “SDL-1.2.8\src\video\windx5\SDL_dx5events.c”, add the following after
the #include lines:

// Gary Feng, for compile error: GA_ROOT undefined
#ifndef GA_ROOT
//#include <WINUSER.h>
// from WINUSER.h
/*

  • The “real” ancestor window
    */
    #define GA_MIC 1
    #define GA_PARENT 1
    #define GA_ROOT 2
    #define GA_ROOTOWNER 3
    #define GA_MAC 4

HWND
WINAPI
GetAncestor(
HWND hwnd,
UINT gaFlags
);
#endif
// end Gary Feng

This is copied from WINUSER.h. I tried to include it but somehow it didn’t work.
Copying these lines worked for me, though. I didn’t have to do anything else. I
guess it links to User32.dll, but I don’t care.

– gary

Dan Royer <droyer shaw.ca> writes:

I have been trying to dig into SDL and discover the root of the problem
but I have not had any success yet. I am in the process of trying 1.2.8
to see if the issue is fixed there. I have not yet succeeded in
implementing 1.2.8 or the latest CVS because every time I try to compile
SDL I get the following warnings in MSVC6:

…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4013: 'GetAncestor’
undefined; assuming extern returning int
…\src\Video\Windx5\SDL_dx5events.c(171) : error C2065: ‘GA_ROOT’ :
undeclared identifier
…\src\Video\Windx5\SDL_dx5events.c(171) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int '
…\src\Video\Windx5\SDL_dx5events.c(655) : warning C4047: ‘=’ : ‘struct
HWND__ *’ differs in levels of indirection from 'int ’

Part of this might somehow be due to the fact that I canibalized the
1.2.7 Visual C dsp/dsw files I had because I could not locate them for
1.2.8. They weren’t in the distro I got off the official web page and
they weren’t in CVS.

I think you’ll find the compilation problem is due to the value of WINVER.

WINUSER.H only prototypes GetAncestor and defines GA_ROOT if WINVER>=0x0500.

For VC6 this is never the case. You need to copy the prototype and define into
the top of the source file. (You can’t just set WINVER to 0x0500 as all sorts of
other stuff will be upset.)