Feature: Automatic UI and font zoom levels when supported by the OS.
This commit is contained in:
24
src/gfx.cpp
24
src/gfx.cpp
@@ -59,6 +59,10 @@ static ReusableBuffer<uint8> _cursor_backup;
|
||||
ZoomLevel _gui_zoom; ///< GUI Zoom level
|
||||
ZoomLevel _font_zoom; ///< Font Zoom level
|
||||
|
||||
int8 _gui_zoom_cfg; ///< GUI zoom level in config.
|
||||
int8 _font_zoom_cfg; ///< Font zoom level in config.
|
||||
|
||||
|
||||
/**
|
||||
* The rect for repaint.
|
||||
*
|
||||
@@ -1876,3 +1880,23 @@ void SortResolutions()
|
||||
{
|
||||
std::sort(_resolutions.begin(), _resolutions.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve GUI zoom level, if auto-suggestion is requested.
|
||||
*/
|
||||
void UpdateGUIZoom()
|
||||
{
|
||||
/* Determine real GUI zoom to use. */
|
||||
if (_gui_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_gui_zoom = static_cast<ZoomLevel>(Clamp(VideoDriver::GetInstance()->GetSuggestedUIZoom(), _settings_client.gui.zoom_min, _settings_client.gui.zoom_max));
|
||||
} else {
|
||||
_gui_zoom = static_cast<ZoomLevel>(_gui_zoom_cfg);
|
||||
}
|
||||
|
||||
/* Determine real font zoom to use. */
|
||||
if (_font_zoom_cfg == ZOOM_LVL_CFG_AUTO) {
|
||||
_font_zoom = static_cast<ZoomLevel>(VideoDriver::GetInstance()->GetSuggestedUIZoom());
|
||||
} else {
|
||||
_font_zoom = static_cast<ZoomLevel>(_font_zoom_cfg);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user