|
@@ -845,7 +845,6 @@ void WIN_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
{
|
|
|
DWORD style;
|
|
|
HWND hwnd;
|
|
|
- int nCmdShow;
|
|
|
|
|
|
SDL_bool bActivate = SDL_GetHintBoolean(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, SDL_TRUE);
|
|
|
|
|
@@ -855,13 +854,16 @@ void WIN_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
|
|
}
|
|
|
|
|
|
hwnd = window->driverdata->hwnd;
|
|
|
- nCmdShow = bActivate ? SW_SHOW : SW_SHOWNA;
|
|
|
style = GetWindowLong(hwnd, GWL_EXSTYLE);
|
|
|
if (style & WS_EX_NOACTIVATE) {
|
|
|
- nCmdShow = SW_SHOWNOACTIVATE;
|
|
|
bActivate = SDL_FALSE;
|
|
|
}
|
|
|
- ShowWindow(hwnd, nCmdShow);
|
|
|
+ if (bActivate) {
|
|
|
+ ShowWindow(hwnd, SW_SHOW);
|
|
|
+ } else {
|
|
|
+ /* Use SetWindowPos instead of ShowWindow to avoid activating the parent window if this is a child window */
|
|
|
+ SetWindowPos(hwnd, NULL, 0, 0, 0, 0, window->driverdata->copybits_flag | SWP_SHOWWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);
|
|
|
+ }
|
|
|
|
|
|
if (window->flags & SDL_WINDOW_POPUP_MENU && bActivate) {
|
|
|
if (window->parent == SDL_GetKeyboardFocus()) {
|