Skip to content

Commit

Permalink
Fix remaining known xdg-output fractional scaling issues on Wayland
Browse files Browse the repository at this point in the history
And enable it by default
  • Loading branch information
ilya-fedin authored and john-preston committed Dec 7, 2023
1 parent 85f5621 commit e173c72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions Telegram/SourceFiles/core/sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ base::options::toggle OptionForceWaylandFractionalScaling({
"This works without fractional-scale-v1 and without "
"precise High DPI scaling. "
"Requires Qt with Desktop App Toolkit patches.",
.defaultValue = true,
.scope = [] {
#ifdef DESKTOP_APP_QT_PATCHED
return Platform::IsWayland();
Expand Down Expand Up @@ -252,12 +253,7 @@ void Sandbox::setupScreenScale() {
logEnv("QT_USE_PHYSICAL_DPI");
logEnv("QT_FONT_DPI");

// Like Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor.
// Round up for .75 and higher. This favors "small UI" over "large UI".
const auto roundedRatio = ((ratio - qFloor(ratio)) < 0.75)
? qFloor(ratio)
: qCeil(ratio);
const auto useRatio = std::clamp(roundedRatio, 1, 3);
const auto useRatio = std::clamp(qCeil(ratio), 1, 3);
style::SetDevicePixelRatio(useRatio);

const auto screen = Sandbox::primaryScreen();
Expand Down
2 changes: 1 addition & 1 deletion Telegram/build/docker/centos_env/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ FROM builder AS patches
RUN git init patches \
&& cd patches \
&& git remote add origin {{ GIT }}/desktop-app/patches.git \
&& git fetch --depth=1 origin 8b95f2787ee69f3ff16a62c68b39bb8bb3d0fa68 \
&& git fetch --depth=1 origin 12780ae73abe21d00ae125e284d8bca9d8993948 \
&& git reset --hard FETCH_HEAD \
&& rm -rf .git

Expand Down

0 comments on commit e173c72

Please sign in to comment.