kiran-cc-daemon/0001-fix-display-Add-adaptive-screen-change-flag.patch

60 lines
2.3 KiB
Diff
Raw Normal View History

From a3f33d4f38ccb786f3336e30db72741f1781cb57 Mon Sep 17 00:00:00 2001
From: huangjiawen <huangjiawen@kylinsec.com.cn>
Date: Mon, 29 May 2023 14:40:59 +0800
Subject: [PATCH] fix(display): Add adaptive screen change flag
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 添加自适应屏幕变化的标志
Signed-off-by: huangjiawen <huangjiawen@kylinsec.com.cn>
---
data/schemas/com.kylinsec.kiran.display.gschema.xml.in | 6 ++++++
plugins/display/display-manager.cpp | 5 ++++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/data/schemas/com.kylinsec.kiran.display.gschema.xml.in b/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
index ea752a8..7c4930f 100644
--- a/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
+++ b/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
@@ -18,5 +18,11 @@
<default>false</default>
<description>It takes effect immediately when the scaling factor of window is changed.</description>
</key>
+
+ <key name="screen-changed-adaptation" type="b">
+ <default>true</default>
+ <description>Set whether to adapt to screen changes </description>
+ </key>
+
</schema>
</schemalist>
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
index 244006e..0860253 100644
--- a/plugins/display/display-manager.cpp
+++ b/plugins/display/display-manager.cpp
@@ -26,6 +26,7 @@ namespace Kiran
{
#define DISPLAY_SCHEMA_ID "com.kylinsec.kiran.display"
#define DISPLAY_SCHEMA_STYLE "display-style"
+#define SCREEN_CHANGED_ADAPT "screen-changed-adaptation"
#define DISPLAY_CONF_DIR "kylinsec/" PROJECT_NAME "/display"
#define DISPLAY_FILE_NAME "display.xml"
@@ -859,8 +860,10 @@ void DisplayManager::resources_changed()
this->load_monitors();
auto new_monitors_uid = this->get_monitors_uid();
+ auto screen_changed_adaptation = this->display_settings_->get_boolean(SCREEN_CHANGED_ADAPT);
+
// 如果uid不相同说明设备硬件发生了变化此时需要重新进行设置
- if (old_monitors_uid != new_monitors_uid)
+ if (screen_changed_adaptation && old_monitors_uid != new_monitors_uid)
{
CCErrorCode error_code = CCErrorCode::SUCCESS;
if (!this->switch_style_and_save(this->default_style_, error_code))
--
2.33.0