Fixed bug 1309 - Don't grab focus during ResizeWindow on Win32 when SDL window is reparented SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Fri, 30 Dec 2011 06:29:06 -0500
branchSDL-1.2
changeset 6126 36f33f295c97
parent 6125 760a3162e180
child 6127 73a1a4c35259
Fixed bug 1309 - Don't grab focus during ResizeWindow on Win32 when SDL window is reparented burkheart@yahoo.com 2011-09-24 07:42:49 PDT When reparenting the SDL Window in a Win32 window (using SetParent) then stealing the focus during resizing from the parent window is causing problems. Assume you are dragging a corner of the parent window and consequently the parent window is sending resize events to the SDL child window. The SDL child window will eventually call DIB_ResizeWindow which has a call to SetForegroundWindow and is stealing the focus from the parent window. The switch in focus stops the resizing dragging process in the parent window. Basically making it nearly impossible to resize the parent window by dragging along the edges and corners. Solution, add a condition to avoid this when reparenting: if (GetParent(SDL_Window) == NULL) SetForegroundWindow(SDL_Window);
src/video/windib/SDL_dibvideo.c
--- a/src/video/windib/SDL_dibvideo.c	Fri Dec 30 06:22:59 2011 -0500
+++ b/src/video/windib/SDL_dibvideo.c	Fri Dec 30 06:29:06 2011 -0500
@@ -574,7 +574,9 @@
 			SDL_windowX = SDL_bounds.left;
 			SDL_windowY = SDL_bounds.top;
 		}
-		SetForegroundWindow(SDL_Window);
+		if ( GetParent(SDL_Window) == NULL ) {
+			SetForegroundWindow(SDL_Window);
+		}
 	}
 }