Commit 94746b8b authored by Sam Lantinga's avatar Sam Lantinga

*** empty log message ***

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40305
parent 1e744f88
......@@ -35,6 +35,12 @@ static char rcsid =
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this
#define WINDIB_FULLSCREEN() \
( \
((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
(((SDL_VideoSurface->flags & SDL_OPENGL ) == SDL_OPENGL ) || \
(strcmp(this->name, "windib") == 0)) \
)
#define DDRAW_FULLSCREEN() \
( \
((SDL_VideoSurface->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) && \
......@@ -84,6 +90,11 @@ extern int SDL_resizing;
/* Flag -- the mouse is in relative motion mode */
extern int mouse_relative;
/* The GDI fullscreen mode currently active */
#ifndef NO_CHANGEDISPLAYSETTINGS
extern DEVMODE SDL_fullscreen_mode;
#endif
/* This is really from SDL_dx5audio.c */
extern void DX5_SoundFocus(HWND window);
......
......@@ -57,6 +57,9 @@ RECT SDL_bounds = {0, 0, 0, 0};
int SDL_resizing = 0;
int mouse_relative = 0;
int posted = 0;
#ifndef NO_CHANGEDISPLAYSETTINGS
DEVMODE SDL_fullscreen_mode;
#endif
/* Functions called by the message processing function */
......@@ -67,6 +70,21 @@ void (*WIN_PaletteChanged)(_THIS, HWND window);
void (*WIN_SwapGamma)(_THIS);
void (*WIN_WinPAINT)(_THIS, HDC hdc);
static void SDL_RestoreGameMode(void)
{
#ifndef NO_CHANGEDISPLAYSETTINGS
ShowWindow(SDL_Window, SW_RESTORE);
ChangeDisplaySettings(&SDL_fullscreen_mode, CDS_FULLSCREEN);
#endif
}
static void SDL_RestoreDesktopMode(void)
{
#ifndef NO_CHANGEDISPLAYSETTINGS
ShowWindow(SDL_Window, SW_MINIMIZE);
ChangeDisplaySettings(NULL, 0);
#endif
}
#ifdef WM_MOUSELEAVE
/*
Special code to handle mouse leave events - this sucks...
......@@ -178,6 +196,9 @@ LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
if ( !(SDL_GetAppState()&SDL_APPINPUTFOCUS) ) {
WIN_SwapGamma(this);
if ( WINDIB_FULLSCREEN() ) {
SDL_RestoreGameMode();
}
}
posted = SDL_PrivateAppActive(1, appstate);
WIN_GetKeyboardState();
......@@ -192,6 +213,9 @@ LONG CALLBACK WinMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
WIN_SwapGamma(this);
if ( WINDIB_FULLSCREEN() ) {
SDL_RestoreDesktopMode();
}
}
posted = SDL_PrivateAppActive(0, appstate);
}
......
......@@ -527,6 +527,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
video->flags |= SDL_FULLSCREEN;
SDL_fullscreen_mode = settings;
}
}
#endif /* !NO_CHANGEDISPLAYSETTINGS */
......
......@@ -51,9 +51,6 @@ static char rcsid =
#include "SDL_dx5yuv_c.h"
#include "SDL_wingl_c.h"
/* Function called to create a GL video mode - use the GDI driver, not DirectX */
extern SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
int width, int height, int bpp, Uint32 flags);
/* DirectX function pointers for video and events */
HRESULT (WINAPI *DDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
......@@ -1078,6 +1075,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
settings.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT | DM_BITSPERPEL;
if ( ChangeDisplaySettings(&settings, CDS_FULLSCREEN) == DISP_CHANGE_SUCCESSFUL ) {
video->flags |= SDL_FULLSCREEN;
SDL_fullscreen_mode = settings;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment