!47 Fix user add custom mode display
From: @meizhigang Reviewed-by: @tangjie02 Signed-off-by: @tangjie02
This commit is contained in:
commit
4491da34b5
152
0001-fix-display-Fix-user-add-custom-mode-display.patch
Normal file
152
0001-fix-display-Fix-user-add-custom-mode-display.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From d968dc71c978c79118f6c3cf267bf06908bcc374 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Tue, 10 Jan 2023 17:28:14 +0800
|
||||
Subject: [PATCH] fix(display): Fix user add custom mode display
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配用户自定义分辨率显示
|
||||
|
||||
Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
---
|
||||
plugins/display/display-monitor.cpp | 11 ++++-------
|
||||
plugins/display/xrandr-manager.cpp | 20 ++++++++++++--------
|
||||
plugins/display/xrandr-manager.h | 13 +++++++------
|
||||
3 files changed, 23 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/plugins/display/display-monitor.cpp b/plugins/display/display-monitor.cpp
|
||||
index c063925..cefecea 100644
|
||||
--- a/plugins/display/display-monitor.cpp
|
||||
+++ b/plugins/display/display-monitor.cpp
|
||||
@@ -112,10 +112,7 @@ std::string DisplayMonitor::generate_cmdline(bool priamry)
|
||||
}
|
||||
else
|
||||
{
|
||||
- result += fmt::format(" --mode {0}x{1} --rate {2}",
|
||||
- mode->width,
|
||||
- mode->height,
|
||||
- mode->refresh_rate);
|
||||
+ result += fmt::format(" --mode 0x{0:x}", mode->id);
|
||||
}
|
||||
|
||||
if (this->monitor_info_.x >= 0 && this->monitor_info_.y >= 0)
|
||||
@@ -228,7 +225,7 @@ void DisplayMonitor::ListModes(MethodInvocation &invocation)
|
||||
auto monitor = XrandrManager::get_instance()->get_mode(mode_id);
|
||||
if (monitor)
|
||||
{
|
||||
- result.push_back(*monitor.get());
|
||||
+ result.push_back(std::make_tuple(monitor->id, monitor->width, monitor->height, monitor->refresh_rate));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -248,7 +245,7 @@ void DisplayMonitor::ListPreferredModes(MethodInvocation &invocation)
|
||||
auto monitor = XrandrManager::get_instance()->get_mode(this->monitor_info_.modes[i]);
|
||||
if (monitor)
|
||||
{
|
||||
- result.push_back(*monitor.get());
|
||||
+ result.push_back(std::make_tuple(monitor->id, monitor->width, monitor->height, monitor->refresh_rate));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -266,7 +263,7 @@ void DisplayMonitor::GetCurrentMode(MethodInvocation &invocation)
|
||||
auto monitor = XrandrManager::get_instance()->get_mode(this->monitor_info_.mode);
|
||||
if (monitor)
|
||||
{
|
||||
- result = *monitor.get();
|
||||
+ result = std::make_tuple(monitor->id, monitor->width, monitor->height, monitor->refresh_rate);
|
||||
invocation.ret(result);
|
||||
}
|
||||
else
|
||||
diff --git a/plugins/display/xrandr-manager.cpp b/plugins/display/xrandr-manager.cpp
|
||||
index a92501b..4f6b2e6 100644
|
||||
--- a/plugins/display/xrandr-manager.cpp
|
||||
+++ b/plugins/display/xrandr-manager.cpp
|
||||
@@ -77,21 +77,24 @@ CrtcInfo::CrtcInfo(RRCrtc crtc_id, XRRCrtcInfo* crtc_info) : id(crtc_id),
|
||||
ModeInfo::ModeInfo() : id(0),
|
||||
width(0),
|
||||
height(0),
|
||||
- refresh_rate(0)
|
||||
+ refresh_rate(0),
|
||||
+ name(std::string(""))
|
||||
{
|
||||
}
|
||||
|
||||
ModeInfo::ModeInfo(XRRModeInfo* mode_info) : id(mode_info->id),
|
||||
width(mode_info->width),
|
||||
height(mode_info->height),
|
||||
- refresh_rate((mode_info->dotClock / (double)mode_info->hTotal) / mode_info->vTotal)
|
||||
+ refresh_rate((mode_info->dotClock / (double)mode_info->hTotal) / mode_info->vTotal),
|
||||
+ name(std::string(mode_info->name))
|
||||
{
|
||||
}
|
||||
|
||||
-ModeInfo::ModeInfo(std::tuple<guint32, guint32, guint32, double> mode_info) : id(std::get<0>(mode_info)),
|
||||
- width(std::get<1>(mode_info)),
|
||||
- height(std::get<2>(mode_info)),
|
||||
- refresh_rate(std::get<3>(mode_info))
|
||||
+ModeInfo::ModeInfo(std::tuple<guint32, guint32, guint32, double, std::string> mode_info) : id(std::get<0>(mode_info)),
|
||||
+ width(std::get<1>(mode_info)),
|
||||
+ height(std::get<2>(mode_info)),
|
||||
+ refresh_rate(std::get<3>(mode_info)),
|
||||
+ name(std::get<4>(mode_info))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -485,11 +488,12 @@ void XrandrManager::load_mods()
|
||||
auto mode = std::make_shared<ModeInfo>(&this->resources_->modes[i]);
|
||||
this->modes_.emplace(mode->id, mode);
|
||||
|
||||
- KLOG_DEBUG("mode(%u) width: %u, height: %u refresh_rate: %f.",
|
||||
+ KLOG_DEBUG("mode(%u) width: %u, height: %u refresh_rate: %f name: %s.",
|
||||
mode->id,
|
||||
mode->width,
|
||||
mode->height,
|
||||
- mode->refresh_rate);
|
||||
+ mode->refresh_rate,
|
||||
+ mode->name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/plugins/display/xrandr-manager.h b/plugins/display/xrandr-manager.h
|
||||
index 90677d0..e87ac19 100644
|
||||
--- a/plugins/display/xrandr-manager.h
|
||||
+++ b/plugins/display/xrandr-manager.h
|
||||
@@ -99,27 +99,28 @@ struct ModeInfo
|
||||
{
|
||||
ModeInfo();
|
||||
ModeInfo(XRRModeInfo* mode_info);
|
||||
- ModeInfo(std::tuple<guint32, guint32, guint32, double> mode_info);
|
||||
+ ModeInfo(std::tuple<guint32, guint32, guint32, double, std::string> mode_info);
|
||||
RRMode id;
|
||||
- // mode的名字
|
||||
- // std::string name;
|
||||
// 分辨率大小
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
// 刷新率
|
||||
double refresh_rate;
|
||||
+ // mode的名字
|
||||
+ std::string name;
|
||||
|
||||
- operator std::tuple<guint32, guint32, guint32, double>() const
|
||||
+ operator std::tuple<guint32, guint32, guint32, double, std::string>() const
|
||||
{
|
||||
- return std::make_tuple(id, width, height, refresh_rate);
|
||||
+ return std::make_tuple(id, width, height, refresh_rate, name);
|
||||
}
|
||||
|
||||
- ModeInfo& operator=(const std::tuple<guint32, guint32, guint32, double>& value)
|
||||
+ ModeInfo& operator=(const std::tuple<guint32, guint32, guint32, double, std::string>& value)
|
||||
{
|
||||
this->id = std::get<0>(value);
|
||||
this->width = std::get<1>(value);
|
||||
this->height = std::get<2>(value);
|
||||
this->refresh_rate = std::get<3>(value);
|
||||
+ this->name = std::get<4>(value);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: kiran-cc-daemon
|
||||
Version: 2.4.0
|
||||
Release: 5
|
||||
Release: 6
|
||||
Summary: DBus daemon for Kiran Desktop
|
||||
|
||||
License: MulanPSL-2.0
|
||||
@ -10,6 +10,7 @@ Patch0001: 0001-feature-timedate-Delete-timedate_i.h-file.patch
|
||||
Patch0002: 0001-fix-passwd-Fix-password-policy-inconsistencies.patch
|
||||
Patch0003: 0001-feature-backlight-Support-brightness-modification-by.patch
|
||||
Patch0004: 0001-fix-accounts-Fix-the-polkit-action-for-ChangeAccount.patch
|
||||
Patch0005: 0001-fix-display-Fix-user-add-custom-mode-display.patch
|
||||
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
@ -155,6 +156,9 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
|
||||
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
|
||||
|
||||
%changelog
|
||||
* Wed Jan 11 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.4.0-6
|
||||
- KYOS-B: Fix user add custom mode display.
|
||||
|
||||
* Thu Jan 05 2023 tangjie02 <tangjie02@kylinsec.com.cn> - 2.4.0-5
|
||||
- KYOS-B: Fix the polkit action for ChangeAccountType.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user