Skip to content

Commit

Permalink
Fullscreen windows are always topmost under Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Aug 19, 2002
1 parent f734a42 commit f176d22
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
18 changes: 12 additions & 6 deletions src/video/windib/SDL_dibvideo.c
Expand Up @@ -573,9 +573,9 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
#endif
}

/* DJM: Don't piss of anyone who has setup his own window */
if (!SDL_windowid)
SetWindowLong(SDL_Window, GWL_STYLE, style);
/* DJM: Don't piss of anyone who has setup his own window */
if (!SDL_windowid)
SetWindowLong(SDL_Window, GWL_STYLE, style);

/* Delete the old bitmap if necessary */
if ( screen_bmp != NULL ) {
Expand Down Expand Up @@ -651,6 +651,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,

/* Resize the window */
if ( SDL_windowid == NULL ) {
HWND top;
UINT swp_flags;

SDL_resizing = 1;
Expand All @@ -671,14 +672,19 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
y -= GetSystemMetrics(SM_CYCAPTION)/2;
}
#ifndef _WIN32_WCE
swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW);
swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
#else
swp_flags = (SWP_NOZORDER | SWP_SHOWWINDOW);
swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW);
#endif
if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
swp_flags |= SWP_NOMOVE;
}
SetWindowPos(SDL_Window, NULL, x, y, width, height, swp_flags);
if ( flags & SDL_FULLSCREEN ) {
top = HWND_TOPMOST;
} else {
top = HWND_NOTOPMOST;
}
SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
SDL_resizing = 0;
SetForegroundWindow(SDL_Window);
}
Expand Down
14 changes: 10 additions & 4 deletions src/video/windx5/SDL_dx5video.c
Expand Up @@ -1080,7 +1080,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,

style = GetWindowLong(SDL_Window, GWL_STYLE);
style &= ~(resizestyle|WS_MAXIMIZE);
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
if ( video->flags & SDL_FULLSCREEN ) {
style &= ~windowstyle;
style |= directstyle;
} else {
Expand All @@ -1102,6 +1102,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,

/* Resize the window (copied from SDL WinDIB driver) */
if ( SDL_windowid == NULL ) {
HWND top;
UINT swp_flags;

SDL_resizing = 1;
Expand All @@ -1117,11 +1118,16 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
if ( y < 0 ) { /* Cover up title bar for more client area */
y -= GetSystemMetrics(SM_CYCAPTION)/2;
}
swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW);
if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
if ( was_visible && (video->flags & SDL_FULLSCREEN) ) {
swp_flags |= SWP_NOMOVE;
}
SetWindowPos(SDL_Window, NULL, x, y, width, height, swp_flags);
if ( video->flags & SDL_FULLSCREEN ) {
top = HWND_TOPMOST;
} else {
top = HWND_NOTOPMOST;
}
SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
SDL_resizing = 0;
SetForegroundWindow(SDL_Window);
}
Expand Down

0 comments on commit f176d22

Please sign in to comment.