ImGuiManager: Avoid invalid scale update on surfaceless

This commit is contained in:
Stenzek 2024-06-24 21:09:31 +10:00 committed by Connor McLaughlin
parent f909282973
commit d53b2ae104
2 changed files with 4 additions and 3 deletions

View File

@ -425,8 +425,8 @@ bool ImGuiFullscreen::UpdateLayoutScale()
static constexpr float LAYOUT_RATIO = LAYOUT_SCREEN_WIDTH / LAYOUT_SCREEN_HEIGHT;
const ImGuiIO& io = ImGui::GetIO();
const float screen_width = io.DisplaySize.x;
const float screen_height = io.DisplaySize.y;
const float screen_width = std::max(io.DisplaySize.x, 1.0f);
const float screen_height = std::max(io.DisplaySize.y, 1.0f);
const float screen_ratio = screen_width / screen_height;
const float old_scale = g_layout_scale;

View File

@ -235,6 +235,7 @@ void ImGuiManager::WindowResized()
void ImGuiManager::RequestScaleUpdate()
{
if (s_window_width > 0 && s_window_height > 0)
s_scale_changed = true;
}