kiran-cc-daemon/0001-fix-display-fix-the-switch-function-invalidation-pro.patch
2023-10-08 17:30:52 +08:00

61 lines
2.3 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 975edfa981e6063c039863df74abd24a18e69804 Mon Sep 17 00:00:00 2001
From: tangjie02 <tangjie02@kylinsec.com.cn>
Date: Sun, 8 Oct 2023 11:04:08 +0800
Subject: [PATCH] fix(display): fix the switch function invalidation problem
after turn off monitor, then logout and relogin session.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复在关闭显示器后,注销再登录到会话后关闭功能失效问题。
Fixed #17149
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
---
plugins/display/display-manager.cpp | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
index 10a4b61..bea2644 100644
--- a/plugins/display/display-manager.cpp
+++ b/plugins/display/display-manager.cpp
@@ -436,16 +436,6 @@ bool DisplayManager::apply_screen_config(const ScreenConfigInfo &screen_config,
monitor->name_get().c_str());
}
- auto mode = monitor->match_best_mode(c_monitor.width(), c_monitor.height(), c_monitor.refresh_rate());
- if (!mode)
- {
- KLOG_WARNING("Cannot match the mode. width: %d, height: %d, refresh: %.2f.",
- c_monitor.width(),
- c_monitor.height(),
- c_monitor.refresh_rate());
- return false;
- }
-
if (!c_monitor.enabled())
{
monitor->enabled_set(false);
@@ -457,6 +447,17 @@ bool DisplayManager::apply_screen_config(const ScreenConfigInfo &screen_config,
}
else
{
+ // 只有在显示器开启状态下才能取匹配mode因为显示器关闭状态下c_monitor里面保持的分辨率都是0x0
+ auto mode = monitor->match_best_mode(c_monitor.width(), c_monitor.height(), c_monitor.refresh_rate());
+ if (!mode)
+ {
+ KLOG_WARNING("Cannot match the mode. width: %d, height: %d, refresh: %.2f.",
+ c_monitor.width(),
+ c_monitor.height(),
+ c_monitor.refresh_rate());
+ return false;
+ }
+
monitor->enabled_set(true);
monitor->x_set(c_monitor.x());
monitor->y_set(c_monitor.y());
--
2.36.1