Commit 12ceb2a0 authored by Sam Lantinga's avatar Sam Lantinga

Fullscreen windows are always topmost under Windows

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40449
parent 09288d7f
...@@ -651,6 +651,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -651,6 +651,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
/* Resize the window */ /* Resize the window */
if ( SDL_windowid == NULL ) { if ( SDL_windowid == NULL ) {
HWND top;
UINT swp_flags; UINT swp_flags;
SDL_resizing = 1; SDL_resizing = 1;
...@@ -671,14 +672,19 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -671,14 +672,19 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
y -= GetSystemMetrics(SM_CYCAPTION)/2; y -= GetSystemMetrics(SM_CYCAPTION)/2;
} }
#ifndef _WIN32_WCE #ifndef _WIN32_WCE
swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW); swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
#else #else
swp_flags = (SWP_NOZORDER | SWP_SHOWWINDOW); swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW);
#endif #endif
if ( was_visible && !(flags & SDL_FULLSCREEN) ) { if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
swp_flags |= SWP_NOMOVE; 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; SDL_resizing = 0;
SetForegroundWindow(SDL_Window); SetForegroundWindow(SDL_Window);
} }
......
...@@ -1080,7 +1080,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -1080,7 +1080,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
style = GetWindowLong(SDL_Window, GWL_STYLE); style = GetWindowLong(SDL_Window, GWL_STYLE);
style &= ~(resizestyle|WS_MAXIMIZE); style &= ~(resizestyle|WS_MAXIMIZE);
if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) { if ( video->flags & SDL_FULLSCREEN ) {
style &= ~windowstyle; style &= ~windowstyle;
style |= directstyle; style |= directstyle;
} else { } else {
...@@ -1102,6 +1102,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -1102,6 +1102,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
/* Resize the window (copied from SDL WinDIB driver) */ /* Resize the window (copied from SDL WinDIB driver) */
if ( SDL_windowid == NULL ) { if ( SDL_windowid == NULL ) {
HWND top;
UINT swp_flags; UINT swp_flags;
SDL_resizing = 1; SDL_resizing = 1;
...@@ -1117,11 +1118,16 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -1117,11 +1118,16 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
if ( y < 0 ) { /* Cover up title bar for more client area */ if ( y < 0 ) { /* Cover up title bar for more client area */
y -= GetSystemMetrics(SM_CYCAPTION)/2; y -= GetSystemMetrics(SM_CYCAPTION)/2;
} }
swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW); swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
if ( was_visible && !(flags & SDL_FULLSCREEN) ) { if ( was_visible && (video->flags & SDL_FULLSCREEN) ) {
swp_flags |= SWP_NOMOVE; 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; SDL_resizing = 0;
SetForegroundWindow(SDL_Window); SetForegroundWindow(SDL_Window);
} }
......
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