From a85f97fbc7d61d35580bab17f0a9078547c780ae Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sat, 6 Apr 2019 02:13:10 +0200 Subject: [PATCH] Reset UI scale factor on first run if OS display scaling is not set to 100% --- indra/newview/app_settings/settings.xml | 15 ++++++++++++++- indra/newview/llviewerwindow.cpp | 11 +++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d4aa207453..83e5b7cbb1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -25155,7 +25155,7 @@ Change of this parameter will affect the layout of buttons in notification toast Type Boolean Value - 0 + 0 FSLookAtTargetMaxDistance @@ -25168,6 +25168,19 @@ Change of this parameter will affect the layout of buttons in notification toast Value 1 + FSResetUIScaleOnFirstRun + + Comment + Resets the UI scale factor on first run due to changed display scaling behavior + Persist + 1 + Type + Boolean + Value + 1 + Backup + 0 + diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 9641a1f935..f07c603d44 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1841,6 +1841,17 @@ LLViewerWindow::LLViewerWindow(const Params& p) LLCoordScreen scr; mWindow->getSize(&scr); + // Reset UI scale factor on first run if OS's display scaling is not 100% + if (gSavedSettings.getBOOL("FSResetUIScaleOnFirstRun")) + { + if (mWindow->getSystemUISize() != 1.f) + { + gSavedSettings.setF32("UIScaleFactor", 1.f); + } + gSavedSettings.setBOOL("FSResetUIScaleOnFirstRun", FALSE); + } + // + // Get the real window rect the window was created with (since there are various OS-dependent reasons why // the size of a window or fullscreen context may have been adjusted slightly...) F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor"), MIN_UI_SCALE, MAX_UI_SCALE) * mWindow->getSystemUISize();