From bc51d937f348cb884dfb702b7e5f7522cdda51f2 Mon Sep 17 00:00:00 2001 From: Sky Leite Date: Wed, 18 Feb 2026 22:25:25 -0300 Subject: [PATCH] Backends: SDL2: Fix incorrect screen clipping when SDL_RenderSetLogicalSize is used --- backends/imgui_impl_sdl2.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backends/imgui_impl_sdl2.cpp b/backends/imgui_impl_sdl2.cpp index f578977c45ec..f3417b4b8458 100644 --- a/backends/imgui_impl_sdl2.cpp +++ b/backends/imgui_impl_sdl2.cpp @@ -870,7 +870,13 @@ static void ImGui_ImplSDL2_GetWindowSizeAndFramebufferScale(SDL_Window* window, { int w, h; int display_w, display_h; - SDL_GetWindowSize(window, &w, &h); + + SDL_RenderGetLogicalSize(renderer, &w, &h); + if (w == 0 || h == 0) + { // GetLogicalSize returns 0, 0 when it is unset + SDL_GetWindowSize(window, &w, &h); + } + if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED) w = h = 0; if (renderer != nullptr)