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