From e50e820d43fec083fc3e3f00470749cf85c04dc0 Mon Sep 17 00:00:00 2001 From: liuxinhao Date: Mon, 15 Aug 2022 15:11:13 +0800 Subject: [PATCH] Fixed QT font DPI to avoid double scaling --- ...-QT-font-DPI-to-avoid-double-scaling.patch | 42 +++++++++++++++++++ kiran-cc-daemon.spec | 6 ++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch diff --git a/0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch b/0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch new file mode 100644 index 0000000..0f42d6c --- /dev/null +++ b/0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch @@ -0,0 +1,42 @@ +From 45d7ab7118b99033aca71700c2f5dbded695c53d Mon Sep 17 00:00:00 2001 +From: liuxinhao +Date: Mon, 15 Aug 2022 14:58:13 +0800 +Subject: [PATCH] fix(hidpi): Fixed QT font DPI to avoid double scaling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 设置缩放两倍时,通过QT_FONT_DPI固定QT字体DPI,避免QT_SCALE_FACTOR和Xft.dpi对字体进行两次缩放过大的问题 + +Closes #I5LQSK #I5LQQQ +--- + plugins/xsettings/xsettings-manager.cpp | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/plugins/xsettings/xsettings-manager.cpp b/plugins/xsettings/xsettings-manager.cpp +index 9612a85..7532668 100644 +--- a/plugins/xsettings/xsettings-manager.cpp ++++ b/plugins/xsettings/xsettings-manager.cpp +@@ -346,10 +346,19 @@ void XSettingsManager::scale_change_workarounds(int32_t scale) + KLOG_WARNING("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error.c_str()); + } + ++ ++ /* FIXME: 由于QT_SCALE_FACTOR将会放大窗口以及pt大小字体,而缩放将会更改Xft.dpi属性,该属性也会导致qt pt字体大小放大,字体将会放大过多。 ++ 目前暂时解决方案:缩放两倍时固定Qt字体DPI 96,由QT_SCALE_FACTOR环境变量对窗口以及字体进行放大. ++ 后续应弃用QT_SCALE_FACTOR方案 ++ */ + if (!XSettingsUtils::update_user_env_variable("QT_SCALE_FACTOR", scale == 2 ? "2" : "1", error)) + { + KLOG_WARNING("There was a problem when setting QT_SCALE_FACTOR=%d: %s", scale, error.c_str()); + } ++ else if ( scale==2 && !XSettingsUtils::update_user_env_variable("QT_FONT_DPI","96",error) ) ++ { ++ KLOG_WARNING("There was a problem when setting QT_FONT_DPI=96: %s", error.c_str()); ++ } + } + } + else +-- +2.33.0 + diff --git a/kiran-cc-daemon.spec b/kiran-cc-daemon.spec index c41a48e..5a6e131 100644 --- a/kiran-cc-daemon.spec +++ b/kiran-cc-daemon.spec @@ -1,12 +1,13 @@ Name: kiran-cc-daemon Version: 2.3.1 -Release: 2 +Release: 3 Summary: DBus daemon for Kiran Desktop License: MulanPSL-2.0 Source0: %{name}-%{version}.tar.gz Patch0001: 0001-fix-coredump-Fix-coredump-problem-caused-by-nullpoin.patch +Patch0002: 0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch BuildRequires: cmake >= 3.2 @@ -146,6 +147,9 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || : %{_libdir}/pkgconfig/kiran-cc-daemon.pc %changelog +* Mon Aug 15 2022 liuxinhao - 2.3.1-3 +- KYOS-F: Fixed QT font DPI to avoid double scaling(#I5LQSK,#I5LQQQ) + * Tue Aug 09 2022 tangjie02 - 2.3.1-2 - KYOS-B: Fix coredump problem caused by nullpointer to SPwd.