Closed pthom closed 6 months ago
Hi,
I cannot reproduce the issue on my side.
You told me that calling SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE); seems to fix the issue.
Can you confirm whether modifying hello_imgui/src/hello_imgui/internal/backend_impls/backend_window_helper/win32_dpi_awareness.cpp like this (removing two return) does solve the issue for you?
// Helper function to enable DPI awareness without setting up a manifest
void ImGui_ImplWin32_EnableDpiAwareness()
{
// Make sure monitors will be updated with latest correct scaling
// if (ImGui_ImplWin32_Data* bd = ImGui_ImplWin32_GetBackendData())
// bd->WantUpdateMonitors = true;
if (_IsWindows10OrGreater())
{
static HINSTANCE user32_dll = ::LoadLibraryA("user32.dll"); // Reference counted per-process
if (PFN_SetThreadDpiAwarenessContext SetThreadDpiAwarenessContextFn =
(PFN_SetThreadDpiAwarenessContext)::GetProcAddress(user32_dll,
"SetThreadDpiAwarenessContext"))
{
SetThreadDpiAwarenessContextFn(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
return; // REMOVE THIS RETURN
}
}
if (_IsWindows8Point1OrGreater())
{
static HINSTANCE shcore_dll = ::LoadLibraryA("shcore.dll"); // Reference counted per-process
if (PFN_SetProcessDpiAwareness SetProcessDpiAwarenessFn =
(PFN_SetProcessDpiAwareness)::GetProcAddress(shcore_dll, "SetProcessDpiAwareness"))
{
SetProcessDpiAwarenessFn(PROCESS_PER_MONITOR_DPI_AWARE);
return; // REMOVE THIS RETURN ??
}
}
#if _WIN32_WINNT >= 0x0600
::SetProcessDPIAware();
#endif
}
An issue raised by Bernard Harmel: