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
parent
28f0ce1506
commit
b9fa2329d2
|
|
@ -3979,13 +3979,15 @@ F32 LLWindowWin32::getSystemUISize()
|
|||
|
||||
if (hShcore != NULL)
|
||||
{
|
||||
SetProcessDpiAwarenessType pSPDA;
|
||||
pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness");
|
||||
// <FS:Ansariel> Set DPI awareness via manifest as recommended
|
||||
//SetProcessDpiAwarenessType pSPDA;
|
||||
//pSPDA = (SetProcessDpiAwarenessType)GetProcAddress(hShcore, "SetProcessDpiAwareness");
|
||||
// </FS:Ansariel>
|
||||
GetDpiForMonitorType pGDFM;
|
||||
pGDFM = (GetDpiForMonitorType)GetProcAddress(hShcore, "GetDpiForMonitor");
|
||||
if (pSPDA != NULL && pGDFM != NULL)
|
||||
if (/*pSPDA != NULL &&*/ pGDFM != NULL) // <FS:Ansariel> Set DPI awareness via manifest as recommended
|
||||
{
|
||||
pSPDA(PROCESS_PER_MONITOR_DPI_AWARE);
|
||||
//pSPDA(PROCESS_PER_MONITOR_DPI_AWARE); // <FS:Ansariel> 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);
|
||||
// <FS:Ansariel> Get scaling for primary display, assuming that's where we open the viewer
|
||||
//hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
|
||||
// </FS:Ansariel>
|
||||
hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy);
|
||||
scale_value = dpix / 96.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,9 @@
|
|||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true/PM</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
|
|
|||
|
|
@ -9,4 +9,9 @@
|
|||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||
<dpiAware>true/PM</dpiAware>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
|
|
|
|||
Loading…
Reference in New Issue