Fullscreen windows are always topmost under Windows
authorSam Lantinga <slouken@libsdl.org>
Mon, 19 Aug 2002 03:09:25 +0000
changeset 448323c766f5a46
parent 447 16d0449891b8
child 449 8a687496061f
Fullscreen windows are always topmost under Windows
src/video/windib/SDL_dibvideo.c
src/video/windx5/SDL_dx5video.c
     1.1 --- a/src/video/windib/SDL_dibvideo.c	Mon Aug 19 02:34:22 2002 +0000
     1.2 +++ b/src/video/windib/SDL_dibvideo.c	Mon Aug 19 03:09:25 2002 +0000
     1.3 @@ -573,9 +573,9 @@
     1.4  #endif
     1.5  	}
     1.6  
     1.7 -   /* DJM: Don't piss of anyone who has setup his own window */
     1.8 -   if (!SDL_windowid)
     1.9 -	   SetWindowLong(SDL_Window, GWL_STYLE, style);
    1.10 +	/* DJM: Don't piss of anyone who has setup his own window */
    1.11 +	if (!SDL_windowid)
    1.12 +		SetWindowLong(SDL_Window, GWL_STYLE, style);
    1.13  
    1.14  	/* Delete the old bitmap if necessary */
    1.15  	if ( screen_bmp != NULL ) {
    1.16 @@ -651,6 +651,7 @@
    1.17  
    1.18  	/* Resize the window */
    1.19  	if ( SDL_windowid == NULL ) {
    1.20 +		HWND top;
    1.21  		UINT swp_flags;
    1.22  
    1.23  		SDL_resizing = 1;
    1.24 @@ -671,14 +672,19 @@
    1.25  			y -= GetSystemMetrics(SM_CYCAPTION)/2;
    1.26  		}
    1.27  #ifndef _WIN32_WCE
    1.28 -		swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW);
    1.29 +		swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
    1.30  #else
    1.31 -		swp_flags = (SWP_NOZORDER | SWP_SHOWWINDOW);
    1.32 +		swp_flags = (SWP_FRAMECHANGED | SWP_SHOWWINDOW);
    1.33  #endif
    1.34  		if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
    1.35  			swp_flags |= SWP_NOMOVE;
    1.36  		}
    1.37 -		SetWindowPos(SDL_Window, NULL, x, y, width, height, swp_flags);
    1.38 +		if ( flags & SDL_FULLSCREEN ) {
    1.39 +			top = HWND_TOPMOST;
    1.40 +		} else {
    1.41 +			top = HWND_NOTOPMOST;
    1.42 +		}
    1.43 +		SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
    1.44  		SDL_resizing = 0;
    1.45  		SetForegroundWindow(SDL_Window);
    1.46  	}
     2.1 --- a/src/video/windx5/SDL_dx5video.c	Mon Aug 19 02:34:22 2002 +0000
     2.2 +++ b/src/video/windx5/SDL_dx5video.c	Mon Aug 19 03:09:25 2002 +0000
     2.3 @@ -1080,7 +1080,7 @@
     2.4  
     2.5  		style = GetWindowLong(SDL_Window, GWL_STYLE);
     2.6  		style &= ~(resizestyle|WS_MAXIMIZE);
     2.7 -		if ( (video->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN ) {
     2.8 +		if ( video->flags & SDL_FULLSCREEN ) {
     2.9  			style &= ~windowstyle;
    2.10  			style |= directstyle;
    2.11  		} else {
    2.12 @@ -1102,6 +1102,7 @@
    2.13  
    2.14  		/* Resize the window (copied from SDL WinDIB driver) */
    2.15  		if ( SDL_windowid == NULL ) {
    2.16 +			HWND top;
    2.17  			UINT swp_flags;
    2.18  
    2.19  			SDL_resizing = 1;
    2.20 @@ -1117,11 +1118,16 @@
    2.21  			if ( y < 0 ) { /* Cover up title bar for more client area */
    2.22  				y -= GetSystemMetrics(SM_CYCAPTION)/2;
    2.23  			}
    2.24 -			swp_flags = (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW);
    2.25 -			if ( was_visible && !(flags & SDL_FULLSCREEN) ) {
    2.26 +			swp_flags = (SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_SHOWWINDOW);
    2.27 +			if ( was_visible && (video->flags & SDL_FULLSCREEN) ) {
    2.28  				swp_flags |= SWP_NOMOVE;
    2.29  			}
    2.30 -			SetWindowPos(SDL_Window, NULL, x, y, width, height, swp_flags);
    2.31 +			if ( video->flags & SDL_FULLSCREEN ) {
    2.32 +				top = HWND_TOPMOST;
    2.33 +			} else {
    2.34 +				top = HWND_NOTOPMOST;
    2.35 +			}
    2.36 +			SetWindowPos(SDL_Window, top, x, y, width, height, swp_flags);
    2.37  			SDL_resizing = 0;
    2.38  			SetForegroundWindow(SDL_Window);
    2.39  		}