Backends: SDL2, SDL3, Win32: don't submit monitor with 0 DpiScale (e.g. accessibility virtual monitor?). to prevent assert. (#7902)

I am not too confident on this but I believe pushing this is the fastest way we will get feedback.
This commit is contained in:
ocornut
2024-08-19 12:18:47 +02:00
parent fa65dcf24c
commit 65840c19c4
5 changed files with 11 additions and 3 deletions

View File

@@ -437,6 +437,8 @@ static BOOL CALLBACK ImGui_ImplWin32_UpdateMonitors_EnumFunc(HMONITOR monitor, H
imgui_monitor.WorkSize = ImVec2((float)(info.rcWork.right - info.rcWork.left), (float)(info.rcWork.bottom - info.rcWork.top));
imgui_monitor.DpiScale = ImGui_ImplWin32_GetDpiScaleForMonitor(monitor);
imgui_monitor.PlatformHandle = (void*)monitor;
if (imgui_monitor.DpiScale <= 0.0f)
return TRUE; // Some accessibility applications are declaring virtual monitors with a DPI of 0, see #7902.
ImGuiPlatformIO& io = ImGui::GetPlatformIO();
if (info.dwFlags & MONITORINFOF_PRIMARY)
io.Monitors.push_front(imgui_monitor);