From fbafc33376d3f34437efa20773c9d0f69806be5f Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Sun, 18 Aug 2024 20:23:56 -0700 Subject: [PATCH] Backends: GLFW: don't submit monitor with 0 DpiScale (e.g. accessibility virtual monitor?). to prevent assert. (#7902) --- backends/imgui_impl_glfw.cpp | 2 ++ docs/CHANGELOG.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/backends/imgui_impl_glfw.cpp b/backends/imgui_impl_glfw.cpp index 0c9ea72d8..cc98b49a3 100644 --- a/backends/imgui_impl_glfw.cpp +++ b/backends/imgui_impl_glfw.cpp @@ -906,6 +906,8 @@ static void ImGui_ImplGlfw_UpdateMonitors() // Warning: the validity of monitor DPI information on Windows depends on the application DPI awareness settings, which generally needs to be set in the manifest or at runtime. float x_scale, y_scale; glfwGetMonitorContentScale(glfw_monitors[n], &x_scale, &y_scale); + if (x_scale == 0.0f) + continue; // Some accessibility applications are declaring fake monitors with a DPI of 0, see (#7902) monitor.DpiScale = x_scale; #endif monitor.PlatformHandle = (void*)glfw_monitors[n]; // [...] GLFW doc states: "guaranteed to be valid only until the monitor configuration changes" diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index 70b104c18..380217c41 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -56,6 +56,8 @@ Docking+Viewports Branch: - Viewports: added optional platform_io.Platform_GetWindowWorkAreaInsets() hook to allow backends to alter the default per-viewport work-area. (#7823) +- Backends: don't report monitors with DpiScale of 0, which seemed to be reported + for virtual monitors instead by accessibility drivers. (#7902) [@nicolasnoble] -----------------------------------------------------------------------