From df5a5c94dc1636d6e8e4689ccd5f491d2df5fbd6 Mon Sep 17 00:00:00 2001 From: Adrien GIVRY Date: Wed, 3 Dec 2025 17:58:01 -0500 Subject: [PATCH 1/3] Enabled ImGui DPI scaling setting --- Sources/OvUI/src/OvUI/Core/UIManager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Sources/OvUI/src/OvUI/Core/UIManager.cpp b/Sources/OvUI/src/OvUI/Core/UIManager.cpp index c2d757c7a..8630a56ef 100644 --- a/Sources/OvUI/src/OvUI/Core/UIManager.cpp +++ b/Sources/OvUI/src/OvUI/Core/UIManager.cpp @@ -33,6 +33,9 @@ OvUI::Core::UIManager::UIManager(GLFWwindow* p_glfwWindow, Styling::EStyle p_sty ImGui::CreateContext(); ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly = true; /* Disable moving windows by dragging another thing than the title bar */ + ImGuiIO& io = ImGui::GetIO(); + io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleViewports; + io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleFonts; EnableDocking(false); ApplyStyle(p_style); From ad681353951d938d1553e65b6523472c7cdc4f9d Mon Sep 17 00:00:00 2001 From: Adrien GIVRY Date: Wed, 3 Dec 2025 18:05:53 -0500 Subject: [PATCH 2/3] Code cleanup --- Sources/OvUI/src/OvUI/Core/UIManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/OvUI/src/OvUI/Core/UIManager.cpp b/Sources/OvUI/src/OvUI/Core/UIManager.cpp index 8630a56ef..84245e630 100644 --- a/Sources/OvUI/src/OvUI/Core/UIManager.cpp +++ b/Sources/OvUI/src/OvUI/Core/UIManager.cpp @@ -32,8 +32,8 @@ OvUI::Core::UIManager::UIManager(GLFWwindow* p_glfwWindow, Styling::EStyle p_sty { ImGui::CreateContext(); - ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly = true; /* Disable moving windows by dragging another thing than the title bar */ ImGuiIO& io = ImGui::GetIO(); + io.ConfigWindowsMoveFromTitleBarOnly = true; /* Disable moving windows by dragging another thing than the title bar */ io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleViewports; io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleFonts; EnableDocking(false); From febccae99385e0ebd885118e2848cd18f889c9e0 Mon Sep 17 00:00:00 2001 From: Adrien GIVRY Date: Mon, 8 Dec 2025 16:41:06 -0500 Subject: [PATCH 3/3] Cleaned up implementation --- Sources/OvUI/include/OvUI/Core/UIManager.h | 6 ++++++ Sources/OvUI/src/OvUI/Core/UIManager.cpp | 25 +++++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Sources/OvUI/include/OvUI/Core/UIManager.h b/Sources/OvUI/include/OvUI/Core/UIManager.h index 1c4e44d91..9517342eb 100644 --- a/Sources/OvUI/include/OvUI/Core/UIManager.h +++ b/Sources/OvUI/include/OvUI/Core/UIManager.h @@ -96,6 +96,12 @@ namespace OvUI::Core */ void EnableDocking(bool p_value); + /** + * Enable DPI scaling + * @param p_value + */ + void EnableDPIScaling(bool p_value); + /** * Reset the UI layout to the given configuration file * @param p_config diff --git a/Sources/OvUI/src/OvUI/Core/UIManager.cpp b/Sources/OvUI/src/OvUI/Core/UIManager.cpp index 84245e630..bbfe352e8 100644 --- a/Sources/OvUI/src/OvUI/Core/UIManager.cpp +++ b/Sources/OvUI/src/OvUI/Core/UIManager.cpp @@ -32,10 +32,9 @@ OvUI::Core::UIManager::UIManager(GLFWwindow* p_glfwWindow, Styling::EStyle p_sty { ImGui::CreateContext(); - ImGuiIO& io = ImGui::GetIO(); - io.ConfigWindowsMoveFromTitleBarOnly = true; /* Disable moving windows by dragging another thing than the title bar */ - io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleViewports; - io.ConfigFlags |= ImGuiConfigFlags_DpiEnableScaleFonts; + ImGui::GetIO().ConfigWindowsMoveFromTitleBarOnly = true; /* Disable moving windows by dragging another thing than the title bar */ + + EnableDPIScaling(true); EnableDocking(false); ApplyStyle(p_style); @@ -142,7 +141,23 @@ void OvUI::Core::UIManager::EnableDocking(bool p_value) ImGui::GetIO().ConfigFlags &= ~ImGuiConfigFlags_DockingEnable; } -void OvUI::Core::UIManager::ResetLayout(const std::string& p_config) const +void OvUI::Core::UIManager::EnableDPIScaling(bool p_value) +{ + ImGuiIO& io = ImGui::GetIO(); + + const auto dpiScalingFlags = ImGuiConfigFlags_DpiEnableScaleViewports | ImGuiConfigFlags_DpiEnableScaleFonts; + + if (p_value) + { + io.ConfigFlags |= dpiScalingFlags; + } + else + { + io.ConfigFlags &= ~dpiScalingFlags; + } +} + +void OvUI::Core::UIManager::ResetLayout(const std::string &p_config) const { ImGui::LoadIniSettingsFromDisk(p_config.c_str()); }