kiran-cc-daemon/0001-fix-hidpi-Fixed-QT-font-DPI-to-avoid-double-scaling.patch
2022-08-15 15:11:13 +08:00

43 lines
1.9 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 45d7ab7118b99033aca71700c2f5dbded695c53d Mon Sep 17 00:00:00 2001
From: liuxinhao <liuxinhao@kylinsec.com.cn>
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