More fixing to the system UI scaling detection:
* Pass the screen coordinates of the viewer window to getSystemUISize and default to MONITOR_DEFAULTTONEAREST so we get the scaling of the monitor the viewer is running on * Free shcore.dll as soon as we're donemaster
parent
b9fa2329d2
commit
842b2a6791
|
|
@ -168,7 +168,10 @@ public:
|
|||
virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); }
|
||||
|
||||
// Get system UI size based on DPI (for 96 DPI UI size should be 1.0)
|
||||
virtual F32 getSystemUISize() { return 1.0f; }
|
||||
// <FS:Ansariel> Determine scaling of the display we show the viewer
|
||||
//virtual F32 getSystemUISize() { return 1.0f; }
|
||||
virtual F32 getSystemUISize(S32 x, S32 y) { return 1.0f; }
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:TT> Window Title Access
|
||||
//this needs to be overridden for all platforms
|
||||
|
|
|
|||
|
|
@ -3966,7 +3966,10 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
F32 LLWindowWin32::getSystemUISize()
|
||||
// <FS:Ansariel> Determine scaling of the display we show the viewer
|
||||
//F32 LLWindowWin32::getSystemUISize()
|
||||
F32 LLWindowWin32::getSystemUISize(S32 x, S32 y)
|
||||
// </FS:Ansariel>
|
||||
{
|
||||
// <FS:Ansariel> Type fix
|
||||
//float scale_value = 0;
|
||||
|
|
@ -3993,15 +3996,30 @@ F32 LLWindowWin32::getSystemUISize()
|
|||
HRESULT hr = E_FAIL;
|
||||
|
||||
// Get the DPI for the main monitor, and set the scaling factor
|
||||
pt.x = 1;
|
||||
pt.y = 1;
|
||||
// <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> Determine scaling of the display we show the viewer
|
||||
//pt.x = 1;
|
||||
//pt.y = 1;
|
||||
pt.x = x;
|
||||
pt.y = y;
|
||||
// </FS:Ansariel>
|
||||
hMonitor = MonitorFromPoint(pt, MONITOR_DEFAULTTONEAREST);
|
||||
hr = pGDFM(hMonitor, MDT_EFFECTIVE_DPI, &dpix, &dpiy);
|
||||
scale_value = dpix / 96.0f;
|
||||
// <FS:Ansariel> Check result before using it
|
||||
//scale_value = dpix / 96.0f;
|
||||
if (hr == S_OK)
|
||||
{
|
||||
scale_value = dpix / 96.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "Could not determine DPI for monitor. Defaulting to 100 %" << LL_ENDL;
|
||||
scale_value = 1.0f;
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
}
|
||||
|
||||
// <FS:Ansariel> Free library early - not needed anymore
|
||||
FreeLibrary(hShcore);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@ public:
|
|||
/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
|
||||
void openFile(const std::string& file_name);
|
||||
|
||||
/*virtual*/ F32 getSystemUISize();
|
||||
// <FS:Ansariel> Determine scaling of the display we show the viewer
|
||||
/*virtual*/ //F32 getSystemUISize();
|
||||
/*virtual*/ F32 getSystemUISize(S32 x, S32 y);
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:TT> Window Title Access
|
||||
/*virtual*/ void setTitle(const std::string& win_title);
|
||||
|
|
|
|||
|
|
@ -1821,7 +1821,10 @@ LLViewerWindow::LLViewerWindow(const Params& p)
|
|||
}
|
||||
|
||||
|
||||
F32 system_scale_factor = mWindow->getSystemUISize();
|
||||
// <FS:Ansariel> Determine scaling of the display we show the viewer
|
||||
//F32 system_scale_factor = mWindow->getSystemUISize();
|
||||
F32 system_scale_factor = mWindow->getSystemUISize(p.x, p.y);
|
||||
// </FS:Ansariel>
|
||||
if (p.first_run || gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor)
|
||||
{
|
||||
mSystemUIScaleFactorChanged = true;
|
||||
|
|
|
|||
Loading…
Reference in New Issue