Backends: SDL2, SDL3: Replace Win32 hack with SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN hint. (#7896)

This commit is contained in:
RT2
2024-08-17 13:13:10 +02:00
committed by ocornut
parent fbafc33376
commit fa65dcf24c
3 changed files with 9 additions and 8 deletions

View File

@@ -952,15 +952,9 @@ static void ImGui_ImplSDL3_ShowWindow(ImGuiViewport* viewport)
ex_style |= WS_EX_TOOLWINDOW;
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
}
// SDL hack: SDL always activate/focus windows :/
if (viewport->Flags & ImGuiViewportFlags_NoFocusOnAppearing)
{
::ShowWindow(hwnd, SW_SHOWNA);
return;
}
#endif
SDL_SetHint(SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN, (viewport->Flags & ImGuiViewportFlags_NoFocusOnAppearing) ? "0" : "1");
SDL_ShowWindow(vd->Window);
}