mirror of
https://github.com/ocornut/imgui.git
synced 2025-01-23 10:56:44 +08:00
Backends: SDL2, SDL3: Replace Win32 hack with SDL_HINT_WINDOW_ACTIVATE_WHEN_SHOWN hint. (#7896)
This commit is contained in:
parent
fbafc33376
commit
fa65dcf24c
@ -116,6 +116,7 @@
|
||||
#define SDL_HAS_PER_MONITOR_DPI SDL_VERSION_ATLEAST(2,0,4)
|
||||
#define SDL_HAS_VULKAN SDL_VERSION_ATLEAST(2,0,6)
|
||||
#define SDL_HAS_DISPLAY_EVENT SDL_VERSION_ATLEAST(2,0,9)
|
||||
#define SDL_HAS_SHOW_WINDOW_ACTIVATION_HINT SDL_VERSION_ATLEAST(2,0,18)
|
||||
#if !SDL_HAS_VULKAN
|
||||
static const Uint32 SDL_WINDOW_VULKAN = 0x10000000;
|
||||
#endif
|
||||
@ -1012,7 +1013,11 @@ static void ImGui_ImplSDL2_ShowWindow(ImGuiViewport* viewport)
|
||||
ex_style |= WS_EX_TOOLWINDOW;
|
||||
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SDL_HAS_SHOW_WINDOW_ACTIVATION_HINT
|
||||
SDL_SetHint(SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN, (viewport->Flags & ImGuiViewportFlags_NoFocusOnAppearing) ? "1" : "0");
|
||||
#elif defined(_WIN32)
|
||||
// SDL hack: SDL always activate/focus windows :/
|
||||
if (viewport->Flags & ImGuiViewportFlags_NoFocusOnAppearing)
|
||||
{
|
||||
@ -1020,7 +1025,6 @@ static void ImGui_ImplSDL2_ShowWindow(ImGuiViewport* viewport)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_ShowWindow(vd->Window);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,9 @@ Docking+Viewports Branch:
|
||||
to allow backends to alter the default per-viewport work-area. (#7823)
|
||||
- Backends: don't report monitors with DpiScale of 0, which seemed to be reported
|
||||
for virtual monitors instead by accessibility drivers. (#7902) [@nicolasnoble]
|
||||
- Backends: SDL2, SDL3: using SDL_HINT_WINDOW_NO_ACTIVATION_WHEN_SHOWN to support the
|
||||
ImGuiViewportFlags_NoFocusOnAppearing flag, instead of using a Win32-specific hack.
|
||||
(#7896) [@RT2Code]
|
||||
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user