From a16945f094f2797dc7c8047ba831f0ab052e37d6 Mon Sep 17 00:00:00 2001 From: Gwyn Ciesla Date: Mar 18 2024 14:53:36 +0000 Subject: Patch for kf6 scaling --- diff --git a/86abb6fd8a8f680f9fc5ff1db775845c9f4e254b.patch b/86abb6fd8a8f680f9fc5ff1db775845c9f4e254b.patch new file mode 100644 index 0000000..69a581a --- /dev/null +++ b/86abb6fd8a8f680f9fc5ff1db775845c9f4e254b.patch @@ -0,0 +1,58 @@ +From 86abb6fd8a8f680f9fc5ff1db775845c9f4e254b Mon Sep 17 00:00:00 2001 +From: Michael Weghorn +Date: Wed, 13 Mar 2024 12:27:12 +0100 +Subject: [PATCH] tdf#159915 qt: Force + Qt::HighDpiScaleFactorRoundingPolicy::Round + +For now, force `Qt::HighDpiScaleFactorRoundingPolicy::Round` +for the HighDPI-scale factor rounding policy [1], which is the default +for Qt 5, while Qt 6 defaults to `Qt::HighDpiScaleFactorRoundingPolicy::PassThrough` +(see [2]), which resulted in broken rendering (e.g. "Help" -> "About" +dialog not showing the whole content) when fractional display scaling like 150 % +is configured in the KDE Plasma display settings (in contrast to manually setting the +`QT_SCALE_FACTOR=1.5` env variable to apply scaling, which was working +fine). + +Quoting from [3]: + +> The two principal options are whether fractional scale factors should be +> rounded to an integer or not. Keeping the scale factor as-is will make +> the user interface size match the OS setting exactly, but may cause +> painting errors, for example with the Windows style. + +Manually setting the env variable `QT_SCALE_FACTOR_ROUNDING_POLICY="Round"` +has the same effect (and can be used with LO versions not yet +containing this fix). + +(There might be a way to adjust the way that scaling happens +to make other policies work, but for now, just hard-code to +the policy that is known to work.) + +[1] https://doc.qt.io/qt-6/qt.html#HighDpiScaleFactorRoundingPolicy-enum +[2] https://doc.qt.io/qt-6/highdpi.html#environment-variable-reference +[3] https://doc.qt.io/qt-6/qguiapplication.html#setHighDpiScaleFactorRoundingPolicy + +Change-Id: I8eb6911d4dd5faf00912b8f15a58e0bdace1995a +Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164768 +Tested-by: Jenkins +Reviewed-by: Michael Weghorn +--- + vcl/qt5/QtInstance.cxx | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/vcl/qt5/QtInstance.cxx b/vcl/qt5/QtInstance.cxx +index 6b3bd0cc301ae..2801601115ecd 100644 +--- a/vcl/qt5/QtInstance.cxx ++++ b/vcl/qt5/QtInstance.cxx +@@ -740,6 +740,11 @@ std::unique_ptr QtInstance::CreateQApplication(int& nArgc, char** + // for scaled icons in the native menus + QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); + #endif ++ // force Qt::HighDpiScaleFactorRoundingPolicy::Round, which is the Qt 5 default ++ // policy and prevents incorrect rendering with the Qt 6 default policy ++ // Qt::HighDpiScaleFactorRoundingPolicy::PassThrough (tdf#159915) ++ QGuiApplication::setHighDpiScaleFactorRoundingPolicy( ++ Qt::HighDpiScaleFactorRoundingPolicy::Round); + + FreeableCStr session_manager; + if (getenv("SESSION_MANAGER") != nullptr) diff --git a/libreoffice.spec b/libreoffice.spec index a8aa9f2..861186a 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -329,6 +329,8 @@ Patch11: lo-7.6-ppc64le-tests.patch # https://bugs.gentoo.org/917618 # https://bugs.documentfoundation.org/show_bug.cgi?id=158108 Patch12: libreoffice-7.5.8.2-icu-74-compatibility.patch +# Patch for kf6 scaling. +Patch13: 86abb6fd8a8f680f9fc5ff1db775845c9f4e254b.patch Patch500: 0001-disable-libe-book-support.patch # https://lists.freedesktop.org/archives/libreoffice/2023-September/090948.html Patch501: kahansum_test_fix_for_aarc64_s390x.patch