mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
Fix passing of child window focus in WIN_ShowWindow/WIN_RaiseWindow
Keyboard focus was being passed to the child window being shown if SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN is false and keyboard focus was not being passed to the child window being activated in WIN_RaiseWindow.
This commit is contained in:
@@ -859,10 +859,11 @@ void WIN_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
style = GetWindowLong(hwnd, GWL_EXSTYLE);
|
||||
if (style & WS_EX_NOACTIVATE) {
|
||||
nCmdShow = SW_SHOWNOACTIVATE;
|
||||
bActivate = SDL_FALSE;
|
||||
}
|
||||
ShowWindow(hwnd, nCmdShow);
|
||||
|
||||
if (window->flags & SDL_WINDOW_POPUP_MENU) {
|
||||
if (window->flags & SDL_WINDOW_POPUP_MENU && bActivate) {
|
||||
if (window->parent == SDL_GetKeyboardFocus()) {
|
||||
WIN_SetKeyboardFocus(window);
|
||||
}
|
||||
@@ -922,6 +923,11 @@ void WIN_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
if (bActivate) {
|
||||
SetForegroundWindow(hwnd);
|
||||
if (window->flags & SDL_WINDOW_POPUP_MENU) {
|
||||
if (window->parent == SDL_GetKeyboardFocus()) {
|
||||
WIN_SetKeyboardFocus(window);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, data->copybits_flag | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user