Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 0c28399
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/video/windib/SDL_dibvideo.c
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 0c28399

Please sign in to comment.