*** empty log message ***
authorSam Lantinga <slouken@libsdl.org>
Sun, 10 Mar 2002 03:25:47 +0000
changeset 304ec53caed9fb2
parent 303 767c10b9ec9f
child 305 9c6613983e85
*** empty log message ***
src/video/wincommon/SDL_lowvideo.h
src/video/wincommon/SDL_sysevents.c
src/video/windib/SDL_dibvideo.c
src/video/windx5/SDL_dx5video.c
     1.1 --- a/src/video/wincommon/SDL_lowvideo.h	Thu Mar 07 20:29:04 2002 +0000
     1.2 +++ b/src/video/wincommon/SDL_lowvideo.h	Sun Mar 10 03:25:47 2002 +0000
     1.3 @@ -35,6 +35,12 @@
     1.4  /* Hidden "this" pointer for the video functions */
     1.5  #define _THIS	SDL_VideoDevice *this
     1.6  
     1.7 +#define WINDIB_FULLSCREEN()						\
     1.8 +(									\
     1.9 +	((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
    1.10 +	(((SDL_VideoSurface->flags & SDL_OPENGL   ) == SDL_OPENGL    ) || \
    1.11 +	 (strcmp(this->name, "windib") == 0))				\
    1.12 +)
    1.13  #define DDRAW_FULLSCREEN() 						\
    1.14  (									\
    1.15  	((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
    1.16 @@ -84,6 +90,11 @@
    1.17  /* Flag -- the mouse is in relative motion mode */
    1.18  extern int mouse_relative;
    1.19  
    1.20 +/* The GDI fullscreen mode currently active */
    1.21 +#ifndef NO_CHANGEDISPLAYSETTINGS
    1.22 +extern DEVMODE SDL_fullscreen_mode;
    1.23 +#endif
    1.24 +
    1.25  /* This is really from SDL_dx5audio.c */
    1.26  extern void DX5_SoundFocus(HWND window);
    1.27  
     2.1 --- a/src/video/wincommon/SDL_sysevents.c	Thu Mar 07 20:29:04 2002 +0000
     2.2 +++ b/src/video/wincommon/SDL_sysevents.c	Sun Mar 10 03:25:47 2002 +0000
     2.3 @@ -57,6 +57,9 @@
     2.4  int SDL_resizing = 0;
     2.5  int mouse_relative = 0;
     2.6  int posted = 0;
     2.7 +#ifndef NO_CHANGEDISPLAYSETTINGS
     2.8 +DEVMODE SDL_fullscreen_mode;
     2.9 +#endif
    2.10  
    2.11  
    2.12  /* Functions called by the message processing function */
    2.13 @@ -67,6 +70,21 @@
    2.14  void (*WIN_SwapGamma)(_THIS);
    2.15  void (*WIN_WinPAINT)(_THIS, HDC hdc);
    2.16  
    2.17 +static void SDL_RestoreGameMode(void)
    2.18 +{
    2.19 +#ifndef NO_CHANGEDISPLAYSETTINGS
    2.20 +	ShowWindow(SDL_Window, SW_RESTORE);
    2.21 +	ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN);
    2.22 +#endif
    2.23 +}
    2.24 +static void SDL_RestoreDesktopMode(void)
    2.25 +{
    2.26 +#ifndef NO_CHANGEDISPLAYSETTINGS
    2.27 +	ShowWindow(SDL_Window, SW_MINIMIZE);
    2.28 +	ChangeDisplaySettings(NULL, 0);
    2.29 +#endif
    2.30 +}
    2.31 +
    2.32  #ifdef WM_MOUSELEAVE
    2.33  /* 
    2.34     Special code to handle mouse leave events - this sucks...
    2.35 @@ -178,6 +196,9 @@
    2.36  				}
    2.37  				if ( !(SDL_GetAppState()&SDL_APPINPUTFOCUS) ) {
    2.38  					WIN_SwapGamma(this);
    2.39 +					if ( WINDIB_FULLSCREEN() ) {
    2.40 +						SDL_RestoreGameMode();
    2.41 +					}
    2.42  				}
    2.43  				posted = SDL_PrivateAppActive(1, appstate);
    2.44  				WIN_GetKeyboardState();
    2.45 @@ -192,6 +213,9 @@
    2.46  				}
    2.47  				if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
    2.48  					WIN_SwapGamma(this);
    2.49 +					if ( WINDIB_FULLSCREEN() ) {
    2.50 +						SDL_RestoreDesktopMode();
    2.51 +					}
    2.52  				}
    2.53  				posted = SDL_PrivateAppActive(0, appstate);
    2.54  			}
     3.1 --- a/src/video/windib/SDL_dibvideo.c	Thu Mar 07 20:29:04 2002 +0000
     3.2 +++ b/src/video/windib/SDL_dibvideo.c	Sun Mar 10 03:25:47 2002 +0000
     3.3 @@ -527,6 +527,7 @@
     3.4  		settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
     3.5  		if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
     3.6  			video->flags |= SDL_FULLSCREEN;
     3.7 +			SDL_fullscreen_mode = settings;
     3.8  		}
     3.9  	}
    3.10  #endif /* !NO_CHANGEDISPLAYSETTINGS */
     4.1 --- a/src/video/windx5/SDL_dx5video.c	Thu Mar 07 20:29:04 2002 +0000
     4.2 +++ b/src/video/windx5/SDL_dx5video.c	Sun Mar 10 03:25:47 2002 +0000
     4.3 @@ -51,9 +51,6 @@
     4.4  #include "SDL_dx5yuv_c.h"
     4.5  #include "SDL_wingl_c.h"
     4.6  
     4.7 -/* Function called to create a GL video mode - use the GDI driver, not DirectX */
     4.8 -extern SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
     4.9 -				int width, int height, int bpp, Uint32 flags);
    4.10  
    4.11  /* DirectX function pointers for video and events */
    4.12  HRESULT (WINAPI *DDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
    4.13 @@ -1078,6 +1075,7 @@
    4.14  			settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
    4.15  			if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
    4.16  				video->flags |= SDL_FULLSCREEN;
    4.17 +				SDL_fullscreen_mode = settings;
    4.18  			}
    4.19  		}
    4.20