From 90548013411550248c42e4bc5395f85729d630cf Mon Sep 17 00:00:00 2001 From: Stenzek Date: Fri, 3 Jan 2025 20:03:36 +1000 Subject: [PATCH] ImGuiManager: Update viewport and display size Fixes the single frame of incorrect draw size when resizing the window with the Big Picture UI. --- src/util/imgui_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/imgui_manager.cpp b/src/util/imgui_manager.cpp index ab4224b65..efd064866 100644 --- a/src/util/imgui_manager.cpp +++ b/src/util/imgui_manager.cpp @@ -338,7 +338,7 @@ void ImGuiManager::WindowResized(float width, float height) { s_state.window_width = width; s_state.window_height = height; - ImGui::GetIO().DisplaySize = ImVec2(width, height); + ImGui::GetMainViewport()->Size = ImGui::GetIO().DisplaySize = ImVec2(width, height); // Scale might have changed as a result of window resize. RequestScaleUpdate(); @@ -1452,7 +1452,7 @@ bool ImGuiManager::CreateAuxiliaryRenderWindow(AuxiliaryRenderWindowState* state AddDebugFontIfMissing(); state->imgui_context = ImGui::CreateContext(s_state.imgui_context->IO.Fonts); - state->imgui_context->IO.DisplaySize = + state->imgui_context->Viewports[0]->Size = state->imgui_context->IO.DisplaySize = ImVec2(static_cast(state->swap_chain->GetWidth()), static_cast(state->swap_chain->GetHeight())); state->imgui_context->IO.IniFilename = nullptr; state->imgui_context->IO.BackendFlags |= ImGuiBackendFlags_HasGamepad; @@ -1579,8 +1579,8 @@ void ImGuiManager::ProcessAuxiliaryRenderWindowInputEvent(Host::AuxiliaryRenderW return; } - state->imgui_context->IO.DisplaySize.x = static_cast(param1.uint_param); - state->imgui_context->IO.DisplaySize.y = static_cast(param2.uint_param); + state->imgui_context->Viewports[0]->Size = state->imgui_context->IO.DisplaySize = + ImVec2(static_cast(param1.uint_param), static_cast(param2.uint_param)); } break;