Skip to content
Permalink
Browse files

Fixed bug 1309 - Don't grab focus during ResizeWindow on Win32 when S…

…DL 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);
  • Loading branch information
slouken committed Dec 30, 2011
1 parent 1634e34 commit 0c2839994b397efa8d370d81fd80f01cb642c190
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/video/windib/SDL_dibvideo.c
@@ -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);
}
}
}

0 comments on commit 0c28399

Please sign in to comment.