FIRE-20416: Option to enable automatic UI scaling
parent
b1a0627b75
commit
07f24a3d3d
|
|
@ -175,10 +175,16 @@ BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
{
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
//void LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
//{
|
||||
|
||||
//}
|
||||
BOOL LLWindowCallbacks::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,10 @@ public:
|
|||
virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data);
|
||||
virtual BOOL handleTimerEvent(LLWindow *window);
|
||||
virtual BOOL handleDeviceChange(LLWindow *window);
|
||||
virtual void handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
//virtual void handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
virtual BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
// </FS:Ansariel>
|
||||
|
||||
enum DragNDropAction {
|
||||
DNDA_START_TRACKING = 0,// Start tracking an incoming drag
|
||||
|
|
|
|||
|
|
@ -2651,7 +2651,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
|
|||
lprc_new_scale = (LPRECT)l_param;
|
||||
S32 new_width = lprc_new_scale->right - lprc_new_scale->left;
|
||||
S32 new_height = lprc_new_scale->bottom - lprc_new_scale->top;
|
||||
window_imp->mCallbacks->handleDPIChanged(window_imp, new_scale, new_width, new_height);
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
//window_imp->mCallbacks->handleDPIChanged(window_imp, new_scale, new_width, new_height);
|
||||
if (window_imp->mCallbacks->handleDPIChanged(window_imp, new_scale, new_width, new_height))
|
||||
// </FS:Ansariel>
|
||||
SetWindowPos(h_wnd,
|
||||
HWND_TOP,
|
||||
lprc_new_scale->left,
|
||||
|
|
|
|||
|
|
@ -24224,6 +24224,17 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>FSEnableAutomaticUIScaling</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>If enabled, the viewer will try to detect the correct factor based on the scaling set in the operating system. This feature is currently only available on Windows.</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
||||
|
|
|
|||
|
|
@ -1670,17 +1670,29 @@ BOOL LLViewerWindow::handleDeviceChange(LLWindow *window)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
void LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
//void LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height)
|
||||
// </FS:Ansariel>
|
||||
{
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
if (!gSavedSettings.getBOOL("FSEnableAutomaticUIScaling"))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
if (ui_scale_factor >= MIN_UI_SCALE && ui_scale_factor <= MAX_UI_SCALE)
|
||||
{
|
||||
gSavedSettings.setF32("UIScaleFactor", ui_scale_factor);
|
||||
LLViewerWindow::reshape(window_width, window_height);
|
||||
mResDirty = true;
|
||||
return TRUE; // <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_WARNS() << "DPI change caused UI scale to go out of bounds: " << ui_scale_factor << LL_ENDL;
|
||||
return FALSE; // <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1847,7 +1859,10 @@ LLViewerWindow::LLViewerWindow(const Params& p)
|
|||
// reset to default;
|
||||
system_scale_factor = 1.f;
|
||||
}
|
||||
if (p.first_run || gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor)
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
//if (p.first_run || gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor)
|
||||
if (p.first_run || (gSavedSettings.getBOOL("FSEnableAutomaticUIScaling") && gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor))
|
||||
// </FS:Ansariel>
|
||||
{
|
||||
mSystemUIScaleFactorChanged = !p.first_run;
|
||||
gSavedSettings.setF32("LastSystemUIScaleFactor", system_scale_factor);
|
||||
|
|
|
|||
|
|
@ -212,7 +212,10 @@ public:
|
|||
/*virtual*/ void handleDataCopy(LLWindow *window, S32 data_type, void *data);
|
||||
/*virtual*/ BOOL handleTimerEvent(LLWindow *window);
|
||||
/*virtual*/ BOOL handleDeviceChange(LLWindow *window);
|
||||
/*virtual*/ void handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
// <FS:Ansariel> FIRE-20416: Option for automatic UI scaling
|
||||
/*virtual*/ //void handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
/*virtual*/ BOOL handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 window_width, S32 window_height);
|
||||
// </FS:Ansariel>
|
||||
|
||||
/*virtual*/ void handlePingWatchdog(LLWindow *window, const char * msg);
|
||||
/*virtual*/ void handlePauseWatchdog(LLWindow *window);
|
||||
|
|
|
|||
|
|
@ -33,9 +33,10 @@
|
|||
|
||||
<!--2D Overlay-->
|
||||
<panel label="2D-Overlay" name="ui-2d-overlay">
|
||||
<text name="UI Size:" width="220">
|
||||
UI-Skalierung (Nebeneffekte möglich):
|
||||
<text name="UI Size:" width="80">
|
||||
UI-Skalierung:
|
||||
</text>
|
||||
<check_box label="Automatisch UI-Skalierungsfaktor ermitteln" name="FSEnableAutomaticUIScaling" tool_tip="Falls aktiviert, wird der Viewer versuchen, den korrekten Faktor anhand der Skaling des Betriebssystems zu ermitteln. Diese Funktion ist aktuell nur unter Windows verfügbar."/>
|
||||
<text name="ScriptDialogsPerObjectLabel">
|
||||
Skriptdialoge pro Objekt:
|
||||
</text>
|
||||
|
|
|
|||
|
|
@ -244,7 +244,6 @@
|
|||
follows="all"
|
||||
label="2D Overlay"
|
||||
name="ui-2d-overlay" >
|
||||
|
||||
<text
|
||||
type="string"
|
||||
length="1"
|
||||
|
|
@ -254,8 +253,8 @@
|
|||
left="10"
|
||||
name="UI Size:"
|
||||
top_pad="8"
|
||||
width="200">
|
||||
UI Scaling (may cause side effects):
|
||||
width="60">
|
||||
UI Scaling:
|
||||
</text>
|
||||
<slider
|
||||
control_name="UIScaleFactor"
|
||||
|
|
@ -270,7 +269,18 @@
|
|||
min_val="0.75"
|
||||
name="ui_scale_slider"
|
||||
top_pad="-14"
|
||||
width="250" />
|
||||
width="390" />
|
||||
|
||||
<check_box
|
||||
control_name="FSEnableAutomaticUIScaling"
|
||||
height="16"
|
||||
label="Automatically detect UI scaling factor"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="FSEnableAutomaticUIScaling"
|
||||
tool_tip="If enabled, the viewer will try to detect the correct factor based on the scaling set in the operating system. This feature is currently only available on Windows."
|
||||
top_pad="5"
|
||||
width="256" />
|
||||
|
||||
<text
|
||||
type="string"
|
||||
|
|
|
|||
Loading…
Reference in New Issue