diff options
author | John Preston <johnprestonmail@gmail.com> | 2023-03-15 17:17:46 +0400 |
---|---|---|
committer | John Preston <johnprestonmail@gmail.com> | 2023-03-15 17:17:46 +0400 |
commit | 7264d82e8d806dd8127878de75dd4810ad13c039 (patch) | |
tree | f28b2cd265cec9a1ce228b43eeecb93e6914ba1e | |
parent | ba01ba4c33a8428d019f412848c1207adddca7d0 (diff) |
Allow larger scales on high-dpi screens.
-rw-r--r-- | Telegram/SourceFiles/core/sandbox.cpp | 9 | ||||
-rw-r--r-- | Telegram/SourceFiles/settings/settings_main.cpp | 2 | ||||
-rw-r--r-- | Telegram/SourceFiles/settings/settings_scale_preview.cpp | 2 | ||||
m--------- | Telegram/lib_ui | 0 |
4 files changed, 6 insertions, 7 deletions
diff --git a/Telegram/SourceFiles/core/sandbox.cpp b/Telegram/SourceFiles/core/sandbox.cpp index 7be76f0b72..0dbe352613 100644 --- a/Telegram/SourceFiles/core/sandbox.cpp +++ b/Telegram/SourceFiles/core/sandbox.cpp @@ -246,11 +246,10 @@ void Sandbox::setupScreenScale() { // 110% for Retina screens by default. cSetScreenScale((useRatio == 2) ? 110 : style::kScaleDefault); } else { - const auto clamped = std::clamp( - screenScale * useRatio, - style::kScaleMin * useRatio, - style::kScaleMax); - cSetScreenScale(int(base::SafeRound(clamped * 1. / useRatio))); + cSetScreenScale(std::clamp( + screenScale, + style::kScaleMin, + style::MaxScaleForRatio(useRatio))); } LOG(("DevicePixelRatio: %1").arg(useRatio)); LOG(("ScreenScale: %1").arg(cScreenScale())); diff --git a/Telegram/SourceFiles/settings/settings_main.cpp b/Telegram/SourceFiles/settings/settings_main.cpp index 39fd8133d2..48105d8ef1 100644 --- a/Telegram/SourceFiles/settings/settings_main.cpp +++ b/Telegram/SourceFiles/settings/settings_main.cpp @@ -447,7 +447,7 @@ void SetupInterfaceScale( const auto ratio = style::DevicePixelRatio(); const auto scaleMin = style::kScaleMin; - const auto scaleMax = style::kScaleMax / ratio; + const auto scaleMax = style::MaxScaleForRatio(ratio); const auto scaleConfig = cConfigScale(); const auto step = 5; Assert(!((scaleMax - scaleMin) % step)); diff --git a/Telegram/SourceFiles/settings/settings_scale_preview.cpp b/Telegram/SourceFiles/settings/settings_scale_preview.cpp index 55ba3dcbb2..251814630f 100644 --- a/Telegram/SourceFiles/settings/settings_scale_preview.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_preview.cpp @@ -298,7 +298,7 @@ void Preview::init() { initAsWindow(); updateToScale(style::kScaleMin); _minOuterSize = _outer.size(); - updateToScale(style::kScaleMax / _ratio); + updateToScale(style::MaxScaleForRatio(_ratio)); _maxOuterSize = _outer.size(); } } diff --git a/Telegram/lib_ui b/Telegram/lib_ui -Subproject dec1cd8cea24e396c37c327929c0135d4654162 +Subproject bcb56492c4cab204b8b27d762586e4bdbcc6c07 |