Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
*** empty log message ***
  • Loading branch information
slouken committed Mar 10, 2002
1 parent ceb4349 commit 3812670
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/video/wincommon/SDL_lowvideo.h
Expand Up @@ -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) && \
Expand Down Expand Up @@ -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);

Expand Down
24 changes: 24 additions & 0 deletions src/video/wincommon/SDL_sysevents.c
Expand Up @@ -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 */
Expand All @@ -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...
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/video/windib/SDL_dibvideo.c
Expand Up @@ -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 */
Expand Down
4 changes: 1 addition & 3 deletions src/video/windx5/SDL_dx5video.c
Expand Up @@ -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 );
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 3812670

Please sign in to comment.