Skip to content

Commit

Permalink
ImGuiManager: Update viewport and display size
Browse files Browse the repository at this point in the history
Fixes the single frame of incorrect draw size when resizing
the window with the Big Picture UI.
  • Loading branch information
stenzek committed Jan 3, 2025
1 parent 8085509 commit 9054801
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/util/imgui_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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<float>(state->swap_chain->GetWidth()), static_cast<float>(state->swap_chain->GetHeight()));
state->imgui_context->IO.IniFilename = nullptr;
state->imgui_context->IO.BackendFlags |= ImGuiBackendFlags_HasGamepad;
Expand Down Expand Up @@ -1579,8 +1579,8 @@ void ImGuiManager::ProcessAuxiliaryRenderWindowInputEvent(Host::AuxiliaryRenderW
return;
}

state->imgui_context->IO.DisplaySize.x = static_cast<float>(param1.uint_param);
state->imgui_context->IO.DisplaySize.y = static_cast<float>(param2.uint_param);
state->imgui_context->Viewports[0]->Size = state->imgui_context->IO.DisplaySize =
ImVec2(static_cast<float>(param1.uint_param), static_cast<float>(param2.uint_param));
}
break;

Expand Down

0 comments on commit 9054801

Please sign in to comment.