From b9fa2329d249d7c31bc0aea3007751e15c7a9c0d Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 27 Jul 2016 22:53:49 +0200 Subject: [PATCH] Set DPI awareness via manifest as per https://msdn.microsoft.com/en-US/library/windows/desktop/dn302122(v=vs.85).aspx and also get the scaling from the primary display, assuming the viewer will open there and which might not be the display nearest to screen coordinate 1/1 --- indra/llwindow/llwindowwin32.cpp | 15 ++++++++++----- indra/tools/manifests/compatibility.manifest | 5 +++++ indra/tools/manifests/legacy.manifest | 5 +++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index b068a6224a..1144b75257 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3979,13 +3979,15 @@ F32 LLWindowWin32::getSystemUISize() if (hShcore != NULL) { - SetProcessDpiAwarenessType pSPDA; - pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness"); + // Set DPI awareness via manifest as recommended + //SetProcessDpiAwarenessType pSPDA; + //pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness"); + // GetDpiForMonitorType pGDFM; pGDFM = (GetDpiForMonitorType)GetProcAddress(hShcore, "GetDpiForMonitor"); - if (pSPDA != NULL && pGDFM != NULL) + if (/*pSPDA != NULL &&*/ pGDFM != NULL) // Set DPI awareness via manifest as recommended { - pSPDA(PROCESS_PER_MONITOR_DPI_AWARE); + //pSPDA(PROCESS_PER_MONITOR_DPI_AWARE); // Set DPI awareness via manifest as recommended POINT pt; UINT dpix = 0, dpiy = 0; HRESULT hr = E_FAIL; @@ -3993,7 +3995,10 @@ F32 LLWindowWin32::getSystemUISize() // Get the DPI for the main monitor, and set the scaling factor pt.x = 1; pt.y = 1; - hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + // Get scaling for primary display, assuming that's where we open the viewer + //hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST); + hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); + // hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy); scale_value = dpix / 96.0f; } diff --git a/indra/tools/manifests/compatibility.manifest b/indra/tools/manifests/compatibility.manifest index 31106cc4d5..6e80aff779 100644 --- a/indra/tools/manifests/compatibility.manifest +++ b/indra/tools/manifests/compatibility.manifest @@ -23,4 +23,9 @@ + + + true/PM + + diff --git a/indra/tools/manifests/legacy.manifest b/indra/tools/manifests/legacy.manifest index 2ec1cfcee6..899438c020 100644 --- a/indra/tools/manifests/legacy.manifest +++ b/indra/tools/manifests/legacy.manifest @@ -9,4 +9,9 @@ + + + true/PM + +