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);

--HG--
branch : SDL-1.2
This commit is contained in:
Sam Lantinga
2011-12-30 06:29:06 -05:00
parent e9e25055f9
commit 2bfbeab5e2

View File

@@ -574,7 +574,9 @@ static void DIB_ResizeWindow(_THIS, int width, int height, int prev_width, int p
SDL_windowX = SDL_bounds.left;
SDL_windowY = SDL_bounds.top;
}
SetForegroundWindow(SDL_Window);
if ( GetParent(SDL_Window) == NULL ) {
SetForegroundWindow(SDL_Window);
}
}
}