!119 同步补丁,修复shift不参与按键翻译,避免多重意义,影响匹配
From: @liubuguiii Reviewed-by: @tangjie02 Signed-off-by: @tangjie02
This commit is contained in:
commit
3705438bf7
29
0000-fix-xsettings-set-default-icon-theme-to-Spring.patch
Normal file
29
0000-fix-xsettings-set-default-icon-theme-to-Spring.patch
Normal file
@ -0,0 +1,29 @@
|
||||
From 20611cd306453f544cc53837661ea47161b5e862 Mon Sep 17 00:00:00 2001
|
||||
From: yuanxing <yuanxing@kylinsec.com.cn>
|
||||
Date: Thu, 14 Dec 2023 09:10:00 +0800
|
||||
Subject: [PATCH] fix(xsettings):set default icon theme to Spring
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 将默认图标主题设置为初春
|
||||
---
|
||||
data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
index 12b486a..18fa7ba 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
@@ -26,7 +26,7 @@
|
||||
<description>Name of gtk theme to use.</description>
|
||||
</key>
|
||||
<key name="net-icon-theme-name" type="s">
|
||||
- <default>'Kiran'</default>
|
||||
+ <default>'Spring'</default>
|
||||
<description>Name of icon theme to use for icons.</description>
|
||||
</key>
|
||||
<key name="net-enable-event-sounds" type="b">
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From 56e32fdfbba6226ce47098b71451adbdec208cd1 Mon Sep 17 00:00:00 2001
|
||||
From: luoqing <luoqing@kylinsec.com.cn>
|
||||
Date: Mon, 21 Aug 2023 16:20:08 +0800
|
||||
Subject: [PATCH] feature(font): Change the default GTK application font size
|
||||
from 10 to 9
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 将应用程序字体默认大小由10改为9
|
||||
|
||||
Related #13006
|
||||
---
|
||||
data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
index 142f162..12b486a 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
@@ -70,7 +70,7 @@
|
||||
<description>Size of the cursor referenced by cursor_theme.</description>
|
||||
</key>
|
||||
<key name="gtk-font-name" type="s">
|
||||
- <default>'Noto Sans CJK SC 10'</default>
|
||||
+ <default>'Noto Sans CJK SC 9'</default>
|
||||
<description>Name of default font to use.</description>
|
||||
</key>
|
||||
<key name="gtk-key-theme-name" type="s">
|
||||
--
|
||||
2.33.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,427 +0,0 @@
|
||||
From be5fbd89a3bb0611e117c71325a34f417c19287a Mon Sep 17 00:00:00 2001
|
||||
From: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
Date: Tue, 9 May 2023 16:59:23 +0800
|
||||
Subject: [PATCH] feature(power): Delete LockScreenWhenHibernate and
|
||||
LockScreenWhenSuspend functions and replace suspend/hibernate/shutdown api
|
||||
with SessionManager.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 删除当计算机休眠/待机时是否锁屏功能,将该功能移动到会话管理实现
|
||||
|
||||
Relates #68459
|
||||
|
||||
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
---
|
||||
.../com.kylinsec.kiran.power.gschema.xml.in | 10 --
|
||||
include/power-i.h | 4 -
|
||||
...com.kylinsec.Kiran.SessionDaemon.Power.xml | 24 ----
|
||||
plugins/power/power-manager.cpp | 34 ------
|
||||
plugins/power/power-manager.h | 8 --
|
||||
plugins/power/save/power-save-computer.cpp | 40 +------
|
||||
plugins/power/save/power-save-computer.h | 4 +-
|
||||
plugins/power/wrapper/power-session.cpp | 111 ++++++++++++++++++
|
||||
plugins/power/wrapper/power-session.h | 10 ++
|
||||
9 files changed, 126 insertions(+), 119 deletions(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.power.gschema.xml.in b/data/schemas/com.kylinsec.kiran.power.gschema.xml.in
|
||||
index ab51e40..094ea2f 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.power.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.power.gschema.xml.in
|
||||
@@ -97,16 +97,6 @@
|
||||
<description>Whether does the cpu save energy when the ups or battery power is low.</description>
|
||||
</key>
|
||||
|
||||
- <key name="screen-locked-when-suspend" type="b">
|
||||
- <default>true</default>
|
||||
- <description>Whether lock screen when the computer is suspend.</description>
|
||||
- </key>
|
||||
-
|
||||
- <key name="screen-locked-when-hibernate" type="b">
|
||||
- <default>true</default>
|
||||
- <description>Whether lock screen when the computer is hibernate.</description>
|
||||
- </key>
|
||||
-
|
||||
<key name="button-suspend-action" enum="com.kylinsec.kiran.power.event-action">
|
||||
<default>'suspend'</default>
|
||||
<description>The action to take when the system suspend button is pressed.</description>
|
||||
diff --git a/include/power-i.h b/include/power-i.h
|
||||
index 2aba2fc..8d33a91 100644
|
||||
--- a/include/power-i.h
|
||||
+++ b/include/power-i.h
|
||||
@@ -141,10 +141,6 @@ extern "C"
|
||||
#define POWER_SCHEMA_ENABLE_CHARGE_LOW_DIMMED "enable-charge-low-dimmed"
|
||||
// 电量过低时计算机是否进入节能模式
|
||||
#define POWER_SCHEMA_ENABLE_CHARGE_LOW_SAVER "enable-charge-low-saver"
|
||||
-// 待机时是否锁定屏幕
|
||||
-#define POWER_SCHEMA_SCREEN_LOCKED_WHEN_SUSPEND "screen-locked-when-suspend"
|
||||
-// 休眠时是否锁定屏幕
|
||||
-#define POWER_SCHEMA_SCREEN_LOCKED_WHEN_HIBERNATE "screen-locked-when-hibernate"
|
||||
// 按下挂起键触发的节能行为
|
||||
#define POWER_SCHEMA_BUTTON_SUSPEND_ACTION "button-suspend-action"
|
||||
// 按下休眠键触发的节能行为
|
||||
diff --git a/plugins/power/com.kylinsec.Kiran.SessionDaemon.Power.xml b/plugins/power/com.kylinsec.Kiran.SessionDaemon.Power.xml
|
||||
index 29444f4..fe2f35e 100644
|
||||
--- a/plugins/power/com.kylinsec.Kiran.SessionDaemon.Power.xml
|
||||
+++ b/plugins/power/com.kylinsec.Kiran.SessionDaemon.Power.xml
|
||||
@@ -81,20 +81,6 @@
|
||||
<description>Enable cpu save energy when the ups or battery power is low.</description>
|
||||
</method>
|
||||
|
||||
- <method name="LockScreenWhenSuspend">
|
||||
- <arg type="b" name="enabled" direction="in">
|
||||
- <description>Whether lock screen when the computer is suspend.</description>
|
||||
- </arg>
|
||||
- <description>Lock screen when the computer is suspend.</description>
|
||||
- </method>
|
||||
-
|
||||
- <method name="LockScreenWhenHibernate">
|
||||
- <arg type="b" name="enabled" direction="in">
|
||||
- <description>Whether lock screen when the computer is hibernate.</description>
|
||||
- </arg>
|
||||
- <description>Lock screen when the computer is hibernate.</description>
|
||||
- </method>
|
||||
-
|
||||
<property name="OnBattery" type="b" access="read">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
<description>Indicates whether the system is running on battery power.</description>
|
||||
@@ -120,16 +106,6 @@
|
||||
<description>Whether does the cpu save energy when the ups or battery power is low.</description>
|
||||
</property>
|
||||
|
||||
- <property name="ScreenLockedWhenSuspend" type="b" access="read">
|
||||
- <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
- <description>Whether lock screen when the computer is suspend.</description>
|
||||
- </property>
|
||||
-
|
||||
- <property name="ScreenLockedWhenHibernate" type="b" access="read">
|
||||
- <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
- <description>Whether lock screen when the computer is hibernate.</description>
|
||||
- </property>
|
||||
-
|
||||
<signal name="IdleActionChanged">
|
||||
<arg name="device" type="i" />
|
||||
<arg name="supply" type="i" />
|
||||
diff --git a/plugins/power/power-manager.cpp b/plugins/power/power-manager.cpp
|
||||
index 8438b3f..9282b85 100644
|
||||
--- a/plugins/power/power-manager.cpp
|
||||
+++ b/plugins/power/power-manager.cpp
|
||||
@@ -329,18 +329,6 @@ void PowerManager::EnableChargeLowSaver(bool enabled, MethodInvocation& invocati
|
||||
invocation.ret();
|
||||
}
|
||||
|
||||
-void PowerManager::LockScreenWhenSuspend(bool enabled, MethodInvocation& invocation)
|
||||
-{
|
||||
- this->ScreenLockedWhenSuspend_set(enabled);
|
||||
- invocation.ret();
|
||||
-}
|
||||
-
|
||||
-void PowerManager::LockScreenWhenHibernate(bool enabled, MethodInvocation& invocation)
|
||||
-{
|
||||
- this->ScreenLockedWhenHibernate_set(enabled);
|
||||
- invocation.ret();
|
||||
-}
|
||||
-
|
||||
bool PowerManager::DisplayIdleDimmedEnabled_setHandler(bool value)
|
||||
{
|
||||
this->power_settings_->set_boolean(POWER_SCHEMA_ENABLE_DISPLAY_IDLE_DIMMED, value);
|
||||
@@ -359,18 +347,6 @@ bool PowerManager::ChargeLowSaverEnabled_setHandler(bool value)
|
||||
return true;
|
||||
}
|
||||
|
||||
-bool PowerManager::ScreenLockedWhenSuspend_setHandler(bool value)
|
||||
-{
|
||||
- this->power_settings_->set_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_SUSPEND, value);
|
||||
- return true;
|
||||
-}
|
||||
-
|
||||
-bool PowerManager::ScreenLockedWhenHibernate_setHandler(bool value)
|
||||
-{
|
||||
- this->power_settings_->set_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_HIBERNATE, value);
|
||||
- return true;
|
||||
-}
|
||||
-
|
||||
bool PowerManager::OnBattery_get()
|
||||
{
|
||||
return this->upower_client_->get_on_battery();
|
||||
@@ -396,16 +372,6 @@ bool PowerManager::ChargeLowSaverEnabled_get()
|
||||
return this->power_settings_->get_boolean(POWER_SCHEMA_ENABLE_CHARGE_LOW_SAVER);
|
||||
}
|
||||
|
||||
-bool PowerManager::ScreenLockedWhenSuspend_get()
|
||||
-{
|
||||
- return this->power_settings_->get_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_SUSPEND);
|
||||
-}
|
||||
-
|
||||
-bool PowerManager::ScreenLockedWhenHibernate_get()
|
||||
-{
|
||||
- return this->power_settings_->get_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_HIBERNATE);
|
||||
-}
|
||||
-
|
||||
void PowerManager::on_battery_changed(bool on_battery)
|
||||
{
|
||||
this->OnBattery_set(on_battery);
|
||||
diff --git a/plugins/power/power-manager.h b/plugins/power/power-manager.h
|
||||
index 0f799ee..674de4d 100644
|
||||
--- a/plugins/power/power-manager.h
|
||||
+++ b/plugins/power/power-manager.h
|
||||
@@ -88,18 +88,12 @@ protected:
|
||||
virtual void EnableChargeLowDimmed(bool enabled, MethodInvocation &invocation);
|
||||
// 电量过低时是否进入节能模式
|
||||
virtual void EnableChargeLowSaver(bool enabled, MethodInvocation &invocation);
|
||||
- // 待机时是否锁定屏幕
|
||||
- virtual void LockScreenWhenSuspend(bool enabled, MethodInvocation &invocation);
|
||||
- // 休眠时是否锁定屏幕
|
||||
- virtual void LockScreenWhenHibernate(bool enabled, MethodInvocation &invocation);
|
||||
|
||||
virtual bool OnBattery_setHandler(bool value) { return true; }
|
||||
virtual bool LidIsPresent_setHandler(bool value) { return true; }
|
||||
virtual bool DisplayIdleDimmedEnabled_setHandler(bool value);
|
||||
virtual bool ChargeLowDimmedEnabled_setHandler(bool value);
|
||||
virtual bool ChargeLowSaverEnabled_setHandler(bool value);
|
||||
- virtual bool ScreenLockedWhenSuspend_setHandler(bool value);
|
||||
- virtual bool ScreenLockedWhenHibernate_setHandler(bool value);
|
||||
|
||||
// 系统是否在使用电池供电
|
||||
virtual bool OnBattery_get();
|
||||
@@ -108,8 +102,6 @@ protected:
|
||||
virtual bool DisplayIdleDimmedEnabled_get();
|
||||
virtual bool ChargeLowDimmedEnabled_get();
|
||||
virtual bool ChargeLowSaverEnabled_get();
|
||||
- virtual bool ScreenLockedWhenSuspend_get();
|
||||
- virtual bool ScreenLockedWhenHibernate_get();
|
||||
|
||||
private:
|
||||
void init();
|
||||
diff --git a/plugins/power/save/power-save-computer.cpp b/plugins/power/save/power-save-computer.cpp
|
||||
index cc62fbd..fdf7743 100644
|
||||
--- a/plugins/power/save/power-save-computer.cpp
|
||||
+++ b/plugins/power/save/power-save-computer.cpp
|
||||
@@ -18,9 +18,7 @@ namespace Kiran
|
||||
{
|
||||
PowerSaveComputer::PowerSaveComputer()
|
||||
{
|
||||
- this->power_settings_ = Gio::Settings::create(POWER_SCHEMA_ID);
|
||||
- this->login1_ = PowerWrapperManager::get_instance()->get_default_login1();
|
||||
- this->screensaver_ = PowerWrapperManager::get_instance()->get_default_screensaver();
|
||||
+ this->session_ = PowerWrapperManager::get_instance()->get_default_session();
|
||||
}
|
||||
|
||||
void PowerSaveComputer::init()
|
||||
@@ -29,51 +27,21 @@ void PowerSaveComputer::init()
|
||||
|
||||
void PowerSaveComputer::suspend()
|
||||
{
|
||||
- uint32_t throttle = 0;
|
||||
-
|
||||
- auto lockscreen = this->power_settings_->get_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_SUSPEND);
|
||||
- // 挂起之前锁定屏幕
|
||||
- if (lockscreen)
|
||||
- {
|
||||
- throttle = this->screensaver_->lock_and_throttle("suspend");
|
||||
- }
|
||||
-
|
||||
this->save_changed_.emit(ComputerSaveState::COMPUTER_SAVE_STATE_SLEEP, PowerAction::POWER_ACTION_COMPUTER_SUSPEND);
|
||||
- this->login1_->suspend();
|
||||
+ this->session_->suspend();
|
||||
this->save_changed_.emit(ComputerSaveState::COMPUTER_SAVE_STATE_RESUME, PowerAction::POWER_ACTION_COMPUTER_SUSPEND);
|
||||
-
|
||||
- this->screensaver_->poke();
|
||||
- if (throttle)
|
||||
- {
|
||||
- this->screensaver_->remove_throttle(throttle);
|
||||
- }
|
||||
}
|
||||
|
||||
void PowerSaveComputer::hibernate()
|
||||
{
|
||||
- uint32_t throttle = 0;
|
||||
-
|
||||
- auto lockscreen = this->power_settings_->get_boolean(POWER_SCHEMA_SCREEN_LOCKED_WHEN_HIBERNATE);
|
||||
- // 休眠之前锁定屏幕
|
||||
- if (lockscreen)
|
||||
- {
|
||||
- throttle = this->screensaver_->lock_and_throttle("hibernate");
|
||||
- }
|
||||
-
|
||||
this->save_changed_.emit(ComputerSaveState::COMPUTER_SAVE_STATE_SLEEP, PowerAction::POWER_ACTION_COMPUTER_HIBERNATE);
|
||||
- this->login1_->hibernate();
|
||||
+ this->session_->hibernate();
|
||||
this->save_changed_.emit(ComputerSaveState::COMPUTER_SAVE_STATE_RESUME, PowerAction::POWER_ACTION_COMPUTER_HIBERNATE);
|
||||
-
|
||||
- this->screensaver_->poke();
|
||||
- if (throttle)
|
||||
- {
|
||||
- this->screensaver_->remove_throttle(throttle);
|
||||
- }
|
||||
}
|
||||
|
||||
void PowerSaveComputer::shutdown()
|
||||
{
|
||||
- this->login1_->shutdown();
|
||||
+ this->session_->shutdown();
|
||||
}
|
||||
|
||||
} // namespace Kiran
|
||||
diff --git a/plugins/power/save/power-save-computer.h b/plugins/power/save/power-save-computer.h
|
||||
index eb8f7c3..f516cbf 100644
|
||||
--- a/plugins/power/save/power-save-computer.h
|
||||
+++ b/plugins/power/save/power-save-computer.h
|
||||
@@ -49,9 +49,7 @@ private:
|
||||
private:
|
||||
static PowerSaveComputer* instance_;
|
||||
|
||||
- Glib::RefPtr<Gio::Settings> power_settings_;
|
||||
- std::shared_ptr<PowerLogin1> login1_;
|
||||
- std::shared_ptr<PowerScreenSaver> screensaver_;
|
||||
+ std::shared_ptr<PowerSession> session_;
|
||||
|
||||
sigc::signal<void, ComputerSaveState, PowerAction> save_changed_;
|
||||
};
|
||||
diff --git a/plugins/power/wrapper/power-session.cpp b/plugins/power/wrapper/power-session.cpp
|
||||
index 1a613c1..d87e38b 100644
|
||||
--- a/plugins/power/wrapper/power-session.cpp
|
||||
+++ b/plugins/power/wrapper/power-session.cpp
|
||||
@@ -73,6 +73,117 @@ void PowerSession::init()
|
||||
this->sm_presence_proxy_->signal_signal().connect(sigc::mem_fun(this, &PowerSession::on_sm_presence_signal));
|
||||
}
|
||||
|
||||
+bool PowerSession::can_suspend()
|
||||
+{
|
||||
+ try
|
||||
+ {
|
||||
+ auto retval = this->sm_proxy_->call_sync("CanSuspend", Glib::VariantContainerBase());
|
||||
+ auto v1 = retval.get_child(0);
|
||||
+ return Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(v1).get();
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call CanSuspend: %s", e.what().c_str());
|
||||
+ }
|
||||
+ catch (const std::exception& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to get the retval of function CanSuspend: %s", e.what());
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+void PowerSession::suspend()
|
||||
+{
|
||||
+ if (!this->can_suspend())
|
||||
+ {
|
||||
+ KLOG_WARNING("The session manager doesn't allow suspend.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ this->sm_proxy_->call_sync("Suspend", Glib::VariantContainerBase());
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call Suspend: %s", e.what().c_str());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+bool PowerSession::can_hibernate()
|
||||
+{
|
||||
+ try
|
||||
+ {
|
||||
+ auto retval = this->sm_proxy_->call_sync("CanHibernate", Glib::VariantContainerBase());
|
||||
+ auto v1 = retval.get_child(0);
|
||||
+ return Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(v1).get();
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call CanHibernate: %s", e.what().c_str());
|
||||
+ }
|
||||
+ catch (const std::exception& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to get the retval of function CanHibernate: %s", e.what());
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+void PowerSession::hibernate()
|
||||
+{
|
||||
+ if (!this->can_hibernate())
|
||||
+ {
|
||||
+ KLOG_WARNING("The session manager doesn't allow hibernate.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ this->sm_proxy_->call_sync("Hibernate", Glib::VariantContainerBase());
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call Hibernate: %s", e.what().c_str());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+bool PowerSession::can_shutdown()
|
||||
+{
|
||||
+ try
|
||||
+ {
|
||||
+ auto retval = this->sm_proxy_->call_sync("CanShutdown", Glib::VariantContainerBase());
|
||||
+ auto v1 = retval.get_child(0);
|
||||
+ return Glib::VariantBase::cast_dynamic<Glib::Variant<bool>>(v1).get();
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call CanShutdown: %s", e.what().c_str());
|
||||
+ }
|
||||
+ catch (const std::exception& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to get the retval of function CanShutdown: %s", e.what());
|
||||
+ }
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+void PowerSession::shutdown()
|
||||
+{
|
||||
+ if (!this->can_shutdown())
|
||||
+ {
|
||||
+ KLOG_WARNING("The session manager doesn't allow shutdown.");
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ try
|
||||
+ {
|
||||
+ this->sm_proxy_->call_sync("Shutdown", Glib::VariantContainerBase());
|
||||
+ }
|
||||
+ catch (const Glib::Error& e)
|
||||
+ {
|
||||
+ KLOG_WARNING("Failed to call shutdown: %s", e.what().c_str());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
uint32_t PowerSession::get_status()
|
||||
{
|
||||
KLOG_PROFILE("");
|
||||
diff --git a/plugins/power/wrapper/power-session.h b/plugins/power/wrapper/power-session.h
|
||||
index a2e26c9..6b0e770 100644
|
||||
--- a/plugins/power/wrapper/power-session.h
|
||||
+++ b/plugins/power/wrapper/power-session.h
|
||||
@@ -39,6 +39,16 @@ public:
|
||||
// 挂起状态是否禁用
|
||||
bool get_suspend_inhibited() { return this->is_suspend_inhibited_; };
|
||||
|
||||
+ // 挂机
|
||||
+ bool can_suspend();
|
||||
+ void suspend();
|
||||
+ // 休眠
|
||||
+ bool can_hibernate();
|
||||
+ void hibernate();
|
||||
+ // 关机
|
||||
+ bool can_shutdown();
|
||||
+ void shutdown();
|
||||
+
|
||||
private:
|
||||
// 获取空闲状态
|
||||
uint32_t get_status();
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@ -1,32 +0,0 @@
|
||||
From f399f85e9dcdd2786dec68f0f8bdd73b1547b891 Mon Sep 17 00:00:00 2001
|
||||
From: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
Date: Thu, 27 Apr 2023 08:57:46 +0800
|
||||
Subject: [PATCH] feature(timedate): Prior to select last ntp service in
|
||||
ntp-utils.d directory.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 改为优先选择最后一个ntp服务器,即按照.d目录中最后一个文件作为最高优先级
|
||||
|
||||
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
---
|
||||
plugins/timedate/timedate-manager.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/timedate/timedate-manager.cpp b/plugins/timedate/timedate-manager.cpp
|
||||
index 92a4147..bd3085e 100644
|
||||
--- a/plugins/timedate/timedate-manager.cpp
|
||||
+++ b/plugins/timedate/timedate-manager.cpp
|
||||
@@ -404,7 +404,7 @@ void TimedateManager::init_ntp_units()
|
||||
this->ntp_unit_name_.clear();
|
||||
for (auto &ntp_unit : ntp_units)
|
||||
{
|
||||
- if (ntp_unit == ntp_units.front())
|
||||
+ if (ntp_unit == ntp_units.back())
|
||||
{
|
||||
this->ntp_unit_name_ = ntp_unit;
|
||||
continue;
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@ -1,183 +0,0 @@
|
||||
From a6b69401438c9949486d961d94357c41977cccfe Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Tue, 15 Aug 2023 20:52:36 +0800
|
||||
Subject: [PATCH] fix(accounts):Fix user icon file display while change and
|
||||
login
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配在更改用户图标后切换登录
|
||||
|
||||
Related #12711
|
||||
---
|
||||
plugins/accounts/user.cpp | 81 +++++++++++++++++++++++++++++++++++----
|
||||
plugins/accounts/user.h | 7 +++-
|
||||
2 files changed, 79 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/plugins/accounts/user.cpp b/plugins/accounts/user.cpp
|
||||
index b0ad852..6c9864b 100644
|
||||
--- a/plugins/accounts/user.cpp
|
||||
+++ b/plugins/accounts/user.cpp
|
||||
@@ -33,7 +33,12 @@ namespace Kiran
|
||||
{
|
||||
#define USERDIR "/var/lib/AccountsService/users"
|
||||
#define ICONDIR "/var/lib/AccountsService/icons"
|
||||
-#define ACCOUNTS_USER_OBJECT_PATH "/com/kylinsec/Kiran/SystemDaemon/Accounts/User"
|
||||
+#define KIRAN_ACCOUNTS_USER_OBJECT_PATH "/com/kylinsec/Kiran/SystemDaemon/Accounts/User"
|
||||
+
|
||||
+#define FREEDESKTOP_ACCOUNTS_DBUS_NAME "org.freedesktop.Accounts"
|
||||
+#define FREEDESKTOP_ACCOUNTS_OBJECT_PATH "/org/freedesktop/Accounts"
|
||||
+#define FREEDESKTOP_ACCOUNTS_DBUS_INTERFACE "org.freedesktop.Accounts"
|
||||
+#define FREEDESKTOP_ACCOUNTS_USER_DBUS_INTERFACE "org.freedesktop.Accounts.User"
|
||||
|
||||
User::User(PasswdShadow passwd_shadow) : passwd_shadow_(passwd_shadow),
|
||||
object_register_id_(0),
|
||||
@@ -62,7 +67,7 @@ std::shared_ptr<User> User::create_user(PasswdShadow passwd_shadow)
|
||||
void User::dbus_register()
|
||||
{
|
||||
KLOG_PROFILE("Uid: %" PRIu64, this->uid_);
|
||||
- this->object_path_ = fmt::format(ACCOUNTS_USER_OBJECT_PATH "/{0}", this->uid_get());
|
||||
+ this->object_path_ = fmt::format(KIRAN_ACCOUNTS_USER_OBJECT_PATH "/{0}", this->uid_get());
|
||||
try
|
||||
{
|
||||
this->dbus_connect_ = Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SYSTEM);
|
||||
@@ -298,6 +303,7 @@ void User::GetAuthItems(gint32 mode, MethodInvocation &invocation)
|
||||
|
||||
void User::init()
|
||||
{
|
||||
+ this->build_freedesktop_user_object_path();
|
||||
this->udpate_nocache_var(this->passwd_shadow_);
|
||||
this->user_cache_ = std::make_shared<UserCache>(this->shared_from_this());
|
||||
// 由于图标路径是维护在缓存中,所以必须等UserCache对象创建后才能操作
|
||||
@@ -631,6 +637,7 @@ void User::change_icon_file_authorized_cb(MethodInvocation invocation, const Gli
|
||||
} while (0);
|
||||
|
||||
this->icon_file_set(filename);
|
||||
+ this->sync_icon_file_to_freedesktop(filename);
|
||||
invocation.ret();
|
||||
}
|
||||
|
||||
@@ -974,12 +981,6 @@ USER_PROP_SET_HANDLER(automatic_login, bool);
|
||||
USER_PROP_SET_HANDLER(system_account, bool);
|
||||
USER_PROP_SET_HANDLER(password_expiration_policy, const Glib::ustring &);
|
||||
|
||||
-bool User::icon_file_changed(const Glib::ustring &value)
|
||||
-{
|
||||
- this->icon_file_set(value);
|
||||
- return false;
|
||||
-}
|
||||
-
|
||||
AccountsAccountType User::account_type_from_pwent(std::shared_ptr<Passwd> passwd)
|
||||
{
|
||||
g_return_val_if_fail(passwd, AccountsAccountType::ACCOUNTS_ACCOUNT_TYPE_STANDARD);
|
||||
@@ -1023,6 +1024,7 @@ void User::reset_icon_file()
|
||||
if (icon_file != this->default_icon_file_)
|
||||
{
|
||||
this->icon_file_set(this->default_icon_file_);
|
||||
+ this->sync_icon_file_to_freedesktop(this->default_icon_file_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1034,4 +1036,67 @@ void User::move_extra_data(const std::string &old_name, const std::string &new_n
|
||||
g_rename(old_filename.c_str(), new_filename.c_str());
|
||||
}
|
||||
|
||||
+void User::build_freedesktop_user_object_path()
|
||||
+{
|
||||
+ this->freedesktop_object_path_ = Glib::DBusObjectPathString();
|
||||
+
|
||||
+ Glib::RefPtr<Gio::DBus::Proxy> account_proxy;
|
||||
+ try
|
||||
+ {
|
||||
+ account_proxy = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
|
||||
+ FREEDESKTOP_ACCOUNTS_DBUS_NAME,
|
||||
+ FREEDESKTOP_ACCOUNTS_OBJECT_PATH,
|
||||
+ FREEDESKTOP_ACCOUNTS_DBUS_INTERFACE);
|
||||
+ }
|
||||
+ catch (const Glib::Error &e)
|
||||
+ {
|
||||
+ KLOG_WARNING("%s", e.what().c_str());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ auto parameters = g_variant_new("(x)", this->uid_get());
|
||||
+ Glib::VariantContainerBase base(parameters, false);
|
||||
+ try
|
||||
+ {
|
||||
+ auto retval = account_proxy->call_sync("FindUserById", base);
|
||||
+ auto v1 = retval.get_child(0);
|
||||
+ this->freedesktop_object_path_ = Glib::VariantBase::cast_dynamic<Glib::Variant<Glib::DBusObjectPathString>>(v1).get().raw();
|
||||
+ }
|
||||
+ catch (const Glib::Error &e)
|
||||
+ {
|
||||
+ KLOG_WARNING("%s", e.what().c_str());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void User::sync_icon_file_to_freedesktop(const Glib::ustring &icon_file)
|
||||
+{
|
||||
+ RETURN_IF_TRUE(this->freedesktop_object_path_.empty());
|
||||
+
|
||||
+ Glib::RefPtr<Gio::DBus::Proxy> account_proxy;
|
||||
+ try
|
||||
+ {
|
||||
+ account_proxy = Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SYSTEM,
|
||||
+ FREEDESKTOP_ACCOUNTS_DBUS_NAME,
|
||||
+ this->freedesktop_object_path_,
|
||||
+ FREEDESKTOP_ACCOUNTS_USER_DBUS_INTERFACE);
|
||||
+ }
|
||||
+ catch (const Glib::Error &e)
|
||||
+ {
|
||||
+ KLOG_WARNING("%s", e.what().c_str());
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ auto parameters = g_variant_new("(s)", icon_file.c_str());
|
||||
+ Glib::VariantContainerBase base(parameters, false);
|
||||
+ Glib::VariantContainerBase retval;
|
||||
+ try
|
||||
+ {
|
||||
+ retval = account_proxy->call_sync("SetIconFile", base);
|
||||
+ }
|
||||
+ catch (const Glib::Error &e)
|
||||
+ {
|
||||
+ KLOG_WARNING("%s", e.what().c_str());
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
diff --git a/plugins/accounts/user.h b/plugins/accounts/user.h
|
||||
index f467cd5..5915504 100644
|
||||
--- a/plugins/accounts/user.h
|
||||
+++ b/plugins/accounts/user.h
|
||||
@@ -208,12 +208,16 @@ private:
|
||||
// 模式转为对应的keyfile的group_name
|
||||
std::string mode_to_groupname(int32_t mode);
|
||||
|
||||
- bool icon_file_changed(const Glib::ustring &value);
|
||||
AccountsAccountType account_type_from_pwent(std::shared_ptr<Passwd> passwd);
|
||||
void reset_icon_file();
|
||||
|
||||
void move_extra_data(const std::string &old_name, const std::string &new_name);
|
||||
|
||||
+ void build_freedesktop_user_object_path();
|
||||
+
|
||||
+ // 由于切换用户时,登陆器通过org.freedesktop.Accounts接口获取图标,Kiran设置/更新用户图标后需要同步到freedesktop
|
||||
+ void sync_icon_file_to_freedesktop(const Glib::ustring &icon_file);
|
||||
+
|
||||
private:
|
||||
private:
|
||||
Glib::RefPtr<Gio::DBus::Connection> dbus_connect_;
|
||||
@@ -224,6 +228,7 @@ private:
|
||||
uint32_t object_register_id_;
|
||||
|
||||
Glib::DBusObjectPathString object_path_;
|
||||
+ Glib::DBusObjectPathString freedesktop_object_path_;
|
||||
|
||||
std::string default_icon_file_;
|
||||
std::shared_ptr<Passwd> passwd_;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
From 0d955a96549b3a83d3876aa7e62817807c3160e2 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 14 Apr 2023 09:51:40 +0800
|
||||
Subject: [PATCH] fix(audio):Fix coredump problem caused by nullpointer to
|
||||
string
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复由于赋值string为nullptr导致的崩溃
|
||||
|
||||
Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
---
|
||||
plugins/audio/pulse/pulse-node.cpp | 11 +++++++++++
|
||||
plugins/audio/pulse/pulse-node.h | 2 +-
|
||||
2 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/audio/pulse/pulse-node.cpp b/plugins/audio/pulse/pulse-node.cpp
|
||||
index 912a811..eac7dfe 100644
|
||||
--- a/plugins/audio/pulse/pulse-node.cpp
|
||||
+++ b/plugins/audio/pulse/pulse-node.cpp
|
||||
@@ -130,6 +130,17 @@ uint32_t PulseNode::get_base_volume()
|
||||
return uint32_t(PA_VOLUME_NORM);
|
||||
}
|
||||
|
||||
+std::string PulseNode::get_property(const std::string &key)
|
||||
+{
|
||||
+ auto iter = this->attrs_.find(key);
|
||||
+ if (iter != this->attrs_.end())
|
||||
+ {
|
||||
+ return iter->second;
|
||||
+ }
|
||||
+
|
||||
+ return std::string("");
|
||||
+}
|
||||
+
|
||||
void PulseNode::update(const pa_channel_map &channel_map,
|
||||
const pa_cvolume &cvolume,
|
||||
int32_t mute,
|
||||
diff --git a/plugins/audio/pulse/pulse-node.h b/plugins/audio/pulse/pulse-node.h
|
||||
index 664005c..06a76a7 100644
|
||||
--- a/plugins/audio/pulse/pulse-node.h
|
||||
+++ b/plugins/audio/pulse/pulse-node.h
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
uint32_t get_base_volume();
|
||||
|
||||
// 获取属性
|
||||
- std::string get_property(const std::string &key) { return MapHelper::get_value(this->attrs_, key); };
|
||||
+ std::string get_property(const std::string &key);
|
||||
|
||||
sigc::signal<void, PulseNodeField> &signal_node_info_changed() { return this->node_info_changed_; };
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
From e0b19f2df0b8c8c07dccb745271e3b4c1cf721f1 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 14 Apr 2023 14:11:00 +0800
|
||||
Subject: [PATCH] fix(audio):Fix the type of return value in template
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配模板数据类型返回值
|
||||
|
||||
Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
---
|
||||
lib/base/stl-helper.h | 2 +-
|
||||
plugins/audio/pulse/pulse-node.cpp | 11 -----------
|
||||
plugins/audio/pulse/pulse-node.h | 2 +-
|
||||
3 files changed, 2 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/lib/base/stl-helper.h b/lib/base/stl-helper.h
|
||||
index 3f9017c..cf73b8d 100644
|
||||
--- a/lib/base/stl-helper.h
|
||||
+++ b/lib/base/stl-helper.h
|
||||
@@ -42,7 +42,7 @@ public:
|
||||
{
|
||||
return iter->second;
|
||||
}
|
||||
- return nullptr;
|
||||
+ return V();
|
||||
}
|
||||
};
|
||||
|
||||
diff --git a/plugins/audio/pulse/pulse-node.cpp b/plugins/audio/pulse/pulse-node.cpp
|
||||
index eac7dfe..912a811 100644
|
||||
--- a/plugins/audio/pulse/pulse-node.cpp
|
||||
+++ b/plugins/audio/pulse/pulse-node.cpp
|
||||
@@ -130,17 +130,6 @@ uint32_t PulseNode::get_base_volume()
|
||||
return uint32_t(PA_VOLUME_NORM);
|
||||
}
|
||||
|
||||
-std::string PulseNode::get_property(const std::string &key)
|
||||
-{
|
||||
- auto iter = this->attrs_.find(key);
|
||||
- if (iter != this->attrs_.end())
|
||||
- {
|
||||
- return iter->second;
|
||||
- }
|
||||
-
|
||||
- return std::string("");
|
||||
-}
|
||||
-
|
||||
void PulseNode::update(const pa_channel_map &channel_map,
|
||||
const pa_cvolume &cvolume,
|
||||
int32_t mute,
|
||||
diff --git a/plugins/audio/pulse/pulse-node.h b/plugins/audio/pulse/pulse-node.h
|
||||
index 06a76a7..664005c 100644
|
||||
--- a/plugins/audio/pulse/pulse-node.h
|
||||
+++ b/plugins/audio/pulse/pulse-node.h
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
uint32_t get_base_volume();
|
||||
|
||||
// 获取属性
|
||||
- std::string get_property(const std::string &key);
|
||||
+ std::string get_property(const std::string &key) { return MapHelper::get_value(this->attrs_, key); };
|
||||
|
||||
sigc::signal<void, PulseNodeField> &signal_node_info_changed() { return this->node_info_changed_; };
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,59 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,161 +0,0 @@
|
||||
From eb3e27fd1977a58f04da4907ed563aad09875df3 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Thu, 24 Aug 2023 16:34:58 +0800
|
||||
Subject: [PATCH] fix(display):Fix multi screen auto display while switch style
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配切换模式自适应多屏显示
|
||||
|
||||
Related #13176
|
||||
---
|
||||
.../com.kylinsec.kiran.display.gschema.xml.in | 5 ++++
|
||||
include/display-i.h | 2 --
|
||||
plugins/display/display-manager.cpp | 28 +++++++++++++++++--
|
||||
plugins/display/display-manager.h | 2 ++
|
||||
plugins/display/display.xsd | 1 +
|
||||
5 files changed, 34 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.display.gschema.xml.in b/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
|
||||
index 7c4930f..9df78d7 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.display.gschema.xml.in
|
||||
@@ -24,5 +24,10 @@
|
||||
<description>Set whether to adapt to screen changes </description>
|
||||
</key>
|
||||
|
||||
+ <key name="max-screen-record-number" type="i">
|
||||
+ <default>100</default>
|
||||
+ <description>Set max screen record number while save config.</description>
|
||||
+ </key>
|
||||
+
|
||||
</schema>
|
||||
</schemalist>
|
||||
diff --git a/include/display-i.h b/include/display-i.h
|
||||
index 4b0701e..e3bcb97 100644
|
||||
--- a/include/display-i.h
|
||||
+++ b/include/display-i.h
|
||||
@@ -35,8 +35,6 @@ extern "C"
|
||||
#define DISPLAY_OBJECT_PATH "/com/kylinsec/Kiran/SessionDaemon/Display"
|
||||
#define DISPLAY_DBUS_INTERFACE_NAME "com.kylinsec.Kiran.SessionDaemon.Display"
|
||||
|
||||
-#define DISPLAY_SCHEMA_DYNAMIC_SCALING_WINDOW "dynamic-scaling-window"
|
||||
-
|
||||
// 显示模式,只有在下列情况会使用显示模式进行设置:
|
||||
// 1. 程序第一次启动
|
||||
// 2. 有连接设备删除和添加时
|
||||
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
|
||||
index 7450187..10a4b61 100644
|
||||
--- a/plugins/display/display-manager.cpp
|
||||
+++ b/plugins/display/display-manager.cpp
|
||||
@@ -26,6 +26,8 @@ namespace Kiran
|
||||
{
|
||||
#define DISPLAY_SCHEMA_ID "com.kylinsec.kiran.display"
|
||||
#define DISPLAY_SCHEMA_STYLE "display-style"
|
||||
+#define DISPLAY_SCHEMA_DYNAMIC_SCALING_WINDOW "dynamic-scaling-window"
|
||||
+#define DISPLAY_SCHEMA_MAX_SCREEN_RECORD_NUMBER "max-screen-record-number"
|
||||
#define SCREEN_CHANGED_ADAPT "screen-changed-adaptation"
|
||||
|
||||
#define DISPLAY_CONF_DIR "kylinsec/" PROJECT_NAME "/display"
|
||||
@@ -34,10 +36,13 @@ namespace Kiran
|
||||
#define MONITOR_JOIN_CHAR ","
|
||||
#define XRANDR_CMD "xrandr"
|
||||
|
||||
+#define DEFAULT_MAX_SCREEN_RECORD_NUMBER 100
|
||||
+
|
||||
DisplayManager::DisplayManager(XrandrManager *xrandr_manager) : xrandr_manager_(xrandr_manager),
|
||||
default_style_(DisplayStyle::DISPLAY_STYLE_EXTEND),
|
||||
window_scaling_factor_(0),
|
||||
dynamic_scaling_window_(false),
|
||||
+ max_screen_record_number_(DEFAULT_MAX_SCREEN_RECORD_NUMBER),
|
||||
dbus_connect_id_(0),
|
||||
object_register_id_(0)
|
||||
{
|
||||
@@ -276,6 +281,7 @@ void DisplayManager::load_settings()
|
||||
this->default_style_ = DisplayStyle(this->display_settings_->get_enum(DISPLAY_SCHEMA_STYLE));
|
||||
this->dynamic_scaling_window_ = this->display_settings_->get_boolean(DISPLAY_SCHEMA_DYNAMIC_SCALING_WINDOW);
|
||||
this->window_scaling_factor_ = this->xsettings_settings_->get_int(XSETTINGS_SCHEMA_WINDOW_SCALING_FACTOR);
|
||||
+ this->max_screen_record_number_ = this->display_settings_->get_int(DISPLAY_SCHEMA_MAX_SCREEN_RECORD_NUMBER);
|
||||
}
|
||||
|
||||
void DisplayManager::load_monitors()
|
||||
@@ -465,6 +471,7 @@ bool DisplayManager::apply_screen_config(const ScreenConfigInfo &screen_config,
|
||||
|
||||
void DisplayManager::fill_screen_config(ScreenConfigInfo &screen_config)
|
||||
{
|
||||
+ screen_config.timestamp((uint32_t)time(NULL));
|
||||
screen_config.primary(this->primary_);
|
||||
screen_config.window_scaling_factor(this->window_scaling_factor_);
|
||||
|
||||
@@ -523,7 +530,7 @@ bool DisplayManager::save_config(CCErrorCode &error_code)
|
||||
auto monitors_uid = this->get_monitors_uid();
|
||||
auto &c_screens = this->display_config_->screen();
|
||||
bool matched = false;
|
||||
- ScreenConfigInfo used_config("", 0);
|
||||
+ ScreenConfigInfo used_config(0, "", 0);
|
||||
|
||||
this->fill_screen_config(used_config);
|
||||
for (auto &c_screen : c_screens)
|
||||
@@ -543,6 +550,23 @@ bool DisplayManager::save_config(CCErrorCode &error_code)
|
||||
this->display_config_->screen().push_back(used_config);
|
||||
}
|
||||
|
||||
+ if (c_screens.size() > this->max_screen_record_number_)
|
||||
+ {
|
||||
+ auto oldest_screen = c_screens.begin();
|
||||
+ for (auto iter = c_screens.begin(); iter != c_screens.end(); iter++)
|
||||
+ {
|
||||
+ if ((*iter).timestamp() < (*oldest_screen).timestamp())
|
||||
+ {
|
||||
+ oldest_screen = iter;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (oldest_screen != c_screens.end())
|
||||
+ {
|
||||
+ c_screens.erase(oldest_screen);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
RETURN_VAL_IF_FALSE(this->save_to_file(error_code), false);
|
||||
|
||||
return true;
|
||||
@@ -770,8 +794,8 @@ void DisplayManager::switch_to_auto()
|
||||
KLOG_PROFILE("");
|
||||
|
||||
CCErrorCode error_code;
|
||||
+
|
||||
RETURN_IF_TRUE(this->switch_to_custom(error_code));
|
||||
- RETURN_IF_TRUE(this->switch_to_mirrors(error_code));
|
||||
this->switch_to_extend();
|
||||
}
|
||||
|
||||
diff --git a/plugins/display/display-manager.h b/plugins/display/display-manager.h
|
||||
index 3d866ff..5fbf741 100644
|
||||
--- a/plugins/display/display-manager.h
|
||||
+++ b/plugins/display/display-manager.h
|
||||
@@ -145,6 +145,8 @@ private:
|
||||
int32_t window_scaling_factor_;
|
||||
// 开启动态缩放窗口
|
||||
bool dynamic_scaling_window_;
|
||||
+ // 可存储屏幕个数最大值
|
||||
+ uint32_t max_screen_record_number_;
|
||||
|
||||
std::map<uint32_t, std::shared_ptr<DisplayMonitor>> monitors_;
|
||||
|
||||
diff --git a/plugins/display/display.xsd b/plugins/display/display.xsd
|
||||
index c39f85e..521ec7f 100644
|
||||
--- a/plugins/display/display.xsd
|
||||
+++ b/plugins/display/display.xsd
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
<xsd:complexType name="ScreenConfigInfo">
|
||||
<xsd:sequence>
|
||||
+ <xsd:element name="timestamp" type="xsd:unsignedInt" default="0"/>
|
||||
<xsd:element name="primary" type="xsd:string" default="" />
|
||||
<xsd:element name="window_scaling_factor" type="xsd:int" default="0" />
|
||||
<xsd:element name="monitor" type="MonitorConfigInfo" maxOccurs="unbounded" />
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
From 160d68558c462ae4a49b89428e2790132b693c01 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Mon, 31 Jul 2023 15:12:59 +0800
|
||||
Subject: [PATCH] fix(display):Fix nvidia display while no enabled monitor
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
-适配nvidia驱动在未接入显示连接器条件下的显示
|
||||
|
||||
Related #9609
|
||||
---
|
||||
plugins/display/display-manager.cpp | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
|
||||
index f80e248..7450187 100644
|
||||
--- a/plugins/display/display-manager.cpp
|
||||
+++ b/plugins/display/display-manager.cpp
|
||||
@@ -550,6 +550,14 @@ bool DisplayManager::save_config(CCErrorCode &error_code)
|
||||
|
||||
bool DisplayManager::apply(CCErrorCode &error_code)
|
||||
{
|
||||
+ // 如果使用的是nvidia驱动,当没有接入任何显示器时,会将output的分辨率设置为8x8,导致底部面板不可见且后面无法恢复。
|
||||
+ if (this->get_enabled_monitors().size() == 0)
|
||||
+ {
|
||||
+ KLOG_WARNING("Cannot find enabled monitor.");
|
||||
+ error_code = CCErrorCode::ERROR_DISPLAY_NO_ENABLED_MONITOR;
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
if (this->dynamic_scaling_window_)
|
||||
{
|
||||
// 应用缩放因子
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,60 +0,0 @@
|
||||
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
|
||||
|
||||
@ -1,83 +0,0 @@
|
||||
From 8a7cee50c347b79d0f68c0426ce5a07f25b462de Mon Sep 17 00:00:00 2001
|
||||
From: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
Date: Mon, 8 May 2023 18:04:07 +0800
|
||||
Subject: [PATCH] fix(edid): Fix the problem that cannot match correct monitor
|
||||
when has same edid.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复edid相同时无法正确匹配到对应的显示器问题
|
||||
|
||||
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
---
|
||||
plugins/display/display-manager.cpp | 28 +++++++++++++++++++++++++---
|
||||
plugins/display/display-manager.h | 3 +++
|
||||
2 files changed, 28 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/display/display-manager.cpp b/plugins/display/display-manager.cpp
|
||||
index 0860253..f80e248 100644
|
||||
--- a/plugins/display/display-manager.cpp
|
||||
+++ b/plugins/display/display-manager.cpp
|
||||
@@ -410,12 +410,13 @@ bool DisplayManager::apply_screen_config(const ScreenConfigInfo &screen_config,
|
||||
|
||||
for (const auto &c_monitor : c_monitors)
|
||||
{
|
||||
- std::string uid = c_monitor.uid();
|
||||
- auto monitor = this->get_monitor_by_uid(uid);
|
||||
+ auto monitor = this->match_best_monitor(c_monitor.uid(), c_monitor.name());
|
||||
|
||||
if (!monitor)
|
||||
{
|
||||
- KLOG_WARNING("Cannot find monitor for %s.", uid.c_str());
|
||||
+ KLOG_WARNING("cannot find monitor for uid=%s, name=%s.",
|
||||
+ c_monitor.uid().c_str(),
|
||||
+ c_monitor.name().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -800,6 +801,27 @@ std::shared_ptr<DisplayMonitor> DisplayManager::get_monitor_by_name(const std::s
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
+std::shared_ptr<DisplayMonitor> DisplayManager::match_best_monitor(const std::string &uid,
|
||||
+ const std::string &name)
|
||||
+{
|
||||
+ std::shared_ptr<DisplayMonitor> retval;
|
||||
+ for (const auto &iter : this->monitors_)
|
||||
+ {
|
||||
+ if (!retval && iter.second->get_uid() == uid)
|
||||
+ {
|
||||
+ retval = iter.second;
|
||||
+ }
|
||||
+
|
||||
+ // 完美匹配则直接退出
|
||||
+ if (iter.second->get_uid() == uid && iter.second->name_get() == name)
|
||||
+ {
|
||||
+ retval = iter.second;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
std::string DisplayManager::get_monitors_uid()
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
diff --git a/plugins/display/display-manager.h b/plugins/display/display-manager.h
|
||||
index c2fdce6..3d866ff 100644
|
||||
--- a/plugins/display/display-manager.h
|
||||
+++ b/plugins/display/display-manager.h
|
||||
@@ -107,6 +107,9 @@ private:
|
||||
std::shared_ptr<DisplayMonitor> get_monitor(uint32_t id);
|
||||
std::shared_ptr<DisplayMonitor> get_monitor_by_uid(const std::string& uid);
|
||||
std::shared_ptr<DisplayMonitor> get_monitor_by_name(const std::string& name);
|
||||
+ // 优先匹配uid,如果有多个uid匹配,则再匹配name
|
||||
+ std::shared_ptr<DisplayMonitor> match_best_monitor(const std::string& uid,
|
||||
+ const std::string& name);
|
||||
|
||||
// 将uid进行排序后拼接
|
||||
std::string get_monitors_uid();
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@ -1,170 +0,0 @@
|
||||
From 7c877f7b549fd1466ecf9684f74b70fae1c54709 Mon Sep 17 00:00:00 2001
|
||||
From: wangtaozhi <wangtaozhi@kylinsec.com.cn>
|
||||
Date: Thu, 11 May 2023 12:00:55 +0800
|
||||
Subject: [PATCH] fix-identification-issues-in-control-centers
|
||||
|
||||
---
|
||||
lib/base/str-utils.cpp | 39 +++++++++++++++++-----
|
||||
lib/base/str-utils.h | 17 +++++-----
|
||||
plugins/systeminfo/systeminfo-hardware.cpp | 25 +++++++-------
|
||||
3 files changed, 53 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/lib/base/str-utils.cpp b/lib/base/str-utils.cpp
|
||||
index 8a38b1e..52e028b 100644
|
||||
--- a/lib/base/str-utils.cpp
|
||||
+++ b/lib/base/str-utils.cpp
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
- * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
+ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
* kiran-cc-daemon is licensed under Mulan PSL v2.
|
||||
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
- * http://license.coscl.org.cn/MulanPSL2
|
||||
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
- * See the Mulan PSL v2 for more details.
|
||||
- *
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ *
|
||||
* Author: tangjie02 <tangjie02@kylinos.com.cn>
|
||||
*/
|
||||
|
||||
@@ -95,6 +95,29 @@ std::vector<std::string> StrUtils::split_with_char(const std::string &s, char de
|
||||
return v;
|
||||
}
|
||||
|
||||
+std::vector<std::string> StrUtils::split_once_with_char(const std::string &s, char delimiter)
|
||||
+{
|
||||
+ std::vector<std::string> v;
|
||||
+ size_t i;
|
||||
+ for (i = 0; i < s.length(); i++)
|
||||
+ {
|
||||
+ if (delimiter == s[i])
|
||||
+ {
|
||||
+ v.push_back(s.substr(0, i));
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ if (s.length() == i)
|
||||
+ {
|
||||
+ v.push_back(s);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ v.push_back(s.substr(i + 1, s.length() - i - 1));
|
||||
+ }
|
||||
+ return v;
|
||||
+}
|
||||
+
|
||||
std::string StrUtils::ltrim(const std::string &s)
|
||||
{
|
||||
auto iter = std::find_if(s.begin(), s.end(), [](char c) -> bool
|
||||
diff --git a/lib/base/str-utils.h b/lib/base/str-utils.h
|
||||
index e7221de..5c8be58 100644
|
||||
--- a/lib/base/str-utils.h
|
||||
+++ b/lib/base/str-utils.h
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
- * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
+ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
* kiran-cc-daemon is licensed under Mulan PSL v2.
|
||||
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
- * http://license.coscl.org.cn/MulanPSL2
|
||||
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
- * See the Mulan PSL v2 for more details.
|
||||
- *
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ *
|
||||
* Author: tangjie02 <tangjie02@kylinos.com.cn>
|
||||
*/
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
static std::string tolower(const std::string &str);
|
||||
static std::string toupper(const std::string &str);
|
||||
static std::vector<std::string> split_with_char(const std::string &s, char delimiter, bool is_merge_delimiter = false);
|
||||
+ static std::vector<std::string> split_once_with_char(const std::string &s, char delimiter);
|
||||
|
||||
// 去掉字符串前后的空白字符
|
||||
static std::string ltrim(const std::string &s);
|
||||
diff --git a/plugins/systeminfo/systeminfo-hardware.cpp b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
index 66b7b49..e9975c1 100644
|
||||
--- a/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
+++ b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
- * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
+ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
* kiran-cc-daemon is licensed under Mulan PSL v2.
|
||||
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
- * http://license.coscl.org.cn/MulanPSL2
|
||||
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
- * See the Mulan PSL v2 for more details.
|
||||
- *
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ *
|
||||
* Author: tangjie02 <tangjie02@kylinos.com.cn>
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace Kiran
|
||||
|
||||
#define DISKINFO_CMD "/usr/bin/lsblk"
|
||||
|
||||
-#define PCIINFO_CMD "/usr/sbin/lspci"
|
||||
+// 使用相对路径,避免使用绝对路径时因系统版本导致的错误
|
||||
+#define PCIINFO_CMD "lspci"
|
||||
#define PCIINFO_KEY_DELIMITER ':'
|
||||
|
||||
SystemInfoHardware::SystemInfoHardware() : mem_size_lshw(0)
|
||||
@@ -310,7 +311,7 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas
|
||||
{
|
||||
Glib::spawn_sync("",
|
||||
argv,
|
||||
- Glib::SPAWN_DEFAULT,
|
||||
+ Glib::SPAWN_SEARCH_PATH,
|
||||
sigc::mem_fun(this, &SystemInfoHardware::set_env),
|
||||
&cmd_output);
|
||||
}
|
||||
@@ -354,7 +355,7 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas
|
||||
{
|
||||
Glib::spawn_sync("",
|
||||
argv,
|
||||
- Glib::SPAWN_DEFAULT,
|
||||
+ Glib::SPAWN_SEARCH_PATH,
|
||||
sigc::mem_fun(this, &SystemInfoHardware::set_env),
|
||||
&cmd_output);
|
||||
}
|
||||
@@ -378,7 +379,7 @@ KVList SystemInfoHardware::format_to_kv_list(const std::string& contents)
|
||||
auto lines = StrUtils::split_lines(block);
|
||||
for (auto& line : lines)
|
||||
{
|
||||
- auto fields = StrUtils::split_with_char(line, PCIINFO_KEY_DELIMITER);
|
||||
+ auto fields = StrUtils::split_once_with_char(line, PCIINFO_KEY_DELIMITER);
|
||||
if (fields.size() != 2)
|
||||
{
|
||||
continue;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
From aaaa7ec4ffcafbce965c0b234ba281bd8c003e1a Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Sat, 27 May 2023 19:51:46 +0800
|
||||
Subject: [PATCH] fix(keybinding):Add support desktop key for GC
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
-添加GC支持的桌面扩展快捷键
|
||||
|
||||
Related #67098
|
||||
---
|
||||
cmake/ksd_variables.cmake | 4 ++++
|
||||
data/CMakeLists.txt | 6 ++++++
|
||||
data/keybindings/01-desktop-extend-key.xml | 8 ++++++++
|
||||
3 files changed, 18 insertions(+)
|
||||
create mode 100644 data/keybindings/01-desktop-extend-key.xml
|
||||
|
||||
diff --git a/cmake/ksd_variables.cmake b/cmake/ksd_variables.cmake
|
||||
index 3ea177b..46e3b7c 100644
|
||||
--- a/cmake/ksd_variables.cmake
|
||||
+++ b/cmake/ksd_variables.cmake
|
||||
@@ -59,6 +59,10 @@ set(enable-plugin-clipboard
|
||||
"false"
|
||||
CACHE STRING "Enable plugin clipboard")
|
||||
|
||||
+set(filter-desktop-extend-key
|
||||
+ "true"
|
||||
+ CACHE STRING "Filter desktop extend key")
|
||||
+
|
||||
# Determine the platform.
|
||||
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
set(OS_MACOSX 1)
|
||||
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
|
||||
index cf469fb..006d1b0 100644
|
||||
--- a/data/CMakeLists.txt
|
||||
+++ b/data/CMakeLists.txt
|
||||
@@ -127,6 +127,12 @@ if(build-session-daemon)
|
||||
|
||||
# keybindings
|
||||
file(GLOB KEYBINDINGS_XML_FILES ${PROJECT_SOURCE_DIR}/data/keybindings/*.xml)
|
||||
+
|
||||
+ if(filter-desktop-extend-key)
|
||||
+ list(REMOVE_ITEM KEYBINDINGS_XML_FILES
|
||||
+ ${PROJECT_SOURCE_DIR}/data/keybindings/01-desktop-extend-key.xml)
|
||||
+ endif()
|
||||
+
|
||||
install(
|
||||
FILES ${KEYBINDINGS_XML_FILES}
|
||||
DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/keybindings/)
|
||||
diff --git a/data/keybindings/01-desktop-extend-key.xml b/data/keybindings/01-desktop-extend-key.xml
|
||||
new file mode 100644
|
||||
index 0000000..e9b8d13
|
||||
--- /dev/null
|
||||
+++ b/data/keybindings/01-desktop-extend-key.xml
|
||||
@@ -0,0 +1,8 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<KeyListEntries schema="org.mate.SettingsDaemon.plugins.media-keys" package="mate-settings-daemon" name="Desktop">
|
||||
+
|
||||
+ <KeyListEntry name="panel-kiran-menu" description="Show the panel's main menu of kiran"/>
|
||||
+
|
||||
+ <KeyListEntry name="show-desktop" description="Show the desktop"/>
|
||||
+
|
||||
+</KeyListEntries>
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From 355ab0e8de25da09a2426e80d0ebed4481a4f65a Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 18 Aug 2023 16:13:38 +0800
|
||||
Subject: [PATCH] fix(keybindings):Remove power and logout invalid key from
|
||||
normal desktop
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 移除通用桌面环境中的关机和注销快捷键
|
||||
|
||||
Related #11242
|
||||
---
|
||||
data/keybindings/01-desktop-extend-key.xml | 4 ++++
|
||||
data/keybindings/01-desktop-key.xml | 4 ----
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/data/keybindings/01-desktop-extend-key.xml b/data/keybindings/01-desktop-extend-key.xml
|
||||
index e9b8d13..b11ab83 100644
|
||||
--- a/data/keybindings/01-desktop-extend-key.xml
|
||||
+++ b/data/keybindings/01-desktop-extend-key.xml
|
||||
@@ -5,4 +5,8 @@
|
||||
|
||||
<KeyListEntry name="show-desktop" description="Show the desktop"/>
|
||||
|
||||
+ <KeyListEntry name="logout" description="Log out"/>
|
||||
+
|
||||
+ <KeyListEntry name="power" description="Shut down"/>
|
||||
+
|
||||
</KeyListEntries>
|
||||
diff --git a/data/keybindings/01-desktop-key.xml b/data/keybindings/01-desktop-key.xml
|
||||
index a46de6a..f1078c7 100644
|
||||
--- a/data/keybindings/01-desktop-key.xml
|
||||
+++ b/data/keybindings/01-desktop-key.xml
|
||||
@@ -9,10 +9,6 @@
|
||||
|
||||
<KeyListEntry name="www" description="Launch web browser"/>
|
||||
|
||||
- <KeyListEntry name="logout" description="Log out"/>
|
||||
-
|
||||
- <KeyListEntry name="power" description="Shut down"/>
|
||||
-
|
||||
<KeyListEntry name="screensaver" description="Lock screen"/>
|
||||
|
||||
<KeyListEntry name="home" description="Home folder"/>
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,452 +0,0 @@
|
||||
From 07878e25293175ca5b8c5572d38e7c3c7e918e92 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Sat, 8 Jul 2023 17:23:47 +0800
|
||||
Subject: [PATCH] fix(keyboard):Add capslock and numlock tips switch
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 添加大小写和数字键提示开关
|
||||
|
||||
Related #9379
|
||||
---
|
||||
...com.kylinsec.kiran.keyboard.gschema.xml.in | 10 +++
|
||||
include/error-i.h | 2 +
|
||||
lib/base/error.cpp | 6 ++
|
||||
....kylinsec.Kiran.SessionDaemon.Keyboard.xml | 29 +++++++++
|
||||
.../keyboard/keyboard-manager.cpp | 63 +++++++++++++++++--
|
||||
.../inputdevices/keyboard/keyboard-manager.h | 22 +++++--
|
||||
.../inputdevices/keyboard/keyboard-plugin.cpp | 4 ++
|
||||
.../keyboard/modifier-lock-manager.cpp | 18 +++++-
|
||||
.../keyboard/modifier-lock-manager.h | 14 ++++-
|
||||
po/zh_CN.po | 8 +++
|
||||
10 files changed, 163 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in b/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
index 05e948a..b29449d 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
@@ -6,6 +6,16 @@
|
||||
<description>Whether enable capslock and numlock windows tips.</description>
|
||||
</key>
|
||||
|
||||
+ <key name="capslock-tips-enabled" type="b">
|
||||
+ <default>false</default>
|
||||
+ <description>Whether enable capslock tips.</description>
|
||||
+ </key>
|
||||
+
|
||||
+ <key name="numlock-tips-enabled" type="b">
|
||||
+ <default>false</default>
|
||||
+ <description>Whether enable numlock tips.</description>
|
||||
+ </key>
|
||||
+
|
||||
<key name="repeat-enabled" type="b">
|
||||
<default>true</default>
|
||||
<description>Whether repeat to trigger KeyPress and KeyRelease event when key is pressed.</description>
|
||||
diff --git a/include/error-i.h b/include/error-i.h
|
||||
index e34a504..9a81d3c 100644
|
||||
--- a/include/error-i.h
|
||||
+++ b/include/error-i.h
|
||||
@@ -186,6 +186,8 @@ extern "C"
|
||||
ERROR_KEYBOARD_LAYOUT_OPTION_NOT_EXIST,
|
||||
ERROR_KEYBOARD_LAYOUT_OPTION_UPDATE_FAILED,
|
||||
ERROR_KEYBOARD_LAYOUT_OPTION_CLEAR_FAILED,
|
||||
+ ERROR_KEYBOARD_SWITCH_CAPSLOCK_TIPS_FAILED,
|
||||
+ ERROR_KEYBOARD_SWITCH_NUMLOCK_TIPS_FAILED,
|
||||
|
||||
// Mouse
|
||||
ERROR_MOUSE_START = 0x230000,
|
||||
diff --git a/lib/base/error.cpp b/lib/base/error.cpp
|
||||
index deecb06..b9d12d5 100644
|
||||
--- a/lib/base/error.cpp
|
||||
+++ b/lib/base/error.cpp
|
||||
@@ -306,6 +306,12 @@ std::string CCError::get_error_desc(CCErrorCode error_code, bool attach_error_co
|
||||
case CCErrorCode::ERROR_KEYBOARD_LAYOUT_OPTION_CLEAR_FAILED:
|
||||
error_desc = _("Failed to clear the layout option.");
|
||||
break;
|
||||
+ case CCErrorCode::ERROR_KEYBOARD_SWITCH_CAPSLOCK_TIPS_FAILED:
|
||||
+ error_desc = _("Failed to switch the capslock tips.");
|
||||
+ break;
|
||||
+ case CCErrorCode::ERROR_KEYBOARD_SWITCH_NUMLOCK_TIPS_FAILED:
|
||||
+ error_desc = _("Failed to switch the numlock tips.");
|
||||
+ break;
|
||||
case CCErrorCode::ERROR_KEYBINDING_CUSTOM_SHORTCUT_NOT_EXIST:
|
||||
error_desc = _("The custom shortcut isn't exist.");
|
||||
break;
|
||||
diff --git a/plugins/inputdevices/keyboard/com.kylinsec.Kiran.SessionDaemon.Keyboard.xml b/plugins/inputdevices/keyboard/com.kylinsec.Kiran.SessionDaemon.Keyboard.xml
|
||||
index 4c7c1a9..9f535fa 100644
|
||||
--- a/plugins/inputdevices/keyboard/com.kylinsec.Kiran.SessionDaemon.Keyboard.xml
|
||||
+++ b/plugins/inputdevices/keyboard/com.kylinsec.Kiran.SessionDaemon.Keyboard.xml
|
||||
@@ -48,6 +48,35 @@
|
||||
<description>clear layout option.</description>
|
||||
</method>
|
||||
|
||||
+ <method name="SwitchCapsLockTips">
|
||||
+ <arg type="b" name="enabled" direction="in">
|
||||
+ <summary>enable option.</summary>
|
||||
+ </arg>
|
||||
+ <description>Switch CapsLock Tips option.</description>
|
||||
+ </method>
|
||||
+
|
||||
+ <method name="SwitchNumLockTips">
|
||||
+ <arg type="b" name="enabled" direction="in">
|
||||
+ <summary>enable option.</summary>
|
||||
+ </arg>
|
||||
+ <description>Switch NumLock tips option.</description>
|
||||
+ </method>
|
||||
+
|
||||
+ <property name="modifier_lock_enabled" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>Whether capslock and numlock is enabled.</description>
|
||||
+ </property>
|
||||
+
|
||||
+ <property name="capslock_tips_enabled" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>Whether capslock tips is enabled.</description>
|
||||
+ </property>
|
||||
+
|
||||
+ <property name="numlock_tips_enabled" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>Whether numlock tips is enabled.</description>
|
||||
+ </property>
|
||||
+
|
||||
<property name="repeat_enabled" type="b" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
<description>Whether repeat to trigger KeyPress and KeyRelease event when key is pressed.</description>
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-manager.cpp b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
index 2318a9e..734d310 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
@@ -26,6 +26,8 @@ namespace Kiran
|
||||
{
|
||||
#define KEYBOARD_SCHEMA_ID "com.kylinsec.kiran.keyboard"
|
||||
#define KEYBOARD_SCHEMA_MODIFIER_LOCK_ENABLED "modifier-lock-enabled"
|
||||
+#define KEYBOARD_SCHEMA_CAPSLOCK_TIPS_ENABLED "capslock-tips-enabled"
|
||||
+#define KEYBOARD_SCHEMA_NUMLOCK_TIPS_ENABLED "numlock-tips-enabled"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_ENABLED "repeat-enabled"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_DELAY "repeat-delay"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_INTERVAL "repeat-interval"
|
||||
@@ -43,11 +45,12 @@ namespace Kiran
|
||||
KeyboardManager::KeyboardManager() : dbus_connect_id_(0),
|
||||
object_register_id_(0),
|
||||
modifier_lock_enabled_(false),
|
||||
+ capslock_tips_enabled_(false),
|
||||
+ numlock_tips_enabled_(false),
|
||||
repeat_enabled_(true),
|
||||
repeat_delay_(500),
|
||||
repeat_interval_(30)
|
||||
{
|
||||
- this->modifier_lock_manager_ = std::make_shared<ModifierLockManager>();
|
||||
this->keyboard_settings_ = Gio::Settings::create(KEYBOARD_SCHEMA_ID);
|
||||
}
|
||||
|
||||
@@ -208,6 +211,26 @@ void KeyboardManager::ClearLayoutOption(MethodInvocation &invocation)
|
||||
invocation.ret();
|
||||
}
|
||||
|
||||
+void KeyboardManager::SwitchCapsLockTips(bool enabled, MethodInvocation &invocation)
|
||||
+{
|
||||
+ if (!this->capslock_tips_enabled_set(enabled))
|
||||
+ {
|
||||
+ DBUS_ERROR_REPLY_AND_RET(CCErrorCode::ERROR_KEYBOARD_SWITCH_CAPSLOCK_TIPS_FAILED);
|
||||
+ }
|
||||
+
|
||||
+ invocation.ret();
|
||||
+}
|
||||
+
|
||||
+void KeyboardManager::SwitchNumLockTips(bool enabled, MethodInvocation &invocation)
|
||||
+{
|
||||
+ if (!this->numlock_tips_enabled_set(enabled))
|
||||
+ {
|
||||
+ DBUS_ERROR_REPLY_AND_RET(CCErrorCode::ERROR_KEYBOARD_SWITCH_NUMLOCK_TIPS_FAILED);
|
||||
+ }
|
||||
+
|
||||
+ invocation.ret();
|
||||
+}
|
||||
+
|
||||
#define AUTO_REPEAT_SET_HANDLER(prop, type1, key, type2) \
|
||||
bool KeyboardManager::prop##_setHandler(type1 value) \
|
||||
{ \
|
||||
@@ -230,6 +253,31 @@ AUTO_REPEAT_SET_HANDLER(repeat_enabled, bool, KEYBOARD_SCHEMA_REPEAT_ENABLED, bo
|
||||
AUTO_REPEAT_SET_HANDLER(repeat_delay, gint32, KEYBOARD_SCHEMA_REPEAT_DELAY, int);
|
||||
AUTO_REPEAT_SET_HANDLER(repeat_interval, gint32, KEYBOARD_SCHEMA_REPEAT_INTERVAL, int);
|
||||
|
||||
+#define KEYBOARD_PROP_SET_HANDLER(prop, type1, key, type2) \
|
||||
+ bool KeyboardManager::prop##_setHandler(type1 value) \
|
||||
+ { \
|
||||
+ RETURN_VAL_IF_TRUE(value == this->prop##_, false); \
|
||||
+ if (this->keyboard_settings_->get_##type2(key) != value) \
|
||||
+ { \
|
||||
+ auto value_r = Glib::Variant<std::remove_cv<std::remove_reference<type1>::type>::type>::create(value); \
|
||||
+ if (!this->keyboard_settings_->set_value(key, value_r)) \
|
||||
+ { \
|
||||
+ return false; \
|
||||
+ } \
|
||||
+ } \
|
||||
+ this->prop##_ = value; \
|
||||
+ return true; \
|
||||
+ }
|
||||
+
|
||||
+KEYBOARD_PROP_SET_HANDLER(capslock_tips_enabled, bool, KEYBOARD_SCHEMA_CAPSLOCK_TIPS_ENABLED, boolean);
|
||||
+KEYBOARD_PROP_SET_HANDLER(numlock_tips_enabled, bool, KEYBOARD_SCHEMA_NUMLOCK_TIPS_ENABLED, boolean);
|
||||
+
|
||||
+bool KeyboardManager::modifier_lock_enabled_setHandler(bool value)
|
||||
+{
|
||||
+ // do nothing
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool KeyboardManager::layouts_setHandler(const std::vector<Glib::ustring> &value)
|
||||
{
|
||||
KLOG_PROFILE("value: %s.", StrUtils::join(value, ",").c_str());
|
||||
@@ -294,11 +342,6 @@ void KeyboardManager::init()
|
||||
this->load_xkb_rules();
|
||||
this->set_all_props();
|
||||
|
||||
- if (this->modifier_lock_enabled_)
|
||||
- {
|
||||
- this->modifier_lock_manager_->init();
|
||||
- }
|
||||
-
|
||||
this->keyboard_settings_->signal_changed().connect(sigc::mem_fun(this, &KeyboardManager::settings_changed));
|
||||
|
||||
this->dbus_connect_id_ = Gio::DBus::own_name(Gio::DBus::BUS_TYPE_SESSION,
|
||||
@@ -315,6 +358,8 @@ void KeyboardManager::load_from_settings()
|
||||
if (this->keyboard_settings_)
|
||||
{
|
||||
this->modifier_lock_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_MODIFIER_LOCK_ENABLED);
|
||||
+ this->capslock_tips_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_CAPSLOCK_TIPS_ENABLED);
|
||||
+ this->numlock_tips_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_NUMLOCK_TIPS_ENABLED);
|
||||
this->repeat_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_REPEAT_ENABLED);
|
||||
this->repeat_delay_ = this->keyboard_settings_->get_int(KEYBOARD_SCHEMA_REPEAT_DELAY);
|
||||
this->repeat_interval_ = this->keyboard_settings_->get_int(KEYBOARD_SCHEMA_REPEAT_INTERVAL);
|
||||
@@ -344,6 +389,12 @@ void KeyboardManager::settings_changed(const Glib::ustring &key)
|
||||
case CONNECT(KEYBOARD_SCHEMA_OPTIONS, _hash):
|
||||
this->options_set(this->keyboard_settings_->get_string_array(key));
|
||||
break;
|
||||
+ case CONNECT(KEYBOARD_SCHEMA_CAPSLOCK_TIPS_ENABLED, _hash):
|
||||
+ this->capslock_tips_enabled_set(this->keyboard_settings_->get_boolean(key));
|
||||
+ break;
|
||||
+ case CONNECT(KEYBOARD_SCHEMA_NUMLOCK_TIPS_ENABLED, _hash):
|
||||
+ this->numlock_tips_enabled_set(this->keyboard_settings_->get_boolean(key));
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-manager.h b/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
index b213169..50f88b6 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
#include <keyboard_dbus_stub.h>
|
||||
|
||||
-#include "plugins/inputdevices/keyboard/modifier-lock-manager.h"
|
||||
-//
|
||||
#include "plugins/inputdevices/common/device-helper.h"
|
||||
|
||||
namespace Kiran
|
||||
@@ -34,6 +32,10 @@ public:
|
||||
|
||||
static void global_deinit() { delete instance_; };
|
||||
|
||||
+ bool is_modifier_lock_enabled() { return this->modifier_lock_enabled_; };
|
||||
+ bool is_capslock_tips_enabled() { return this->capslock_tips_enabled_; };
|
||||
+ bool is_numlock_tips_enabled() { return this->numlock_tips_enabled_; };
|
||||
+
|
||||
protected:
|
||||
/* 添加键盘布局。键盘布局最多只能设置4个,如果超过4个则返回添加;
|
||||
如果布局不在GetValidLayouts返回的列表中,或者布局已经存在用户布局列表中,则返回添加失败;
|
||||
@@ -59,12 +61,24 @@ protected:
|
||||
// 清理布局选项
|
||||
virtual void ClearLayoutOption(MethodInvocation &invocation);
|
||||
|
||||
+ // 大小写锁提示开关
|
||||
+ virtual void SwitchCapsLockTips(bool enabled, MethodInvocation &invocation);
|
||||
+
|
||||
+ // 数字键盘锁提示开关
|
||||
+ virtual void SwitchNumLockTips(bool enabled, MethodInvocation &invocation);
|
||||
+
|
||||
+ virtual bool modifier_lock_enabled_setHandler(bool value);
|
||||
+ virtual bool capslock_tips_enabled_setHandler(bool value);
|
||||
+ virtual bool numlock_tips_enabled_setHandler(bool value);
|
||||
virtual bool repeat_enabled_setHandler(bool value);
|
||||
virtual bool repeat_delay_setHandler(gint32 value);
|
||||
virtual bool repeat_interval_setHandler(gint32 value);
|
||||
virtual bool layouts_setHandler(const std::vector<Glib::ustring> &value);
|
||||
virtual bool options_setHandler(const std::vector<Glib::ustring> &value);
|
||||
|
||||
+ virtual bool modifier_lock_enabled_get() { return this->modifier_lock_enabled_; };
|
||||
+ virtual bool capslock_tips_enabled_get() { return this->capslock_tips_enabled_; };
|
||||
+ virtual bool numlock_tips_enabled_get() { return this->numlock_tips_enabled_; };
|
||||
virtual bool repeat_enabled_get() { return this->repeat_enabled_; };
|
||||
virtual gint32 repeat_delay_get() { return this->repeat_delay_; };
|
||||
virtual gint32 repeat_interval_get() { return this->repeat_interval_; };
|
||||
@@ -90,8 +104,6 @@ private:
|
||||
private:
|
||||
static KeyboardManager *instance_;
|
||||
|
||||
- std::shared_ptr<ModifierLockManager> modifier_lock_manager_;
|
||||
-
|
||||
uint32_t dbus_connect_id_;
|
||||
uint32_t object_register_id_;
|
||||
|
||||
@@ -99,6 +111,8 @@ private:
|
||||
std::map<Glib::ustring, Glib::ustring> valid_layouts_;
|
||||
|
||||
bool modifier_lock_enabled_;
|
||||
+ bool capslock_tips_enabled_;
|
||||
+ bool numlock_tips_enabled_;
|
||||
bool repeat_enabled_;
|
||||
int32_t repeat_delay_;
|
||||
int32_t repeat_interval_;
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-plugin.cpp b/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
index b428a03..a8d26bb 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
@@ -17,6 +17,8 @@
|
||||
#include <cstdio>
|
||||
|
||||
#include <gtk3-log-i.h>
|
||||
+#include "plugins/inputdevices/keyboard/modifier-lock-manager.h"
|
||||
+//
|
||||
#include "plugins/inputdevices/keyboard/keyboard-manager.h"
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(KeyboardPlugin);
|
||||
@@ -50,6 +52,7 @@ void KeyboardPlugin::activate()
|
||||
}
|
||||
|
||||
KeyboardManager::global_init();
|
||||
+ ModifierLockManager::global_init(KeyboardManager::get_instance());
|
||||
}
|
||||
|
||||
void KeyboardPlugin::deactivate()
|
||||
@@ -66,6 +69,7 @@ void KeyboardPlugin::deactivate()
|
||||
}
|
||||
}
|
||||
|
||||
+ ModifierLockManager::global_deinit();
|
||||
KeyboardManager::global_deinit();
|
||||
}
|
||||
} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
diff --git a/plugins/inputdevices/keyboard/modifier-lock-manager.cpp b/plugins/inputdevices/keyboard/modifier-lock-manager.cpp
|
||||
index 80d55df..775f01e 100644
|
||||
--- a/plugins/inputdevices/keyboard/modifier-lock-manager.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/modifier-lock-manager.cpp
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace Kiran
|
||||
{
|
||||
-ModifierLockManager::ModifierLockManager()
|
||||
+ModifierLockManager::ModifierLockManager(KeyboardManager *keyboard_manager) : keyboard_manager_(keyboard_manager)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,6 +33,18 @@ ModifierLockManager::~ModifierLockManager()
|
||||
this);
|
||||
}
|
||||
|
||||
+ModifierLockManager *ModifierLockManager::instance_ = nullptr;
|
||||
+
|
||||
+void ModifierLockManager::global_init(KeyboardManager *keyboard_manager)
|
||||
+{
|
||||
+ instance_ = new ModifierLockManager(keyboard_manager);
|
||||
+
|
||||
+ if (keyboard_manager->is_modifier_lock_enabled())
|
||||
+ {
|
||||
+ instance_->init();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void ModifierLockManager::init()
|
||||
{
|
||||
Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
|
||||
@@ -113,6 +125,8 @@ void ModifierLockManager::set_lock_action(KeyCode keycode, unsigned int mods)
|
||||
|
||||
if (keycode == this->capslock_keycode_)
|
||||
{
|
||||
+ RETURN_IF_FALSE(this->keyboard_manager_->is_capslock_tips_enabled());
|
||||
+
|
||||
bool capslock_enable = !!(this->capslock_mask_ & mods);
|
||||
if (capslock_enable)
|
||||
{
|
||||
@@ -125,6 +139,8 @@ void ModifierLockManager::set_lock_action(KeyCode keycode, unsigned int mods)
|
||||
}
|
||||
else if (keycode == this->numlock_keycode_)
|
||||
{
|
||||
+ RETURN_IF_FALSE(this->keyboard_manager_->is_numlock_tips_enabled());
|
||||
+
|
||||
bool numlock_enable = !!(this->numlock_mask_ & mods);
|
||||
if (numlock_enable)
|
||||
{
|
||||
diff --git a/plugins/inputdevices/keyboard/modifier-lock-manager.h b/plugins/inputdevices/keyboard/modifier-lock-manager.h
|
||||
index a321ddc..e9dd773 100644
|
||||
--- a/plugins/inputdevices/keyboard/modifier-lock-manager.h
|
||||
+++ b/plugins/inputdevices/keyboard/modifier-lock-manager.h
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <gdkmm.h>
|
||||
//
|
||||
#include <X11/Xlib.h>
|
||||
+#include "plugins/inputdevices/keyboard/keyboard-manager.h"
|
||||
#include "plugins/inputdevices/keyboard/modifier-lock-window.h"
|
||||
|
||||
namespace Kiran
|
||||
@@ -24,12 +25,18 @@ namespace Kiran
|
||||
class ModifierLockManager
|
||||
{
|
||||
public:
|
||||
- ModifierLockManager();
|
||||
+ ModifierLockManager(KeyboardManager *keyboard_manager);
|
||||
~ModifierLockManager();
|
||||
|
||||
- void init();
|
||||
+ static ModifierLockManager *get_instance() { return instance_; };
|
||||
+
|
||||
+ static void global_init(KeyboardManager *keyboard_manager);
|
||||
+
|
||||
+ static void global_deinit() { delete instance_; };
|
||||
|
||||
private:
|
||||
+ void init();
|
||||
+
|
||||
int xkb_init();
|
||||
|
||||
void set_lock_action(KeyCode keycode, unsigned int mods);
|
||||
@@ -37,6 +44,8 @@ private:
|
||||
static GdkFilterReturn window_event(GdkXEvent *gdk_event, GdkEvent *event, gpointer data);
|
||||
|
||||
private:
|
||||
+ static ModifierLockManager *instance_;
|
||||
+
|
||||
int xkb_event_base_;
|
||||
|
||||
unsigned int capslock_mask_;
|
||||
@@ -44,6 +53,7 @@ private:
|
||||
KeyCode capslock_keycode_;
|
||||
KeyCode numlock_keycode_;
|
||||
|
||||
+ KeyboardManager *keyboard_manager_;
|
||||
ModifierLockWindow lock_window_;
|
||||
};
|
||||
|
||||
diff --git a/po/zh_CN.po b/po/zh_CN.po
|
||||
index 6de1cbd..7362715 100644
|
||||
--- a/po/zh_CN.po
|
||||
+++ b/po/zh_CN.po
|
||||
@@ -1247,3 +1247,11 @@ msgstr "电源管理"
|
||||
#: ../plugins/power/tray/kiran-power-status-icon.desktop.in.h:2
|
||||
msgid "Power management daemon"
|
||||
msgstr "电源管理后端"
|
||||
+
|
||||
+#: ../lib/base/error.cpp:310
|
||||
+msgid "Failed to switch the capslock tips."
|
||||
+msgstr "无法切换大小写锁提示。"
|
||||
+
|
||||
+#: ../lib/base/error.cpp:313
|
||||
+msgid "Failed to switch the numlock tips."
|
||||
+msgstr "无法切换数字锁提示。"
|
||||
\ No newline at end of file
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
From c2b945687c1fda9c218c3b2a3bfb1c91b3d65f04 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 14 Apr 2023 09:28:34 +0800
|
||||
Subject: [PATCH] fix(keyboard):Add modifier lock window tips enable key with
|
||||
gsettings
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 使用gsettings配置添加修饰锁按键提示窗口开关
|
||||
|
||||
Related #67766
|
||||
|
||||
Signed-off-by: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
---
|
||||
data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in | 5 +++++
|
||||
plugins/inputdevices/keyboard/keyboard-manager.cpp | 9 ++++++++-
|
||||
plugins/inputdevices/keyboard/keyboard-manager.h | 1 +
|
||||
3 files changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in b/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
index ffea7cf..05e948a 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.keyboard.gschema.xml.in
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<schemalist gettext-domain="@PROJECT_NAME@">
|
||||
<schema id="com.kylinsec.kiran.keyboard" path="/com/kylinsec/kiran/keyboard/">
|
||||
+ <key name="modifier-lock-enabled" type="b">
|
||||
+ <default>false</default>
|
||||
+ <description>Whether enable capslock and numlock windows tips.</description>
|
||||
+ </key>
|
||||
+
|
||||
<key name="repeat-enabled" type="b">
|
||||
<default>true</default>
|
||||
<description>Whether repeat to trigger KeyPress and KeyRelease event when key is pressed.</description>
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-manager.cpp b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
index 0b1bcc4..2318a9e 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
@@ -25,6 +25,7 @@
|
||||
namespace Kiran
|
||||
{
|
||||
#define KEYBOARD_SCHEMA_ID "com.kylinsec.kiran.keyboard"
|
||||
+#define KEYBOARD_SCHEMA_MODIFIER_LOCK_ENABLED "modifier-lock-enabled"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_ENABLED "repeat-enabled"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_DELAY "repeat-delay"
|
||||
#define KEYBOARD_SCHEMA_REPEAT_INTERVAL "repeat-interval"
|
||||
@@ -41,6 +42,7 @@ namespace Kiran
|
||||
|
||||
KeyboardManager::KeyboardManager() : dbus_connect_id_(0),
|
||||
object_register_id_(0),
|
||||
+ modifier_lock_enabled_(false),
|
||||
repeat_enabled_(true),
|
||||
repeat_delay_(500),
|
||||
repeat_interval_(30)
|
||||
@@ -291,7 +293,11 @@ void KeyboardManager::init()
|
||||
this->load_from_settings();
|
||||
this->load_xkb_rules();
|
||||
this->set_all_props();
|
||||
- this->modifier_lock_manager_->init();
|
||||
+
|
||||
+ if (this->modifier_lock_enabled_)
|
||||
+ {
|
||||
+ this->modifier_lock_manager_->init();
|
||||
+ }
|
||||
|
||||
this->keyboard_settings_->signal_changed().connect(sigc::mem_fun(this, &KeyboardManager::settings_changed));
|
||||
|
||||
@@ -308,6 +314,7 @@ void KeyboardManager::load_from_settings()
|
||||
|
||||
if (this->keyboard_settings_)
|
||||
{
|
||||
+ this->modifier_lock_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_MODIFIER_LOCK_ENABLED);
|
||||
this->repeat_enabled_ = this->keyboard_settings_->get_boolean(KEYBOARD_SCHEMA_REPEAT_ENABLED);
|
||||
this->repeat_delay_ = this->keyboard_settings_->get_int(KEYBOARD_SCHEMA_REPEAT_DELAY);
|
||||
this->repeat_interval_ = this->keyboard_settings_->get_int(KEYBOARD_SCHEMA_REPEAT_INTERVAL);
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-manager.h b/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
index 5015b1d..b213169 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-manager.h
|
||||
@@ -98,6 +98,7 @@ private:
|
||||
Glib::RefPtr<Gio::Settings> keyboard_settings_;
|
||||
std::map<Glib::ustring, Glib::ustring> valid_layouts_;
|
||||
|
||||
+ bool modifier_lock_enabled_;
|
||||
bool repeat_enabled_;
|
||||
int32_t repeat_delay_;
|
||||
int32_t repeat_interval_;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
From a55744c5be2995753088a476aee4af1e3c6014ad Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 21 Jul 2023 17:13:56 +0800
|
||||
Subject: [PATCH] fix(keyboard):Fix ci build error
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复ci编译报错
|
||||
---
|
||||
plugins/inputdevices/keyboard/keyboard-manager.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-manager.cpp b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
index 734d310..40f24a1 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-manager.cpp
|
||||
@@ -505,7 +505,7 @@ bool KeyboardManager::set_layouts(const std::vector<Glib::ustring> &layouts)
|
||||
if (join_layouts.length() <= 0)
|
||||
{
|
||||
join_layouts = DEFAULT_LAYOUT LAYOUT_JOIN_CHAR;
|
||||
- join_variants = LAYOUT_JOIN_CHAR;
|
||||
+ join_variants = std::string(LAYOUT_JOIN_CHAR);
|
||||
}
|
||||
|
||||
auto cmdline = fmt::format("{0} -layout {1} -variant {2}", SETXKBMAP, join_layouts, join_variants);
|
||||
--
|
||||
2.27.0
|
||||
|
||||
46
0001-fix-media-keys-Fix-use-shortcut-key-with-shift.patch
Normal file
46
0001-fix-media-keys-Fix-use-shortcut-key-with-shift.patch
Normal file
@ -0,0 +1,46 @@
|
||||
From b7495f653007f54a306eecd8b033c857359cee4a Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Fri, 5 Jan 2024 09:25:02 +0800
|
||||
Subject: [PATCH] fix(media-keys):Fix use shortcut key with shift
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
-兼容快捷键按键shift
|
||||
|
||||
Related #25039
|
||||
---
|
||||
plugins/keybinding/shortcut-helper.cpp | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/plugins/keybinding/shortcut-helper.cpp b/plugins/keybinding/shortcut-helper.cpp
|
||||
index c459b53..a9dd62c 100644
|
||||
--- a/plugins/keybinding/shortcut-helper.cpp
|
||||
+++ b/plugins/keybinding/shortcut-helper.cpp
|
||||
@@ -134,6 +134,7 @@ KeyState ShortCutHelper::get_keystate(XEvent *event)
|
||||
|
||||
gdk_keyval_convert_case(keyval, &lower, &upper);
|
||||
key_state.key_symbol = lower;
|
||||
+ consumed = (GdkModifierType)(consumed & (~GDK_SHIFT_MASK));
|
||||
KLOG_DEBUG_KEYBINDING("The keystate is %0x and consumed is %0x.", event->xkey.state, consumed);
|
||||
key_state.mods = event->xkey.state & ~consumed & GDK_MODIFIER_MASK;
|
||||
return key_state;
|
||||
@@ -213,7 +214,7 @@ bool ShortCutHelper::grab_keystate_change(Glib::RefPtr<Gdk::Window> root_window,
|
||||
const KeyState &keystate,
|
||||
bool is_grab)
|
||||
{
|
||||
- KLOG_PROFILE("symbol: %0x mods: %0x", keystate.key_symbol, keystate.mods);
|
||||
+ KLOG_DEBUG_KEYBINDING("Grab key symbol: %0x mods: %0x", keystate.key_symbol, keystate.mods);
|
||||
|
||||
RETURN_VAL_IF_TRUE(keystate == NULL_KEYSTATE, true);
|
||||
RETURN_VAL_IF_FALSE(keystate != INVALID_KEYSTATE, false);
|
||||
@@ -287,4 +288,4 @@ bool ShortCutHelper::key_uses_keycode(const KeyState &key_state, uint32_t keycod
|
||||
return false;
|
||||
}
|
||||
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,432 +0,0 @@
|
||||
From b8295ad613323c7a2d637caa06b918019e9dbaf2 Mon Sep 17 00:00:00 2001
|
||||
From: yuanxing <yuanxing@kylinsec.com.cn>
|
||||
Date: Thu, 14 Sep 2023 18:51:56 +0800
|
||||
Subject: [PATCH] fix(plugin):remove active or deactive mate plugin code
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 移除 激活/不激活 mate插件代码
|
||||
---
|
||||
plugins/appearance/appearance-plugin.cpp | 26 +------------------
|
||||
plugins/clipboard/clipboard-plugin.cpp | 26 +------------------
|
||||
plugins/display/display-plugin.cpp | 26 +------------------
|
||||
.../inputdevices/keyboard/keyboard-plugin.cpp | 26 +------------------
|
||||
plugins/inputdevices/mouse/mouse-plugin.cpp | 25 +-----------------
|
||||
.../inputdevices/touchpad/touchpad-plugin.cpp | 26 +------------------
|
||||
plugins/keybinding/keybinding-plugin.cpp | 26 +------------------
|
||||
plugins/xsettings/xsettings-plugin.cpp | 26 +------------------
|
||||
8 files changed, 8 insertions(+), 199 deletions(-)
|
||||
|
||||
diff --git a/plugins/appearance/appearance-plugin.cpp b/plugins/appearance/appearance-plugin.cpp
|
||||
index 8f3e123..f5dcdaa 100644
|
||||
--- a/plugins/appearance/appearance-plugin.cpp
|
||||
+++ b/plugins/appearance/appearance-plugin.cpp
|
||||
@@ -19,9 +19,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(AppearancePlugin);
|
||||
|
||||
-#define MATE_BACKGROUND_SCHEMA_ID "org.mate.SettingsDaemon.plugins.background"
|
||||
-#define MATE_BACKGROUND_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
AppearancePlugin::AppearancePlugin()
|
||||
@@ -36,17 +33,6 @@ void AppearancePlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active appearance plugin.");
|
||||
|
||||
- // kiran和mate的插件最好不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_BACKGROUND_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_background = Gio::Settings::create(MATE_BACKGROUND_SCHEMA_ID);
|
||||
- if (mate_background->get_boolean(MATE_BACKGROUND_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_background->set_boolean(MATE_BACKGROUND_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
AppearanceManager::global_init();
|
||||
}
|
||||
|
||||
@@ -54,16 +40,6 @@ void AppearancePlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive appearance plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_BACKGROUND_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_background = Gio::Settings::create(MATE_BACKGROUND_SCHEMA_ID);
|
||||
- if (!mate_background->get_boolean(MATE_BACKGROUND_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_background->set_boolean(MATE_BACKGROUND_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
AppearanceManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/clipboard/clipboard-plugin.cpp b/plugins/clipboard/clipboard-plugin.cpp
|
||||
index 7a9cbec..92b6a20 100644
|
||||
--- a/plugins/clipboard/clipboard-plugin.cpp
|
||||
+++ b/plugins/clipboard/clipboard-plugin.cpp
|
||||
@@ -18,9 +18,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(ClipboardPlugin);
|
||||
|
||||
-#define MATE_CLIPBOARD_SCHEMA_ID "org.mate.SettingsDaemon.plugins.clipboard"
|
||||
-#define MATE_CLIPBOARD_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
ClipboardPlugin::ClipboardPlugin()
|
||||
@@ -35,17 +32,6 @@ void ClipboardPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active clipboard plugin.");
|
||||
|
||||
- // kiran和mate的插件最好不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_CLIPBOARD_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_clipboard = Gio::Settings::create(MATE_CLIPBOARD_SCHEMA_ID);
|
||||
- if (mate_clipboard->get_boolean(MATE_CLIPBOARD_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_clipboard->set_boolean(MATE_CLIPBOARD_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
ClipboardManager::global_init();
|
||||
}
|
||||
|
||||
@@ -53,16 +39,6 @@ void ClipboardPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive clipboard plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_CLIPBOARD_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_clipboard = Gio::Settings::create(MATE_CLIPBOARD_SCHEMA_ID);
|
||||
- if (!mate_clipboard->get_boolean(MATE_CLIPBOARD_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_clipboard->set_boolean(MATE_CLIPBOARD_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
ClipboardManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/display/display-plugin.cpp b/plugins/display/display-plugin.cpp
|
||||
index 0385f33..32ae5be 100644
|
||||
--- a/plugins/display/display-plugin.cpp
|
||||
+++ b/plugins/display/display-plugin.cpp
|
||||
@@ -22,9 +22,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(DisplayPlugin);
|
||||
|
||||
-#define MATE_XRANDR_SCHEMA_ID "org.mate.SettingsDaemon.plugins.xrandr"
|
||||
-#define MATE_XRANDR_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
DisplayPlugin::DisplayPlugin()
|
||||
@@ -38,16 +35,6 @@ DisplayPlugin::~DisplayPlugin()
|
||||
void DisplayPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active display plugin.");
|
||||
- // kiran和mate的插件最好不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_XRANDR_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_display = Gio::Settings::create(MATE_XRANDR_SCHEMA_ID);
|
||||
- if (mate_display->get_boolean(MATE_XRANDR_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_display->set_boolean(MATE_XRANDR_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
|
||||
XrandrManager::global_init();
|
||||
DisplayManager::global_init(XrandrManager::get_instance());
|
||||
@@ -57,18 +44,7 @@ void DisplayPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive display plugin.");
|
||||
|
||||
- // 恢复MATE的插件
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_XRANDR_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_display = Gio::Settings::create(MATE_XRANDR_SCHEMA_ID);
|
||||
- if (!mate_display->get_boolean(MATE_XRANDR_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_display->set_boolean(MATE_XRANDR_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
DisplayManager::global_deinit();
|
||||
XrandrManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/inputdevices/keyboard/keyboard-plugin.cpp b/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
index a8d26bb..6c7b727 100644
|
||||
--- a/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
+++ b/plugins/inputdevices/keyboard/keyboard-plugin.cpp
|
||||
@@ -23,9 +23,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(KeyboardPlugin);
|
||||
|
||||
-#define MATE_KEYBOARD_SCHEMA_ID "org.mate.SettingsDaemon.plugins.keyboard"
|
||||
-#define MATE_KEYBOARD_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
KeyboardPlugin::KeyboardPlugin()
|
||||
@@ -40,17 +37,6 @@ void KeyboardPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active keyboard plugin.");
|
||||
|
||||
- // kiran和mate的插件最好不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_KEYBOARD_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_keyboard = Gio::Settings::create(MATE_KEYBOARD_SCHEMA_ID);
|
||||
- if (mate_keyboard->get_boolean(MATE_KEYBOARD_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_keyboard->set_boolean(MATE_KEYBOARD_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
KeyboardManager::global_init();
|
||||
ModifierLockManager::global_init(KeyboardManager::get_instance());
|
||||
}
|
||||
@@ -59,17 +45,7 @@ void KeyboardPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive keyboard plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_KEYBOARD_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_keyboard = Gio::Settings::create(MATE_KEYBOARD_SCHEMA_ID);
|
||||
- if (!mate_keyboard->get_boolean(MATE_KEYBOARD_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_keyboard->set_boolean(MATE_KEYBOARD_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
ModifierLockManager::global_deinit();
|
||||
KeyboardManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/inputdevices/mouse/mouse-plugin.cpp b/plugins/inputdevices/mouse/mouse-plugin.cpp
|
||||
index 8109a03..bb1d47d 100644
|
||||
--- a/plugins/inputdevices/mouse/mouse-plugin.cpp
|
||||
+++ b/plugins/inputdevices/mouse/mouse-plugin.cpp
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(MousePlugin);
|
||||
|
||||
-#define MATE_MOUSE_SCHEMA_ID "org.mate.SettingsDaemon.plugins.mouse"
|
||||
-#define MATE_MOUSE_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
MousePlugin::MousePlugin()
|
||||
@@ -38,16 +35,6 @@ void MousePlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active mouse plugin.");
|
||||
|
||||
- // kiran和mate的相同插件不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_MOUSE_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_mouse = Gio::Settings::create(MATE_MOUSE_SCHEMA_ID);
|
||||
- if (mate_mouse->get_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_mouse->set_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
MouseManager::global_init();
|
||||
}
|
||||
|
||||
@@ -55,16 +42,6 @@ void MousePlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive mouse plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_MOUSE_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_mouse = Gio::Settings::create(MATE_MOUSE_SCHEMA_ID);
|
||||
- if (!mate_mouse->get_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_mouse->set_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
MouseManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/inputdevices/touchpad/touchpad-plugin.cpp b/plugins/inputdevices/touchpad/touchpad-plugin.cpp
|
||||
index 00ac7a9..910038c 100644
|
||||
--- a/plugins/inputdevices/touchpad/touchpad-plugin.cpp
|
||||
+++ b/plugins/inputdevices/touchpad/touchpad-plugin.cpp
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(TouchPadPlugin);
|
||||
|
||||
-#define MATE_MOUSE_SCHEMA_ID "org.mate.SettingsDaemon.plugins.mouse"
|
||||
-#define MATE_MOUSE_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
TouchPadPlugin::TouchPadPlugin()
|
||||
@@ -38,17 +35,6 @@ void TouchPadPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active touchpad plugin.");
|
||||
|
||||
- // kiran和mate的相同插件不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_MOUSE_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_touchpad = Gio::Settings::create(MATE_MOUSE_SCHEMA_ID);
|
||||
- if (mate_touchpad->get_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_touchpad->set_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
TouchPadManager::global_init();
|
||||
}
|
||||
|
||||
@@ -56,16 +42,6 @@ void TouchPadPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive touchpad plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_MOUSE_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_touchpad = Gio::Settings::create(MATE_MOUSE_SCHEMA_ID);
|
||||
- if (!mate_touchpad->get_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_touchpad->set_boolean(MATE_MOUSE_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
TouchPadManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/keybinding/keybinding-plugin.cpp b/plugins/keybinding/keybinding-plugin.cpp
|
||||
index e2ea9c3..90cc06c 100644
|
||||
--- a/plugins/keybinding/keybinding-plugin.cpp
|
||||
+++ b/plugins/keybinding/keybinding-plugin.cpp
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(KeybindingPlugin);
|
||||
|
||||
-#define MATE_KEYBINDINGS_SCHEMA_ID "org.mate.SettingsDaemon.plugins.keybindings"
|
||||
-#define MATE_KEYBINDINGS_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
KeybindingPlugin::KeybindingPlugin()
|
||||
@@ -38,17 +35,6 @@ void KeybindingPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active keybinding plugin.");
|
||||
|
||||
- // kiran和mate的相同插件不要同时运行,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_KEYBINDINGS_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_keybinding = Gio::Settings::create(MATE_KEYBINDINGS_SCHEMA_ID);
|
||||
- if (mate_keybinding->get_boolean(MATE_KEYBINDINGS_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_keybinding->set_boolean(MATE_KEYBINDINGS_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
KeybindingManager::global_init();
|
||||
}
|
||||
|
||||
@@ -56,16 +42,6 @@ void KeybindingPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive keybinding plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_KEYBINDINGS_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_keybinding = Gio::Settings::create(MATE_KEYBINDINGS_SCHEMA_ID);
|
||||
- if (!mate_keybinding->get_boolean(MATE_KEYBINDINGS_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_keybinding->set_boolean(MATE_KEYBINDINGS_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
KeybindingManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
diff --git a/plugins/xsettings/xsettings-plugin.cpp b/plugins/xsettings/xsettings-plugin.cpp
|
||||
index f4d705f..0755a02 100644
|
||||
--- a/plugins/xsettings/xsettings-plugin.cpp
|
||||
+++ b/plugins/xsettings/xsettings-plugin.cpp
|
||||
@@ -21,9 +21,6 @@
|
||||
|
||||
PLUGIN_EXPORT_FUNC_DEF(XSettingsPlugin);
|
||||
|
||||
-#define MATE_XSETTINGS_SCHEMA_ID "org.mate.SettingsDaemon.plugins.xsettings"
|
||||
-#define MATE_XSETTINGS_SCHEMA_KEY_ACTIVE "active"
|
||||
-
|
||||
namespace Kiran
|
||||
{
|
||||
XSettingsPlugin::XSettingsPlugin()
|
||||
@@ -38,17 +35,6 @@ void XSettingsPlugin::activate()
|
||||
{
|
||||
KLOG_PROFILE("active xsettings plugin.");
|
||||
|
||||
- // kiran和mate的xrandr插件只能运行一个,如果开启了kiran的插件,则将mate的插件停用
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_XSETTINGS_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_xsettings = Gio::Settings::create(MATE_XSETTINGS_SCHEMA_ID);
|
||||
- if (mate_xsettings->get_boolean(MATE_XSETTINGS_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_xsettings->set_boolean(MATE_XSETTINGS_SCHEMA_KEY_ACTIVE, false);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
XSettingsManager::global_init();
|
||||
}
|
||||
|
||||
@@ -56,16 +42,6 @@ void XSettingsPlugin::deactivate()
|
||||
{
|
||||
KLOG_PROFILE("deactive xsettings plugin.");
|
||||
|
||||
- auto schemas = Gio::Settings::list_schemas();
|
||||
- if (std::find(schemas.begin(), schemas.end(), MATE_XSETTINGS_SCHEMA_ID) != schemas.end())
|
||||
- {
|
||||
- auto mate_xsettings = Gio::Settings::create(MATE_XSETTINGS_SCHEMA_ID);
|
||||
- if (!mate_xsettings->get_boolean(MATE_XSETTINGS_SCHEMA_KEY_ACTIVE))
|
||||
- {
|
||||
- mate_xsettings->set_boolean(MATE_XSETTINGS_SCHEMA_KEY_ACTIVE, true);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
XSettingsManager::global_deinit();
|
||||
}
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,149 +0,0 @@
|
||||
From 1296b7d210321c0ef14eb11a2c0cd76c0f51278f Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Thu, 20 Jul 2023 17:17:16 +0800
|
||||
Subject: [PATCH] fix(power):Add battery charging and discharging time
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 添加电池充电和放电时间
|
||||
|
||||
Related #9506
|
||||
---
|
||||
plugins/power/tray/CMakeLists.txt | 3 ++-
|
||||
plugins/power/tray/po/zh_CN.po | 34 ++++++++++++++++++++++++++++++-
|
||||
plugins/power/tray/power-tray.cpp | 33 +++++++++++++++++++++++++++++-
|
||||
plugins/power/tray/power-tray.h | 3 +++
|
||||
4 files changed, 70 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/plugins/power/tray/CMakeLists.txt b/plugins/power/tray/CMakeLists.txt
|
||||
index f74aa08..353065d 100644
|
||||
--- a/plugins/power/tray/CMakeLists.txt
|
||||
+++ b/plugins/power/tray/CMakeLists.txt
|
||||
@@ -9,7 +9,8 @@ add_executable(
|
||||
${TARGET_NAME}
|
||||
${POWER_TRAY_H_FILES} ${POWER_TRAY_CPP_FILES}
|
||||
${PROJECT_SOURCE_DIR}/plugins/power/wrapper/power-upower.cpp
|
||||
- ${PROJECT_SOURCE_DIR}/plugins/power/wrapper/power-upower-device.cpp)
|
||||
+ ${PROJECT_SOURCE_DIR}/plugins/power/wrapper/power-upower-device.cpp
|
||||
+ ${PROJECT_SOURCE_DIR}/plugins/power/power-utils.cpp)
|
||||
|
||||
target_include_directories(${TARGET_NAME} PUBLIC ${GTKMM3_INCLUDE_DIRS})
|
||||
|
||||
diff --git a/plugins/power/tray/po/zh_CN.po b/plugins/power/tray/po/zh_CN.po
|
||||
index 436167c..377037d 100644
|
||||
--- a/plugins/power/tray/po/zh_CN.po
|
||||
+++ b/plugins/power/tray/po/zh_CN.po
|
||||
@@ -17,6 +17,38 @@ msgstr ""
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
-#: ../power-tray.cpp:103
|
||||
+#: ../power-tray.cpp:132
|
||||
msgid "Remaining electricty: {0:.1f}%"
|
||||
msgstr "剩余电量:{0:.1f}%"
|
||||
+
|
||||
+#: ../power-tray.cpp:114
|
||||
+msgid "Remaining electricty: {0:.1f}%, approximately {1} until charged"
|
||||
+msgstr "剩余电量:{0:.1f}%,离充满大约{1}"
|
||||
+
|
||||
+#: ../power-tray.cpp:123
|
||||
+msgid "Remaining electricty: {0:.1f}%, approximately provides {1} runtime"
|
||||
+msgstr "剩余电量:{0:.1f}%,大约可使用{1}"
|
||||
+
|
||||
+#: ../plugins/power/power-utils.cpp:26
|
||||
+msgid "Less than 1 minute"
|
||||
+msgstr "小于1分钟"
|
||||
+
|
||||
+#: ../plugins/power/power-utils.cpp:30
|
||||
+msgid "{0} minute"
|
||||
+msgid_plural "{0} minutes"
|
||||
+msgstr[0] "{0}分钟"
|
||||
+
|
||||
+#: ../plugins/power/power-utils.cpp:38
|
||||
+msgid "{0} hour"
|
||||
+msgid_plural "{0} hours"
|
||||
+msgstr[0] "{0}小时"
|
||||
+
|
||||
+#: ../plugins/power/power-utils.cpp:44
|
||||
+msgid "hour"
|
||||
+msgid_plural "hours"
|
||||
+msgstr[0] "小时"
|
||||
+
|
||||
+#: ../plugins/power/power-utils.cpp:46
|
||||
+msgid "minute"
|
||||
+msgid_plural "minutes"
|
||||
+msgstr[0] "分钟"
|
||||
\ No newline at end of file
|
||||
diff --git a/plugins/power/tray/power-tray.cpp b/plugins/power/tray/power-tray.cpp
|
||||
index 69f9cee..3586f6c 100644
|
||||
--- a/plugins/power/tray/power-tray.cpp
|
||||
+++ b/plugins/power/tray/power-tray.cpp
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include "plugins/power/wrapper/power-upower.h"
|
||||
+#include "plugins/power/power-utils.h"
|
||||
#include "power-i.h"
|
||||
|
||||
namespace Kiran
|
||||
@@ -98,11 +99,41 @@ void PowerTray::update_status_icon()
|
||||
}
|
||||
|
||||
// 对于电源和UPS设备需要显示电量
|
||||
- if (device_for_tray)
|
||||
+ this->update_status_icon_toolstip(device_for_tray);
|
||||
+}
|
||||
+
|
||||
+void PowerTray::update_status_icon_toolstip(std::shared_ptr<PowerUPowerDevice> device_for_tray)
|
||||
+{
|
||||
+ RETURN_IF_FALSE(device_for_tray);
|
||||
+
|
||||
+ switch (device_for_tray->get_props().state)
|
||||
+ {
|
||||
+ case UP_DEVICE_STATE_CHARGING:
|
||||
+ {
|
||||
+ auto time_to_full_text = PowerUtils::get_time_translation(device_for_tray->get_props().time_to_full);
|
||||
+ auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately {1} until charged"),
|
||||
+ device_for_tray->get_props().percentage,
|
||||
+ time_to_full_text);
|
||||
+ gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
|
||||
+ break;
|
||||
+ }
|
||||
+ case UP_DEVICE_STATE_DISCHARGING:
|
||||
+ {
|
||||
+ auto time_to_empty_text = PowerUtils::get_time_translation(device_for_tray->get_props().time_to_empty);
|
||||
+ auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%, approximately provides {1} runtime"),
|
||||
+ device_for_tray->get_props().percentage,
|
||||
+ time_to_empty_text);
|
||||
+ gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
|
||||
+ break;
|
||||
+ }
|
||||
+ case UP_DEVICE_STATE_FULLY_CHARGED:
|
||||
+ default:
|
||||
{
|
||||
auto tooltip_text = fmt::format(_("Remaining electricty: {0:.1f}%"), device_for_tray->get_props().percentage);
|
||||
gtk_status_icon_set_tooltip_text(this->status_icon_, tooltip_text.c_str());
|
||||
}
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
void PowerTray::delay_update_status_icon()
|
||||
diff --git a/plugins/power/tray/power-tray.h b/plugins/power/tray/power-tray.h
|
||||
index b496ba9..9a14a47 100644
|
||||
--- a/plugins/power/tray/power-tray.h
|
||||
+++ b/plugins/power/tray/power-tray.h
|
||||
@@ -35,6 +35,9 @@ public:
|
||||
// 更新托盘图标
|
||||
void update_status_icon();
|
||||
|
||||
+ // 更新托盘图标提示语
|
||||
+ void update_status_icon_toolstip(std::shared_ptr<PowerUPowerDevice> device_for_tray);
|
||||
+
|
||||
private:
|
||||
void init();
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,134 +0,0 @@
|
||||
From ca64260a4385ec5dd31e9481bb6f3f9b567a9e02 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Mon, 21 Aug 2023 10:53:20 +0800
|
||||
Subject: [PATCH] fix(power):Change poweroff action from key press to release
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修改关机动作从按键按下时变为释放时触发
|
||||
|
||||
Related #11422
|
||||
---
|
||||
include/power-i.h | 4 ++--
|
||||
plugins/power/event/power-event-button.cpp | 13 ++++++++++---
|
||||
plugins/power/event/power-event-control.cpp | 2 +-
|
||||
plugins/power/power-manager.cpp | 6 +++---
|
||||
plugins/power/power-utils.cpp | 4 ++--
|
||||
5 files changed, 18 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/include/power-i.h b/include/power-i.h
|
||||
index 895c93e..ace2ec6 100644
|
||||
--- a/include/power-i.h
|
||||
+++ b/include/power-i.h
|
||||
@@ -67,8 +67,8 @@ extern "C"
|
||||
|
||||
enum PowerEvent
|
||||
{
|
||||
- // 按下关机键
|
||||
- POWER_EVENT_PRESSED_POWEROFF = 0,
|
||||
+ // 释放关机键
|
||||
+ POWER_EVENT_RELEASE_POWEROFF = 0,
|
||||
// 按下睡眠键
|
||||
POWER_EVENT_PRESSED_SLEEP,
|
||||
// 按下挂起键
|
||||
diff --git a/plugins/power/event/power-event-button.cpp b/plugins/power/event/power-event-button.cpp
|
||||
index 082397b..4fe7747 100644
|
||||
--- a/plugins/power/event/power-event-button.cpp
|
||||
+++ b/plugins/power/event/power-event-button.cpp
|
||||
@@ -48,7 +48,7 @@ void PowerEventButton::init()
|
||||
auto login1 = PowerWrapperManager::get_instance()->get_default_login1();
|
||||
this->login1_inhibit_fd_ = login1->inhibit("handle-power-key:handle-suspend-key:handle-lid-switch");
|
||||
|
||||
- this->register_button(XF86XK_PowerOff, PowerEvent::POWER_EVENT_PRESSED_POWEROFF);
|
||||
+ this->register_button(XF86XK_PowerOff, PowerEvent::POWER_EVENT_RELEASE_POWEROFF);
|
||||
this->register_button(XF86XK_Suspend, PowerEvent::POWER_EVENT_PRESSED_SUSPEND);
|
||||
this->register_button(XF86XK_Sleep, PowerEvent::POWER_EVENT_PRESSED_SLEEP);
|
||||
this->register_button(XF86XK_Hibernate, PowerEvent::POWER_EVENT_PRESSED_HIBERNATE);
|
||||
@@ -136,7 +136,14 @@ GdkFilterReturn PowerEventButton::window_event(GdkXEvent *gdk_event, GdkEvent *e
|
||||
auto button = (PowerEventButton *)data;
|
||||
XEvent *xevent = (XEvent *)gdk_event;
|
||||
|
||||
- RETURN_VAL_IF_TRUE(xevent->type != KeyPress, GDK_FILTER_CONTINUE);
|
||||
+ if (xevent->xkey.keycode == XKeysymToKeycode(button->xdisplay_, XF86XK_PowerOff))
|
||||
+ {
|
||||
+ RETURN_VAL_IF_TRUE(xevent->type != KeyRelease, GDK_FILTER_CONTINUE);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ RETURN_VAL_IF_TRUE(xevent->type != KeyPress, GDK_FILTER_CONTINUE);
|
||||
+ }
|
||||
|
||||
auto keycode = xevent->xkey.keycode;
|
||||
auto keycode_str = fmt::format("0x{:x}", keycode);
|
||||
@@ -148,7 +155,7 @@ GdkFilterReturn PowerEventButton::window_event(GdkXEvent *gdk_event, GdkEvent *e
|
||||
return GDK_FILTER_CONTINUE;
|
||||
}
|
||||
|
||||
- KLOG_DEBUG("Receipt keycode signal: %s.", keycode_str.c_str());
|
||||
+ KLOG_DEBUG("Receipt keycode signal: %s, event type: %d.", keycode_str.c_str(), xevent->type);
|
||||
button->emit_button_signal(iter->second);
|
||||
|
||||
return GDK_FILTER_REMOVE;
|
||||
diff --git a/plugins/power/event/power-event-control.cpp b/plugins/power/event/power-event-control.cpp
|
||||
index d852c80..c3c0345 100644
|
||||
--- a/plugins/power/event/power-event-control.cpp
|
||||
+++ b/plugins/power/event/power-event-control.cpp
|
||||
@@ -157,7 +157,7 @@ void PowerEventControl::on_button_changed(PowerEvent evnet)
|
||||
|
||||
switch (evnet)
|
||||
{
|
||||
- case POWER_EVENT_PRESSED_POWEROFF:
|
||||
+ case POWER_EVENT_RELEASE_POWEROFF:
|
||||
{
|
||||
action = PowerAction(this->power_settings_->get_enum(POWER_SCHEMA_BUTTON_POWER_ACTION));
|
||||
PowerSave::get_instance()->do_save(action, error);
|
||||
diff --git a/plugins/power/power-manager.cpp b/plugins/power/power-manager.cpp
|
||||
index cf5d8d5..e1f90d2 100644
|
||||
--- a/plugins/power/power-manager.cpp
|
||||
+++ b/plugins/power/power-manager.cpp
|
||||
@@ -188,7 +188,7 @@ void PowerManager::SetEventAction(gint32 event,
|
||||
|
||||
switch (event)
|
||||
{
|
||||
- case PowerEvent::POWER_EVENT_PRESSED_POWEROFF:
|
||||
+ case PowerEvent::POWER_EVENT_RELEASE_POWEROFF:
|
||||
result = this->power_settings_->set_enum(POWER_SCHEMA_BUTTON_POWER_ACTION, action);
|
||||
break;
|
||||
case PowerEvent::POWER_EVENT_PRESSED_SLEEP:
|
||||
@@ -225,7 +225,7 @@ void PowerManager::GetEventAction(gint32 event,
|
||||
|
||||
switch (event)
|
||||
{
|
||||
- case PowerEvent::POWER_EVENT_PRESSED_POWEROFF:
|
||||
+ case PowerEvent::POWER_EVENT_RELEASE_POWEROFF:
|
||||
action = this->power_settings_->get_enum(POWER_SCHEMA_BUTTON_POWER_ACTION);
|
||||
break;
|
||||
case PowerEvent::POWER_EVENT_PRESSED_SLEEP:
|
||||
@@ -428,7 +428,7 @@ void PowerManager::on_settings_changed(const Glib::ustring& key)
|
||||
this->EventActionChanged_signal.emit(PowerEvent::POWER_EVENT_PRESSED_HIBERNATE);
|
||||
break;
|
||||
case CONNECT(POWER_SCHEMA_BUTTON_POWER_ACTION, _hash):
|
||||
- this->EventActionChanged_signal.emit(PowerEvent::POWER_EVENT_PRESSED_POWEROFF);
|
||||
+ this->EventActionChanged_signal.emit(PowerEvent::POWER_EVENT_RELEASE_POWEROFF);
|
||||
break;
|
||||
case CONNECT(POWER_SCHEMA_LID_CLOSED_ACTION, _hash):
|
||||
this->EventActionChanged_signal.emit(PowerEvent::POWER_EVENT_LID_CLOSED);
|
||||
diff --git a/plugins/power/power-utils.cpp b/plugins/power/power-utils.cpp
|
||||
index f04670e..a55b6df 100644
|
||||
--- a/plugins/power/power-utils.cpp
|
||||
+++ b/plugins/power/power-utils.cpp
|
||||
@@ -77,8 +77,8 @@ std::string PowerUtils::event_enum2str(uint32_t event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
- case PowerEvent::POWER_EVENT_PRESSED_POWEROFF:
|
||||
- return "power off pressed";
|
||||
+ case PowerEvent::POWER_EVENT_RELEASE_POWEROFF:
|
||||
+ return "power off release";
|
||||
case PowerEvent::POWER_EVENT_PRESSED_SLEEP:
|
||||
return "sleep pressed";
|
||||
case PowerEvent::POWER_EVENT_PRESSED_SUSPEND:
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
From 3cc2fdcd60239c91bf974238d3e7f9afd1388e82 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Wed, 23 Aug 2023 09:35:51 +0800
|
||||
Subject: [PATCH] fix(power):Fix related project build with power event param
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配关联项目使用电源参数编译
|
||||
|
||||
Related #11422
|
||||
---
|
||||
include/power-i.h | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/include/power-i.h b/include/power-i.h
|
||||
index ace2ec6..52194d0 100644
|
||||
--- a/include/power-i.h
|
||||
+++ b/include/power-i.h
|
||||
@@ -67,6 +67,8 @@ extern "C"
|
||||
|
||||
enum PowerEvent
|
||||
{
|
||||
+ // 按下关机键 该参数将在后续的版本中废弃
|
||||
+ POWER_EVENT_PRESSED_POWEROFF = 0,
|
||||
// 释放关机键
|
||||
POWER_EVENT_RELEASE_POWEROFF = 0,
|
||||
// 按下睡眠键
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,112 +0,0 @@
|
||||
From a3d23ef293d4917395833ead79e8ce9c0a1bcdaf Mon Sep 17 00:00:00 2001
|
||||
From: wangtaozhi <wangtaozhi@kylinsec.com.cn>
|
||||
Date: Sat, 10 Jun 2023 12:02:17 +0800
|
||||
Subject: [PATCH] fix(systeminfo): Adjusting the reading method of cpu
|
||||
information,Resolve program crash issue when exiting the program
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 调整cup信息读取方式
|
||||
- 解决程序退出时连接wm_window_changed_信号的对象已经析构导致程序崩溃问题
|
||||
|
||||
Fixes #6911
|
||||
---
|
||||
plugins/keybinding/system-shortcut.h | 2 +-
|
||||
plugins/systeminfo/systeminfo-hardware.cpp | 33 +++++++++++++++++-----
|
||||
plugins/systeminfo/systeminfo-hardware.h | 2 ++
|
||||
3 files changed, 29 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/plugins/keybinding/system-shortcut.h b/plugins/keybinding/system-shortcut.h
|
||||
index 367f33a..b6f3a7d 100644
|
||||
--- a/plugins/keybinding/system-shortcut.h
|
||||
+++ b/plugins/keybinding/system-shortcut.h
|
||||
@@ -39,7 +39,7 @@ struct SystemShortCut
|
||||
sigc::connection connection;
|
||||
};
|
||||
|
||||
-class SystemShortCuts
|
||||
+class SystemShortCuts: public sigc::trackable
|
||||
{
|
||||
public:
|
||||
SystemShortCuts();
|
||||
diff --git a/plugins/systeminfo/systeminfo-hardware.cpp b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
index 66b7b49..7001b86 100644
|
||||
--- a/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
+++ b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
@@ -26,6 +26,8 @@ namespace Kiran
|
||||
#define CPUINFO_FILE "/proc/cpuinfo"
|
||||
#define CPUINFO_KEY_DELIMITER ':'
|
||||
#define CPUINFO_KEY_MODEL "model name"
|
||||
+//龙芯cpuinfo中为大写
|
||||
+#define CPUINFO_KEY_MODEL_LS "Model Name"
|
||||
#define CPUINFO_KEY_PROCESSOR "processor"
|
||||
|
||||
#define MEMINFO_FILE "/proc/meminfo"
|
||||
@@ -82,18 +84,31 @@ HardwareInfo SystemInfoHardware::get_hardware_info()
|
||||
return hardware_info;
|
||||
}
|
||||
|
||||
-CPUInfo SystemInfoHardware::get_cpu_info()
|
||||
+CPUInfo SystemInfoHardware::merge_cpu_infos(const std::vector<CPUInfo> &cpu_infos)
|
||||
{
|
||||
- auto cpu_info = this->get_cpu_info_by_cmd();
|
||||
-
|
||||
- if (cpu_info.cores_number == 0)
|
||||
+ CPUInfo cpu_info;
|
||||
+ for(auto& iter : cpu_infos)
|
||||
{
|
||||
- cpu_info = this->read_cpu_info_by_conf();
|
||||
+ if(cpu_info.model.empty())
|
||||
+ {
|
||||
+ cpu_info.model = iter.model;
|
||||
+ }
|
||||
+ if(cpu_info.cores_number == 0)
|
||||
+ {
|
||||
+ cpu_info.cores_number = iter.cores_number;
|
||||
+ }
|
||||
}
|
||||
-
|
||||
return cpu_info;
|
||||
}
|
||||
|
||||
+CPUInfo SystemInfoHardware::get_cpu_info()
|
||||
+{
|
||||
+ std::vector<CPUInfo> cpu_infos;
|
||||
+ cpu_infos.push_back(this->get_cpu_info_by_cmd());
|
||||
+ cpu_infos.push_back(this->read_cpu_info_by_conf());
|
||||
+ return this->merge_cpu_infos(cpu_infos);
|
||||
+}
|
||||
+
|
||||
CPUInfo SystemInfoHardware::get_cpu_info_by_cmd()
|
||||
{
|
||||
// 低版本不支持-J选项
|
||||
@@ -140,7 +155,11 @@ CPUInfo SystemInfoHardware::read_cpu_info_by_conf()
|
||||
{
|
||||
CPUInfo cpu_info;
|
||||
auto cpu_maps = this->parse_info_file(CPUINFO_FILE, CPUINFO_KEY_DELIMITER);
|
||||
-
|
||||
+ //适配龙芯架构
|
||||
+ if(cpu_info.model.empty())
|
||||
+ {
|
||||
+ cpu_info.model = cpu_maps[CPUINFO_KEY_MODEL_LS];
|
||||
+ }
|
||||
cpu_info.model = cpu_maps[CPUINFO_KEY_MODEL];
|
||||
if (cpu_maps.find(CPUINFO_KEY_PROCESSOR) != cpu_maps.end())
|
||||
{
|
||||
diff --git a/plugins/systeminfo/systeminfo-hardware.h b/plugins/systeminfo/systeminfo-hardware.h
|
||||
index 7aa25c4..2e95382 100644
|
||||
--- a/plugins/systeminfo/systeminfo-hardware.h
|
||||
+++ b/plugins/systeminfo/systeminfo-hardware.h
|
||||
@@ -112,6 +112,8 @@ private:
|
||||
CPUInfo get_cpu_info_by_cmd();
|
||||
// 如果命令获取失败,则直接读取配置文件
|
||||
CPUInfo read_cpu_info_by_conf();
|
||||
+ // 合并读取信息
|
||||
+ CPUInfo merge_cpu_infos(const std::vector<CPUInfo> &cpu_infos);
|
||||
|
||||
MemInfo get_mem_info();
|
||||
void set_env();
|
||||
--
|
||||
2.40.1.windows.1
|
||||
|
||||
@ -1,110 +0,0 @@
|
||||
From 36c58d7db48eb88ad53f7ff4e142e4c1b6fd84cb Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Wed, 6 Sep 2023 12:00:30 +0800
|
||||
Subject: [PATCH] fix(systeminfo):Fix to get pci info for multiple device
|
||||
subclass
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 适配多个设备子类型的pci信息获取
|
||||
---
|
||||
CMakeLists.txt | 4 +--
|
||||
plugins/systeminfo/systeminfo-hardware.cpp | 31 +++++++++++++---------
|
||||
2 files changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 18a370e..f314b3d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -16,7 +16,7 @@ pkg_search_module(GIOUNIX REQUIRED gio-unix-2.0)
|
||||
pkg_search_module(LIBXML2 REQUIRED libxml++-2.6)
|
||||
pkg_search_module(KLOG_GTK3 REQUIRED klog-gtk3)
|
||||
pkg_search_module(JSONCPP REQUIRED jsoncpp)
|
||||
-pkg_search_module(GTEST REQUIRED gtest)
|
||||
+# pkg_search_module(GTEST REQUIRED gtest)
|
||||
pkg_search_module(FMT REQUIRED fmt)
|
||||
pkg_search_module(CRYPTOPP REQUIRED cryptopp)
|
||||
|
||||
@@ -57,4 +57,4 @@ add_subdirectory(data)
|
||||
add_subdirectory(lib)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(plugins)
|
||||
-add_subdirectory(test)
|
||||
+# add_subdirectory(test)
|
||||
diff --git a/plugins/systeminfo/systeminfo-hardware.cpp b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
index bc4aaa9..3cc11fb 100644
|
||||
--- a/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
+++ b/plugins/systeminfo/systeminfo-hardware.cpp
|
||||
@@ -85,16 +85,16 @@ HardwareInfo SystemInfoHardware::get_hardware_info()
|
||||
return hardware_info;
|
||||
}
|
||||
|
||||
-CPUInfo SystemInfoHardware::merge_cpu_infos(const std::vector<CPUInfo> &cpu_infos)
|
||||
+CPUInfo SystemInfoHardware::merge_cpu_infos(const std::vector<CPUInfo>& cpu_infos)
|
||||
{
|
||||
CPUInfo cpu_info;
|
||||
- for(auto& iter : cpu_infos)
|
||||
+ for (auto& iter : cpu_infos)
|
||||
{
|
||||
- if(cpu_info.model.empty())
|
||||
+ if (cpu_info.model.empty())
|
||||
{
|
||||
cpu_info.model = iter.model;
|
||||
}
|
||||
- if(cpu_info.cores_number == 0)
|
||||
+ if (cpu_info.cores_number == 0)
|
||||
{
|
||||
cpu_info.cores_number = iter.cores_number;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ CPUInfo SystemInfoHardware::read_cpu_info_by_conf()
|
||||
CPUInfo cpu_info;
|
||||
auto cpu_maps = this->parse_info_file(CPUINFO_FILE, CPUINFO_KEY_DELIMITER);
|
||||
//适配龙芯架构
|
||||
- if(cpu_info.model.empty())
|
||||
+ if (cpu_info.model.empty())
|
||||
{
|
||||
cpu_info.model = cpu_maps[CPUINFO_KEY_MODEL_LS];
|
||||
}
|
||||
@@ -359,15 +359,13 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas
|
||||
RETURN_VAL_IF_TRUE(full_class_ids.size() == 0, KVList());
|
||||
|
||||
// 根据full_class_id列表获取设备相关信息
|
||||
+ std::string full_outputs;
|
||||
+ for (auto& full_class_id : full_class_ids)
|
||||
{
|
||||
std::string cmd_output;
|
||||
std::vector<std::string> argv{PCIINFO_CMD, "-vmm"};
|
||||
-
|
||||
- for (auto& full_class_id : full_class_ids)
|
||||
- {
|
||||
- argv.push_back("-d");
|
||||
- argv.push_back(fmt::format("::{:04x}", full_class_id));
|
||||
- }
|
||||
+ argv.push_back("-d");
|
||||
+ argv.push_back(fmt::format("::{:04x}", full_class_id));
|
||||
|
||||
KLOG_DEBUG("cmdline: %s.", StrUtils::join(argv, " ").c_str());
|
||||
try
|
||||
@@ -383,8 +381,17 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas
|
||||
KLOG_WARNING("%s", e.what().c_str());
|
||||
return KVList();
|
||||
}
|
||||
- return this->format_to_kv_list(cmd_output);
|
||||
+
|
||||
+ full_outputs.append(cmd_output);
|
||||
}
|
||||
+
|
||||
+ if (full_outputs.empty())
|
||||
+ {
|
||||
+ KLOG_WARNING("Get empty pci info calss id:%d.", major_class_id);
|
||||
+ return KVList();
|
||||
+ }
|
||||
+
|
||||
+ return this->format_to_kv_list(full_outputs);
|
||||
}
|
||||
|
||||
KVList SystemInfoHardware::format_to_kv_list(const std::string& contents)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
228
0001-fix-xsettings-Fix-font-enlargement-on-4K-screen.patch
Normal file
228
0001-fix-xsettings-Fix-font-enlargement-on-4K-screen.patch
Normal file
@ -0,0 +1,228 @@
|
||||
From a3dad4d3da1bc6eaa15e811494b190d7d191a615 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Tue, 19 Dec 2023 21:01:29 +0800
|
||||
Subject: [PATCH] fix(xsettings): Fix font enlargement on 4K screen
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复4K屏幕下字体变大问题
|
||||
|
||||
Related #24084
|
||||
---
|
||||
...om.kylinsec.kiran.xsettings.gschema.xml.in | 4 ++
|
||||
include/xsettings-i.h | 3 +-
|
||||
plugins/xsettings/xsettings-manager.cpp | 50 +++++++++++--------
|
||||
plugins/xsettings/xsettings-manager.h | 2 +
|
||||
plugins/xsettings/xsettings-utils.cpp | 5 ++
|
||||
plugins/xsettings/xsettings-utils.h | 2 +
|
||||
plugins/xsettings/xsettings-xresource.cpp | 1 +
|
||||
po/zh_CN.po | 5 ++
|
||||
8 files changed, 51 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
index 18fa7ba..532f006 100644
|
||||
--- a/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
+++ b/data/schemas/com.kylinsec.kiran.xsettings.gschema.xml.in
|
||||
@@ -61,6 +61,10 @@
|
||||
<default>-1</default>
|
||||
<description>Resolution for Xft, in 1024 * dots/inch. -1 to use default value. Do not modify it manually.</description>
|
||||
</key>
|
||||
+ <key name="font-dpi" type="d">
|
||||
+ <default>96.00</default>
|
||||
+ <description>The resolution used for converting font sizes to pixel sizes, in dots per inch.</description>
|
||||
+ </key>
|
||||
<key name="gtk-cursor-theme-name" type="s">
|
||||
<default>'Kiran'</default>
|
||||
<description>Name of the cursor theme.</description>
|
||||
diff --git a/include/xsettings-i.h b/include/xsettings-i.h
|
||||
index a81ff90..51aacd8 100644
|
||||
--- a/include/xsettings-i.h
|
||||
+++ b/include/xsettings-i.h
|
||||
@@ -41,6 +41,7 @@ extern "C"
|
||||
#define XSETTINGS_SCHEMA_XFT_HINT_STYLE "xft-hint-style"
|
||||
#define XSETTINGS_SCHEMA_XFT_RGBA "xft-rgba"
|
||||
#define XSETTINGS_SCHEMA_XFT_DPI "xft-dpi"
|
||||
+#define XSETTINGS_SCHEMA_FONT_DPI "font-dpi"
|
||||
|
||||
#define XSETTINGS_SCHEMA_GTK_CURSOR_THEME_NAME "gtk-cursor-theme-name"
|
||||
#define XSETTINGS_SCHEMA_GTK_CURSOR_THEME_SIZE "gtk-cursor-theme-size"
|
||||
@@ -114,4 +115,4 @@ extern "C"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
-#endif
|
||||
\ No newline at end of file
|
||||
+#endif
|
||||
diff --git a/plugins/xsettings/xsettings-manager.cpp b/plugins/xsettings/xsettings-manager.cpp
|
||||
index c4fafdd..c6fb134 100644
|
||||
--- a/plugins/xsettings/xsettings-manager.cpp
|
||||
+++ b/plugins/xsettings/xsettings-manager.cpp
|
||||
@@ -271,6 +271,7 @@ void XSettingsManager::settings_changed(const Glib::ustring &key, bool is_notify
|
||||
case CONNECT(XSETTINGS_SCHEMA_WINDOW_SCALING_FACTOR, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_WINDOW_SCALING_FACTOR_QT_SYNC, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_XFT_DPI, _hash):
|
||||
+ case CONNECT(XSETTINGS_SCHEMA_FONT_DPI, _hash):
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -283,6 +284,7 @@ void XSettingsManager::settings_changed(const Glib::ustring &key, bool is_notify
|
||||
{
|
||||
case CONNECT(XSETTINGS_SCHEMA_WINDOW_SCALING_FACTOR, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_GTK_CURSOR_THEME_SIZE, _hash):
|
||||
+ case CONNECT(XSETTINGS_SCHEMA_FONT_DPI, _hash):
|
||||
this->scale_settings();
|
||||
break;
|
||||
case CONNECT(XSETTINGS_SCHEMA_XFT_RGBA, _hash):
|
||||
@@ -300,12 +302,22 @@ void XSettingsManager::settings_changed(const Glib::ustring &key, bool is_notify
|
||||
}
|
||||
}
|
||||
|
||||
+double XSettingsManager::get_optimize_dpi()
|
||||
+{
|
||||
+ double dpi = get_font_dpi();
|
||||
+ if (dpi < EPS)
|
||||
+ {
|
||||
+ dpi = XSettingsUtils::get_dpi_from_x_server();
|
||||
+ }
|
||||
+ return dpi;
|
||||
+}
|
||||
+
|
||||
void XSettingsManager::scale_settings()
|
||||
{
|
||||
auto scale = this->get_window_scale();
|
||||
- auto dpi = XSettingsUtils::get_dpi_from_x_server();
|
||||
+ auto dpi = this->get_optimize_dpi();
|
||||
int32_t unscaled_dpi = int32_t(dpi * 1024);
|
||||
- int32_t scaled_dpi = int32_t(CLAMP(dpi * scale, DPI_LOW_REASONABLE_VALUE, DPI_HIGH_REASONABLE_VALUE) * 1024);
|
||||
+ int32_t scaled_dpi = int32_t(XSettingsUtils::format_scale_dpi(scale, dpi) * 1024);
|
||||
auto scaled_cursor_size = this->get_gtk_cursor_theme_size() * scale;
|
||||
|
||||
this->registry_.update(XSETTINGS_REGISTRY_PROP_GDK_WINDOW_SCALING_FACTOR, scale);
|
||||
@@ -329,32 +341,30 @@ void XSettingsManager::scale_change_workarounds(int32_t scale)
|
||||
/* 第一次初始化时缩放率是没有变化的,所以不应该重启底部面板、文件管理器和窗口管理器,
|
||||
这样会导致进入会话时出现屏幕刷新的视觉效果,而且底部面板和文件管理器崩溃的概率较大*/
|
||||
|
||||
- if (is_init)
|
||||
+ // 如果开启QT缩放同步,则将缩放值同步到QT缩放相关的环境变量
|
||||
+ if (this->get_window_scaling_factor_qt_sync())
|
||||
{
|
||||
- // 如果开启QT缩放同步,则将缩放值同步到QT缩放相关的环境变量
|
||||
- if (this->get_window_scaling_factor_qt_sync())
|
||||
+ std::string error;
|
||||
+ if (!XSettingsUtils::update_user_env_variable("QT_AUTO_SCREEN_SCALE_FACTOR", "0", error))
|
||||
{
|
||||
- std::string error;
|
||||
- if (!XSettingsUtils::update_user_env_variable("QT_AUTO_SCREEN_SCALE_FACTOR", "0", error))
|
||||
- {
|
||||
- KLOG_WARNING_XSETTINGS("There was a problem when setting QT_AUTO_SCREEN_SCALE_FACTOR=0: %s", error.c_str());
|
||||
- }
|
||||
+ KLOG_WARNING_XSETTINGS("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字体大小放大,字体将会放大过多。
|
||||
+ /* 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_XSETTINGS("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_XSETTINGS("There was a problem when setting QT_FONT_DPI=96: %s", error.c_str());
|
||||
- }
|
||||
+ if (!XSettingsUtils::update_user_env_variable("QT_SCALE_FACTOR", scale == 2 ? "2" : "1", error))
|
||||
+ {
|
||||
+ KLOG_WARNING_XSETTINGS("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_XSETTINGS("There was a problem when setting QT_FONT_DPI=96: %s", error.c_str());
|
||||
}
|
||||
}
|
||||
- else
|
||||
+
|
||||
+ if (!is_init)
|
||||
{
|
||||
// 理想的情况是marco/mate-panel/caja监控缩放因子的变化而自动调整自己的大小,
|
||||
// 但实际上没有实现这个功能,所以当窗口缩放因子发生变化时重置它们
|
||||
diff --git a/plugins/xsettings/xsettings-manager.h b/plugins/xsettings/xsettings-manager.h
|
||||
index ce69ef9..0309045 100644
|
||||
--- a/plugins/xsettings/xsettings-manager.h
|
||||
+++ b/plugins/xsettings/xsettings-manager.h
|
||||
@@ -53,6 +53,7 @@ public:
|
||||
std::string get_xft_hint_style() { return this->xsettings_settings_->get_string(XSETTINGS_SCHEMA_XFT_HINT_STYLE); }
|
||||
std::string get_xft_rgba() { return this->xsettings_settings_->get_string(XSETTINGS_SCHEMA_XFT_RGBA); }
|
||||
int32_t get_xft_dpi() { return this->xsettings_settings_->get_int(XSETTINGS_SCHEMA_XFT_DPI); }
|
||||
+ double get_font_dpi() { return this->xsettings_settings_->get_double(XSETTINGS_SCHEMA_FONT_DPI); }
|
||||
std::string get_gtk_cursor_theme_name() { return this->xsettings_settings_->get_string(XSETTINGS_SCHEMA_GTK_CURSOR_THEME_NAME); }
|
||||
int32_t get_gtk_cursor_theme_size() { return this->xsettings_settings_->get_int(XSETTINGS_SCHEMA_GTK_CURSOR_THEME_SIZE); }
|
||||
int32_t get_window_scaling_factor() { return this->xsettings_settings_->get_int(XSETTINGS_SCHEMA_WINDOW_SCALING_FACTOR); }
|
||||
@@ -63,6 +64,7 @@ private:
|
||||
|
||||
void load_from_settings();
|
||||
void settings_changed(const Glib::ustring &key, bool is_notify);
|
||||
+ double get_optimize_dpi();
|
||||
void scale_settings();
|
||||
void scale_change_workarounds(int32_t scale);
|
||||
void on_screen_changed();
|
||||
diff --git a/plugins/xsettings/xsettings-utils.cpp b/plugins/xsettings/xsettings-utils.cpp
|
||||
index 36af5aa..9d9505d 100644
|
||||
--- a/plugins/xsettings/xsettings-utils.cpp
|
||||
+++ b/plugins/xsettings/xsettings-utils.cpp
|
||||
@@ -142,4 +142,9 @@ double XSettingsUtils::dpi_from_pixels_and_mm(int pixels, int mm)
|
||||
|
||||
return dpi;
|
||||
}
|
||||
+
|
||||
+double XSettingsUtils::format_scale_dpi(int scale, double dpi)
|
||||
+{
|
||||
+ return double(CLAMP(dpi * scale, DPI_LOW_REASONABLE_VALUE, DPI_HIGH_REASONABLE_VALUE));
|
||||
+}
|
||||
} // namespace Kiran
|
||||
diff --git a/plugins/xsettings/xsettings-utils.h b/plugins/xsettings/xsettings-utils.h
|
||||
index 8e77e5a..a8e3f2a 100644
|
||||
--- a/plugins/xsettings/xsettings-utils.h
|
||||
+++ b/plugins/xsettings/xsettings-utils.h
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
const std::string &value,
|
||||
std::string &error);
|
||||
|
||||
+ static double format_scale_dpi(int32_t scale, double dpi);
|
||||
+
|
||||
private:
|
||||
static double dpi_from_pixels_and_mm(int pixels, int mm);
|
||||
};
|
||||
diff --git a/plugins/xsettings/xsettings-xresource.cpp b/plugins/xsettings/xsettings-xresource.cpp
|
||||
index 284a67a..d66913a 100644
|
||||
--- a/plugins/xsettings/xsettings-xresource.cpp
|
||||
+++ b/plugins/xsettings/xsettings-xresource.cpp
|
||||
@@ -120,6 +120,7 @@ void XSettingsXResource::on_xsettings_changed(const std::string &key)
|
||||
case CONNECT(XSETTINGS_SCHEMA_XFT_HINTING, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_XFT_HINT_STYLE, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_XFT_RGBA, _hash):
|
||||
+ case CONNECT(XSETTINGS_SCHEMA_XFT_DPI, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_GTK_CURSOR_THEME_NAME, _hash):
|
||||
case CONNECT(XSETTINGS_SCHEMA_GTK_CURSOR_THEME_SIZE, _hash):
|
||||
this->update_properties();
|
||||
diff --git a/po/zh_CN.po b/po/zh_CN.po
|
||||
index 94b1e0a..ae7a191 100644
|
||||
--- a/po/zh_CN.po
|
||||
+++ b/po/zh_CN.po
|
||||
@@ -570,6 +570,11 @@ msgid ""
|
||||
"applications."
|
||||
msgstr "此设置确定MATE是否控制QT应用程序的比例因子。"
|
||||
|
||||
+#: ../data/com.kylinsec.kiran.xsettings.gschema.xml.in.h:41
|
||||
+msgid ""
|
||||
+"The resolution used for converting font sizes to pixel sizes, in dots per inch."
|
||||
+msgstr "用于将字体大小转换为像素大小的分辨率,单位为每英寸点数。"
|
||||
+
|
||||
#: ../data/com.kylinsec.Kiran.SystemDaemon.Accounts.policy.in.h:1
|
||||
msgid "Change your own user data"
|
||||
msgstr "更改本用户数据"
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,63 +0,0 @@
|
||||
From b4411b9fd05760433c8b15b3a9baa1dbe788a1f0 Mon Sep 17 00:00:00 2001
|
||||
From: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
Date: Thu, 10 Aug 2023 15:55:34 +0800
|
||||
Subject: [PATCH] fix(xsettings): Fix the problem that variable serial isn't
|
||||
increased when xsettings registry property is updated.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复当xsettings registry属性变化时serial变量未递增问题
|
||||
|
||||
Related #11637
|
||||
|
||||
Signed-off-by: tangjie02 <tangjie02@kylinsec.com.cn>
|
||||
---
|
||||
plugins/xsettings/xsettings-registry.cpp | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/plugins/xsettings/xsettings-registry.cpp b/plugins/xsettings/xsettings-registry.cpp
|
||||
index 13472de..4d76599 100644
|
||||
--- a/plugins/xsettings/xsettings-registry.cpp
|
||||
+++ b/plugins/xsettings/xsettings-registry.cpp
|
||||
@@ -209,19 +209,19 @@ bool XSettingsRegistry::init()
|
||||
|
||||
bool XSettingsRegistry::update(const std::string &name, int32_t value)
|
||||
{
|
||||
- auto var = std::make_shared<XSettingsPropertyInt>(name, value);
|
||||
+ auto var = std::make_shared<XSettingsPropertyInt>(name, value, this->serial_);
|
||||
return this->update(var);
|
||||
}
|
||||
|
||||
bool XSettingsRegistry::update(const std::string &name, const Glib::ustring &value)
|
||||
{
|
||||
- auto var = std::make_shared<XSettingsPropertyString>(name, value.raw());
|
||||
+ auto var = std::make_shared<XSettingsPropertyString>(name, value.raw(), this->serial_);
|
||||
return this->update(var);
|
||||
}
|
||||
|
||||
bool XSettingsRegistry::update(const std::string &name, const XSettingsColor &value)
|
||||
{
|
||||
- auto var = std::make_shared<XSettingsPropertyColor>(name, value);
|
||||
+ auto var = std::make_shared<XSettingsPropertyColor>(name, value, this->serial_);
|
||||
return this->update(var);
|
||||
}
|
||||
|
||||
@@ -282,6 +282,7 @@ bool XSettingsRegistry::notify()
|
||||
data.append(std::string("\0\0\0", 3));
|
||||
data.append(std::string((char *)&this->serial_, 4));
|
||||
data.append(std::string((char *)&nsettings, 4));
|
||||
+ ++this->serial_;
|
||||
|
||||
// 填充body
|
||||
for (const auto &iter : this->properties_)
|
||||
@@ -310,4 +311,4 @@ char XSettingsRegistry::byte_order()
|
||||
return (*(char *)&myint == 1) ? MSBFirst : LSBFirst;
|
||||
}
|
||||
|
||||
-} // namespace Kiran
|
||||
\ No newline at end of file
|
||||
+} // namespace Kiran
|
||||
--
|
||||
2.36.1
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 57ec3f3a1c417c3f6d98eee6e466ad1715cbf36c Mon Sep 17 00:00:00 2001
|
||||
From: yangfeng <yangfeng@kylinsec.com.cn>
|
||||
Date: Fri, 19 Jan 2024 11:32:09 +0800
|
||||
Subject: [PATCH] fix(power-tray):Fixed an issue where the laptop tray battery
|
||||
icon is not the same size as other icons.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复笔记本托盘电池图标与其他图标大小不一致问题
|
||||
|
||||
- Related #25531
|
||||
---
|
||||
plugins/power/tray/power-tray.cpp | 20 +++++++++++++++-----
|
||||
1 file changed, 15 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/plugins/power/tray/power-tray.cpp b/plugins/power/tray/power-tray.cpp
|
||||
index dee86e8..6c96069 100644
|
||||
--- a/plugins/power/tray/power-tray.cpp
|
||||
+++ b/plugins/power/tray/power-tray.cpp
|
||||
@@ -89,9 +89,9 @@ void PowerTray::update_status_icon()
|
||||
}
|
||||
else
|
||||
{
|
||||
- // this->icon_pixbuf_ = this->get_pixbuf_by_icon_name(icon_name);
|
||||
- // gtk_status_icon_set_from_pixbuf(this->status_icon_, this->icon_pixbuf_->gobj());
|
||||
- gtk_status_icon_set_from_icon_name(this->status_icon_, icon_name.c_str());
|
||||
+ this->icon_pixbuf_ = this->get_pixbuf_by_icon_name(icon_name);
|
||||
+ gtk_status_icon_set_from_pixbuf(this->status_icon_, this->icon_pixbuf_->gobj());
|
||||
+ // gtk_status_icon_set_from_icon_name(this->status_icon_, icon_name.c_str());
|
||||
gtk_status_icon_set_visible(this->status_icon_, true);
|
||||
}
|
||||
|
||||
@@ -167,8 +167,12 @@ std::shared_ptr<PowerUPowerDevice> PowerTray::get_device_for_tray(const std::vec
|
||||
Glib::RefPtr<Gdk::Pixbuf> PowerTray::get_pixbuf_by_icon_name(const std::string& icon_name)
|
||||
{
|
||||
auto theme_name = Gtk::Settings::get_default()->property_gtk_theme_name().get_value();
|
||||
- bool was_symbolic = false;
|
||||
+ bool was_symbolic = true;
|
||||
Gdk::RGBA fg_color;
|
||||
+ Gdk::RGBA success_color;
|
||||
+ Gdk::RGBA warning_color;
|
||||
+ Gdk::RGBA error_color;
|
||||
+
|
||||
|
||||
if (theme_name.empty())
|
||||
{
|
||||
@@ -187,9 +191,15 @@ Glib::RefPtr<Gdk::Pixbuf> PowerTray::get_pixbuf_by_icon_name(const std::string&
|
||||
|
||||
auto style_context = Gtk::StyleContext::create();
|
||||
style_context->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
+ style_context->lookup_color("theme_fg_color", fg_color);
|
||||
+ style_context->lookup_color("success_color", success_color);
|
||||
+ style_context->lookup_color("warning_color", warning_color);
|
||||
+ style_context->lookup_color("error_color", error_color);
|
||||
+
|
||||
auto scale = Gdk::Window::get_default_root_window()->get_scale_factor();
|
||||
auto icon_info = Gtk::IconTheme::get_default()->lookup_icon(icon_name, 16, scale);
|
||||
- return icon_info.load_symbolic(style_context, was_symbolic);
|
||||
+
|
||||
+ return icon_info.load_symbolic(fg_color, success_color, warning_color, error_color, was_symbolic);
|
||||
}
|
||||
|
||||
std::string PowerTray::get_device_icon_name(std::shared_ptr<PowerUPowerDevice> upower_device)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
151
0004-fix-keybinding-Fix-shortcut-grab-in-system-and-conf-.patch
Normal file
151
0004-fix-keybinding-Fix-shortcut-grab-in-system-and-conf-.patch
Normal file
@ -0,0 +1,151 @@
|
||||
From 69256622020faad287372bb038e8267872e748e6 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Mon, 29 Jan 2024 15:22:21 +0800
|
||||
Subject: [PATCH] fix(keybinding):Fix shortcut grab in system and conf saved in
|
||||
custom
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 修复系统快捷键抓取和自定义快捷键配置保存
|
||||
|
||||
Related #25039
|
||||
---
|
||||
plugins/keybinding/custom-shortcut.cpp | 14 ++++++++++++
|
||||
plugins/keybinding/media-keys-manager.cpp | 28 +++++++++++++++++++----
|
||||
plugins/keybinding/media-keys-manager.h | 2 ++
|
||||
plugins/keybinding/shortcut-helper.h | 1 -
|
||||
4 files changed, 40 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/plugins/keybinding/custom-shortcut.cpp b/plugins/keybinding/custom-shortcut.cpp
|
||||
index 1325946..4f8267a 100644
|
||||
--- a/plugins/keybinding/custom-shortcut.cpp
|
||||
+++ b/plugins/keybinding/custom-shortcut.cpp
|
||||
@@ -16,11 +16,13 @@
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkx.h>
|
||||
+#include "config.h"
|
||||
|
||||
#include "plugins/keybinding/shortcut-helper.h"
|
||||
|
||||
namespace Kiran
|
||||
{
|
||||
+#define KEYBINDING_CONF_DIR "kylinsec/" PROJECT_NAME "/keybinding"
|
||||
#define CUSTOM_SHORTCUT_FILE "custom_shortcut.ini"
|
||||
#define CUSTOM_KEYFILE_NAME "name"
|
||||
#define CUSTOM_KEYFILE_ACTION "action"
|
||||
@@ -253,6 +255,18 @@ void CustomShortCuts::change_and_save(std::shared_ptr<CustomShortCut> shortcut,
|
||||
|
||||
bool CustomShortCuts::save_to_file()
|
||||
{
|
||||
+ // 文件不存在则先尝试创建对应的目录
|
||||
+ if (!Glib::file_test(this->conf_file_path_, Glib::FILE_TEST_EXISTS))
|
||||
+ {
|
||||
+ auto dirname = Glib::path_get_dirname(this->conf_file_path_);
|
||||
+ if (g_mkdir_with_parents(dirname.c_str(),
|
||||
+ 0775) != 0)
|
||||
+ {
|
||||
+ KLOG_WARNING_KEYBINDING("Failed to create directory %s.", dirname.c_str());
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
this->keyfile_.save_to_file(this->conf_file_path_);
|
||||
return false;
|
||||
}
|
||||
diff --git a/plugins/keybinding/media-keys-manager.cpp b/plugins/keybinding/media-keys-manager.cpp
|
||||
index 135ae6d..f701695 100644
|
||||
--- a/plugins/keybinding/media-keys-manager.cpp
|
||||
+++ b/plugins/keybinding/media-keys-manager.cpp
|
||||
@@ -74,10 +74,7 @@ void MediaKeysManager::init_grab_keys()
|
||||
|
||||
for (auto &shortcut : system_shortcuts)
|
||||
{
|
||||
- if (shortcut.second->settings->property_schema_id() != MEDIAKEYS_SCHEMA_ID)
|
||||
- {
|
||||
- continue;
|
||||
- }
|
||||
+ CONTINUE_IF_FALSE(this->is_media_keys_shortcut(shortcut.second))
|
||||
|
||||
KeyState key_state = ShortCutHelper::get_keystate(shortcut.second->key_combination);
|
||||
|
||||
@@ -113,6 +110,23 @@ void MediaKeysManager::init_grab_keys()
|
||||
}
|
||||
}
|
||||
|
||||
+bool MediaKeysManager::is_media_keys_shortcut(std::shared_ptr<SystemShortCut> system_shortcut)
|
||||
+{
|
||||
+ if (!system_shortcut->settings)
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (system_shortcut->settings->property_schema_id() == MEDIAKEYS_SCHEMA_ID)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
bool MediaKeysManager::is_valid_key_event(XEvent *xev)
|
||||
{
|
||||
if (xev->type != KeyPress && xev->type != KeyRelease)
|
||||
@@ -184,6 +198,8 @@ GdkFilterReturn MediaKeysManager::window_event(GdkXEvent *gdk_event, GdkEvent *e
|
||||
|
||||
void MediaKeysManager::system_shortcut_added(std::shared_ptr<SystemShortCut> system_shortcut)
|
||||
{
|
||||
+ RETURN_IF_FALSE(this->is_media_keys_shortcut(system_shortcut));
|
||||
+
|
||||
auto iter = this->shortcuts_.find(system_shortcut->uid);
|
||||
if (iter != this->shortcuts_.end())
|
||||
{
|
||||
@@ -220,6 +236,8 @@ void MediaKeysManager::system_shortcut_added(std::shared_ptr<SystemShortCut> sys
|
||||
|
||||
void MediaKeysManager::system_shortcut_deleted(std::shared_ptr<SystemShortCut> system_shortcut)
|
||||
{
|
||||
+ RETURN_IF_FALSE(this->is_media_keys_shortcut(system_shortcut));
|
||||
+
|
||||
auto iter = this->shortcuts_.find(system_shortcut->uid);
|
||||
if (iter == this->shortcuts_.end())
|
||||
{
|
||||
@@ -246,6 +264,8 @@ void MediaKeysManager::system_shortcut_deleted(std::shared_ptr<SystemShortCut> s
|
||||
|
||||
void MediaKeysManager::system_shortcut_changed(std::shared_ptr<SystemShortCut> system_shortcut)
|
||||
{
|
||||
+ RETURN_IF_FALSE(this->is_media_keys_shortcut(system_shortcut));
|
||||
+
|
||||
auto iter = this->shortcuts_.find(system_shortcut->uid);
|
||||
if (iter == this->shortcuts_.end())
|
||||
{
|
||||
diff --git a/plugins/keybinding/media-keys-manager.h b/plugins/keybinding/media-keys-manager.h
|
||||
index aa6d154..ce08842 100644
|
||||
--- a/plugins/keybinding/media-keys-manager.h
|
||||
+++ b/plugins/keybinding/media-keys-manager.h
|
||||
@@ -51,6 +51,8 @@ private:
|
||||
|
||||
void init_grab_keys();
|
||||
|
||||
+ bool is_media_keys_shortcut(std::shared_ptr<SystemShortCut> system_shortcut);
|
||||
+
|
||||
bool is_valid_key_event(XEvent *xev);
|
||||
|
||||
void system_shortcut_added(std::shared_ptr<SystemShortCut> system_shortcut);
|
||||
diff --git a/plugins/keybinding/shortcut-helper.h b/plugins/keybinding/shortcut-helper.h
|
||||
index 1c4a727..0519b70 100644
|
||||
--- a/plugins/keybinding/shortcut-helper.h
|
||||
+++ b/plugins/keybinding/shortcut-helper.h
|
||||
@@ -26,7 +26,6 @@ namespace Kiran
|
||||
#define NULL_KEYSTATE KeyState()
|
||||
#define SHORTCUT_KIND_CUSTOM "Custom"
|
||||
#define SHORTCUT_KEYCOMB_DISABLE "disabled"
|
||||
-#define KEYBINDING_CONF_DIR "kylinsec/kiran/session-daemon/keybinding"
|
||||
|
||||
struct KeyState
|
||||
{
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From 9c52ab2daa4075e9b16819b8eb7f6dafad0d2c2b Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Wed, 31 Jan 2024 11:38:24 +0800
|
||||
Subject: [PATCH] fix(power):Fix dpms force level effective while state changed
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
-修复电源模式切换时屏幕状态显示
|
||||
|
||||
Related #24589
|
||||
---
|
||||
plugins/power/save/power-save-dpms.cpp | 13 +++++++++----
|
||||
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/plugins/power/save/power-save-dpms.cpp b/plugins/power/save/power-save-dpms.cpp
|
||||
index 94d7e7b..ab6b31a 100644
|
||||
--- a/plugins/power/save/power-save-dpms.cpp
|
||||
+++ b/plugins/power/save/power-save-dpms.cpp
|
||||
@@ -61,11 +61,12 @@ bool PowerSaveDpms::set_level(PowerDpmsLevel level)
|
||||
return false;
|
||||
}
|
||||
|
||||
- // dpms功能未开启
|
||||
+ // dpms功能未开启,执行开启操作
|
||||
if (!current_enabled)
|
||||
{
|
||||
- KLOG_WARNING_POWER("DPMS not enabled");
|
||||
- return false;
|
||||
+ KLOG_WARNING_POWER("DPMS default is not enabled then enable it");
|
||||
+ // DPMSEnable返回值只有成功,这里不需要处理失败操作
|
||||
+ DPMSEnable(this->xdisplay_);
|
||||
}
|
||||
|
||||
auto current_level = this->get_level();
|
||||
@@ -74,7 +75,11 @@ bool PowerSaveDpms::set_level(PowerDpmsLevel level)
|
||||
{
|
||||
state = this->level_enum2card(level);
|
||||
|
||||
- if (!DPMSForceLevel(this->xdisplay_, state))
|
||||
+ // 这里添加延迟,为了避免息屏后按键触发其它事件导致的亮屏
|
||||
+ g_usleep(1000 * 100);
|
||||
+
|
||||
+ // DPMSForceLevel返回值只有为1表示成功
|
||||
+ if (1 != DPMSForceLevel(this->xdisplay_, state))
|
||||
{
|
||||
KLOG_WARNING_POWER("Couldn't change DPMS mode");
|
||||
return false;
|
||||
--
|
||||
2.27.0
|
||||
|
||||
177
0006-feature-appearance-Add-support-reset-default-font.patch
Normal file
177
0006-feature-appearance-Add-support-reset-default-font.patch
Normal file
@ -0,0 +1,177 @@
|
||||
From f393efb6424a9d8f7352d2dbc0a6df174d8a2e55 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Wed, 21 Feb 2024 10:50:01 +0800
|
||||
Subject: [PATCH] feature(appearance):Add support reset default font
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 添加支持重置默认字体功能
|
||||
|
||||
Related #20203
|
||||
---
|
||||
include/error-i.h | 2 +
|
||||
lib/base/error.cpp | 2 +
|
||||
plugins/appearance/appearance-manager.cpp | 14 +++++++
|
||||
plugins/appearance/appearance-manager.h | 2 +
|
||||
...ylinsec.Kiran.SessionDaemon.Appearance.xml | 7 ++++
|
||||
plugins/appearance/font/appearance-font.cpp | 40 +++++++++++++++++++
|
||||
plugins/appearance/font/appearance-font.h | 1 +
|
||||
7 files changed, 68 insertions(+)
|
||||
|
||||
diff --git a/include/error-i.h b/include/error-i.h
|
||||
index 9a81d3c..1b73db5 100644
|
||||
--- a/include/error-i.h
|
||||
+++ b/include/error-i.h
|
||||
@@ -104,7 +104,9 @@ extern "C"
|
||||
ERROR_APPEARANCE_THEME_TYPE_INVALID = 0xA0100,
|
||||
ERROR_APPEARANCE_FONT_TYPE_INVALID_1,
|
||||
ERROR_APPEARANCE_FONT_TYPE_INVALID_2,
|
||||
+ ERROR_APPEARANCE_FONT_TYPE_INVALID_3,
|
||||
ERROR_APPEARANCE_FONT_TYPE_UNSUPPORTED,
|
||||
+ ERROR_APPEARANCE_RESET_FONT_FAILED,
|
||||
ERROR_APPEARANCE_SET_BACKGROUND_FAILED,
|
||||
ERROR_APPEARANCE_SET_LOCKSCREEN_BACKGROUND_FAILED,
|
||||
|
||||
diff --git a/lib/base/error.cpp b/lib/base/error.cpp
|
||||
index 341dfb5..e98d173 100644
|
||||
--- a/lib/base/error.cpp
|
||||
+++ b/lib/base/error.cpp
|
||||
@@ -239,6 +239,7 @@ std::string CCError::get_error_desc(CCErrorCode error_code, bool attach_error_co
|
||||
break;
|
||||
case CCErrorCode::ERROR_APPEARANCE_FONT_TYPE_INVALID_1:
|
||||
case CCErrorCode::ERROR_APPEARANCE_FONT_TYPE_INVALID_2:
|
||||
+ case CCErrorCode::ERROR_APPEARANCE_FONT_TYPE_INVALID_3:
|
||||
error_desc = _("Invalid font type.");
|
||||
break;
|
||||
case CCErrorCode::ERROR_APPEARANCE_FONT_TYPE_UNSUPPORTED:
|
||||
@@ -402,6 +403,7 @@ std::string CCError::get_error_desc(CCErrorCode error_code, bool attach_error_co
|
||||
case CCErrorCode::ERROR_DISPLAY_SAVE_CREATE_FILE_FAILED:
|
||||
case CCErrorCode::ERROR_DISPLAY_WRITE_CONF_FILE_FAILED:
|
||||
case CCErrorCode::ERROR_DISPLAY_NO_ENABLED_MONITOR:
|
||||
+ case CCErrorCode::ERROR_APPEARANCE_RESET_FONT_FAILED:
|
||||
case CCErrorCode::ERROR_APPEARANCE_SET_BACKGROUND_FAILED:
|
||||
case CCErrorCode::ERROR_APPEARANCE_SET_LOCKSCREEN_BACKGROUND_FAILED:
|
||||
case CCErrorCode::ERROR_SYSTEMINFO_JSON_ASSIGN_FAILED:
|
||||
diff --git a/plugins/appearance/appearance-manager.cpp b/plugins/appearance/appearance-manager.cpp
|
||||
index 4b67205..f1fc6fa 100644
|
||||
--- a/plugins/appearance/appearance-manager.cpp
|
||||
+++ b/plugins/appearance/appearance-manager.cpp
|
||||
@@ -113,6 +113,20 @@ void AppearanceManager::SetFont(gint32 type, const Glib::ustring& font, MethodIn
|
||||
invocation.ret();
|
||||
}
|
||||
|
||||
+void AppearanceManager::ResetFont(gint32 type, MethodInvocation& invocation)
|
||||
+{
|
||||
+ if (type < 0 || type >= int32_t(AppearanceFontType::APPEARANCE_FONT_TYPE_LAST))
|
||||
+ {
|
||||
+ DBUS_ERROR_REPLY_AND_RET(CCErrorCode::ERROR_APPEARANCE_FONT_TYPE_INVALID_3);
|
||||
+ }
|
||||
+
|
||||
+ if (!this->appearance_font_.reset_font(AppearanceFontType(type)))
|
||||
+ {
|
||||
+ DBUS_ERROR_REPLY_AND_RET(CCErrorCode::ERROR_APPEARANCE_RESET_FONT_FAILED);
|
||||
+ }
|
||||
+ invocation.ret();
|
||||
+}
|
||||
+
|
||||
void AppearanceManager::SetDesktopBackground(const Glib::ustring& desktop_background, MethodInvocation& invocation)
|
||||
{
|
||||
if (desktop_background != this->desktop_background_get() &&
|
||||
diff --git a/plugins/appearance/appearance-manager.h b/plugins/appearance/appearance-manager.h
|
||||
index 89ed9df..e6c4ab5 100644
|
||||
--- a/plugins/appearance/appearance-manager.h
|
||||
+++ b/plugins/appearance/appearance-manager.h
|
||||
@@ -48,6 +48,8 @@ protected:
|
||||
virtual void GetFont(gint32 type, MethodInvocation& invocation);
|
||||
// 设置类型为type的字体
|
||||
virtual void SetFont(gint32 type, const Glib::ustring& font, MethodInvocation& invocation);
|
||||
+ // 重置默认字体
|
||||
+ virtual void ResetFont(gint32 type, MethodInvocation& invocation);
|
||||
// 设置桌面背景
|
||||
virtual void SetDesktopBackground(const Glib::ustring& desktop_background, MethodInvocation& invocation);
|
||||
// 设置锁屏背景
|
||||
diff --git a/plugins/appearance/com.kylinsec.Kiran.SessionDaemon.Appearance.xml b/plugins/appearance/com.kylinsec.Kiran.SessionDaemon.Appearance.xml
|
||||
index 889ee87..71a67bc 100644
|
||||
--- a/plugins/appearance/com.kylinsec.Kiran.SessionDaemon.Appearance.xml
|
||||
+++ b/plugins/appearance/com.kylinsec.Kiran.SessionDaemon.Appearance.xml
|
||||
@@ -58,6 +58,13 @@
|
||||
<description>Set the font for the type.</description>
|
||||
</method>
|
||||
|
||||
+ <method name="ResetFont">
|
||||
+ <arg type="i" name="type" direction="in">
|
||||
+ <summary>The font type that contains application font, document font, desktop font and monospace font, etc.</summary>
|
||||
+ </arg>
|
||||
+ <description>Reset the font for the type.</description>
|
||||
+ </method>
|
||||
+
|
||||
<method name="SetDesktopBackground">
|
||||
<arg type="s" name="desktop_background" direction="in">
|
||||
<summary>File path of desktop background.</summary>
|
||||
diff --git a/plugins/appearance/font/appearance-font.cpp b/plugins/appearance/font/appearance-font.cpp
|
||||
index cb169d4..e56d572 100644
|
||||
--- a/plugins/appearance/font/appearance-font.cpp
|
||||
+++ b/plugins/appearance/font/appearance-font.cpp
|
||||
@@ -129,6 +129,46 @@ bool AppearanceFont::set_font(AppearanceFontType type, const std::string& font)
|
||||
return true;
|
||||
}
|
||||
|
||||
+bool AppearanceFont::reset_font(AppearanceFontType type)
|
||||
+{
|
||||
+ switch (type)
|
||||
+ {
|
||||
+ case APPEARANCE_FONT_TYPE_APPLICATION:
|
||||
+ {
|
||||
+ RETURN_VAL_IF_FALSE(this->xsettings_settings_, false);
|
||||
+ this->xsettings_settings_->reset(XSETTINGS_SCHEMA_GTK_FONT_NAME);
|
||||
+ break;
|
||||
+ }
|
||||
+ case APPEARANCE_FONT_TYPE_DOCUMENT:
|
||||
+ {
|
||||
+ RETURN_VAL_IF_FALSE(this->interface_settings_, false);
|
||||
+ this->interface_settings_->reset(INTERFACE_KEY_DOCUMENT_FONT_NAME);
|
||||
+ break;
|
||||
+ }
|
||||
+ case APPEARANCE_FONT_TYPE_DESKTOP:
|
||||
+ {
|
||||
+ RETURN_VAL_IF_FALSE(this->caja_settings_, false);
|
||||
+ this->caja_settings_->reset(CAJA_SCHEMA_KEY_FONT);
|
||||
+ break;
|
||||
+ }
|
||||
+ case APPEARANCE_FONT_TYPE_WINDOW_TITLE:
|
||||
+ {
|
||||
+ RETURN_VAL_IF_FALSE(this->marco_settings_, false);
|
||||
+ this->marco_settings_->reset(MARCO_SCHAME_KEY_TITLEBAR_FONT);
|
||||
+ break;
|
||||
+ }
|
||||
+ case APPEARANCE_FONT_TYPE_MONOSPACE:
|
||||
+ {
|
||||
+ RETURN_VAL_IF_FALSE(this->interface_settings_, false);
|
||||
+ this->interface_settings_->reset(INTERFACE_KEY_MONOSPACE_FONT_NAME);
|
||||
+ break;
|
||||
+ }
|
||||
+ default:
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
void AppearanceFont::on_font_changed_cb(const Glib::ustring& key)
|
||||
{
|
||||
switch (shash(key.c_str()))
|
||||
diff --git a/plugins/appearance/font/appearance-font.h b/plugins/appearance/font/appearance-font.h
|
||||
index 2d04d96..cbb712d 100644
|
||||
--- a/plugins/appearance/font/appearance-font.h
|
||||
+++ b/plugins/appearance/font/appearance-font.h
|
||||
@@ -29,6 +29,7 @@ public:
|
||||
|
||||
std::string get_font(AppearanceFontType type);
|
||||
bool set_font(AppearanceFontType type, const std::string& font);
|
||||
+ bool reset_font(AppearanceFontType type);
|
||||
|
||||
// 字体变化信号
|
||||
sigc::signal<void, AppearanceFontType, const std::string&> signal_font_changed() { return this->font_changed_; };
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
From cf28fd1fdcea7c76e8ff5afb8a6a317b0cdabac5 Mon Sep 17 00:00:00 2001
|
||||
From: liuxinhao <liuxinhao@kylinsec.com.cn>
|
||||
Date: Fri, 1 Mar 2024 14:50:33 +0800
|
||||
Subject: [PATCH] fix(keybidning): avoid shift to participate in translator
|
||||
keycodes
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
- 不让shift参与按键翻译,避免多重意义,影响匹配
|
||||
|
||||
Closes #25039,#30978
|
||||
---
|
||||
plugins/keybinding/shortcut-helper.cpp | 28 +++++++++++++++++---------
|
||||
1 file changed, 19 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/plugins/keybinding/shortcut-helper.cpp b/plugins/keybinding/shortcut-helper.cpp
|
||||
index a9dd62c..0e943cc 100644
|
||||
--- a/plugins/keybinding/shortcut-helper.cpp
|
||||
+++ b/plugins/keybinding/shortcut-helper.cpp
|
||||
@@ -1,14 +1,14 @@
|
||||
/**
|
||||
- * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
+ * Copyright (c) 2020 ~ 2021 KylinSec Co., Ltd.
|
||||
* kiran-cc-daemon is licensed under Mulan PSL v2.
|
||||
- * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
+ * You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
- * http://license.coscl.org.cn/MulanPSL2
|
||||
- * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
- * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
- * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
- * See the Mulan PSL v2 for more details.
|
||||
- *
|
||||
+ * http://license.coscl.org.cn/MulanPSL2
|
||||
+ * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
+ * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
+ * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
+ * See the Mulan PSL v2 for more details.
|
||||
+ *
|
||||
* Author: tangjie02 <tangjie02@kylinos.com.cn>
|
||||
*/
|
||||
|
||||
@@ -120,10 +120,15 @@ KeyState ShortCutHelper::get_keystate(XEvent *event)
|
||||
|
||||
auto group = XkbGroupForCoreState(event->xkey.state);
|
||||
|
||||
+ /** NOTE:
|
||||
+ * 不让shift修复符参与转换,避免使用shift+其他按键经过转换导致匹配问题。
|
||||
+ * 例如shift+5,若shift参与转换,keysym则会由'5'转换为'percent'
|
||||
+ */
|
||||
+ GdkModifierType no_shift_state = (GdkModifierType)(event->xkey.state & ~GDK_SHIFT_MASK);
|
||||
/* Check if we find a keysym that matches our current state */
|
||||
if (gdk_keymap_translate_keyboard_state(gdk_keymap_get_for_display(gdk_display_get_default()),
|
||||
event->xkey.keycode,
|
||||
- GdkModifierType(event->xkey.state),
|
||||
+ no_shift_state,
|
||||
group,
|
||||
&keyval,
|
||||
NULL,
|
||||
@@ -134,8 +139,11 @@ KeyState ShortCutHelper::get_keystate(XEvent *event)
|
||||
|
||||
gdk_keyval_convert_case(keyval, &lower, &upper);
|
||||
key_state.key_symbol = lower;
|
||||
+ /* 确保consumed不存在shift掩码,避免shift无法进入key_state.mods */
|
||||
consumed = (GdkModifierType)(consumed & (~GDK_SHIFT_MASK));
|
||||
KLOG_DEBUG_KEYBINDING("The keystate is %0x and consumed is %0x.", event->xkey.state, consumed);
|
||||
+
|
||||
+ /* 原始修饰符去掉已消耗的修饰符,存入mods,作为后续参与快捷键匹配的修饰符 */
|
||||
key_state.mods = event->xkey.state & ~consumed & GDK_MODIFIER_MASK;
|
||||
return key_state;
|
||||
}
|
||||
@@ -147,6 +155,7 @@ std::vector<uint32_t> ShortCutHelper::get_keycode(uint32_t key_symbol, KeyCodeFi
|
||||
std::vector<uint32_t> result;
|
||||
GdkKeymapKey *keys;
|
||||
int32_t n_keys;
|
||||
+
|
||||
if (gdk_keymap_get_entries_for_keyval(Gdk::Display::get_default()->get_keymap(),
|
||||
key_symbol,
|
||||
&keys,
|
||||
@@ -161,6 +170,7 @@ std::vector<uint32_t> ShortCutHelper::get_keycode(uint32_t key_symbol, KeyCodeFi
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
auto iter = std::unique(result.begin(), result.end());
|
||||
result.erase(iter, result.end());
|
||||
return result;
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
[org.mate.Marco.global-keybindings]
|
||||
panel-kiran-menu=''
|
||||
show-desktop=''
|
||||
|
||||
@ -16,3 +16,5 @@ active=false
|
||||
[org.mate.SettingsDaemon.plugins.mouse]
|
||||
active=false
|
||||
|
||||
[org.mate.SettingsDaemon.plugins.media-keys]
|
||||
active=false
|
||||
|
||||
Binary file not shown.
BIN
kiran-cc-daemon-2.6.1.tar.gz
Normal file
BIN
kiran-cc-daemon-2.6.1.tar.gz
Normal file
Binary file not shown.
@ -1,37 +1,21 @@
|
||||
Name: kiran-cc-daemon
|
||||
Version: 2.5.1
|
||||
Release: 30
|
||||
Version: 2.6.1
|
||||
Release: 8%{?dist}
|
||||
Summary: DBus daemon for Kiran Desktop
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
Source1: 99_unikylin-mate-SettingsDaemon-plugins.gschema.override
|
||||
Patch0: 0001-fix-translate-add-some-translation.patch
|
||||
Patch0001: 0001-fix-keyboard-Add-modifier-lock-window-tips-enable-ke.patch
|
||||
Patch0002: 0001-fix-audio-Fix-coredump-problem-caused-by-nullpointer.patch
|
||||
Patch0003: 0001-fix-audio-Fix-the-type-of-return-value-in-template.patch
|
||||
Patch0004: 0001-feature-timedate-Prior-to-select-last-ntp-service-in.patch
|
||||
Patch0005: 0001-feature-power-Delete-LockScreenWhenHibernate-and-Loc.patch
|
||||
Patch0006: 0001-fix-identification-issues-in-control-centers.patch
|
||||
Patch0007: 0001-fix-keybinding-Add-support-desktop-key-for-GC.patch
|
||||
Patch0008: 0001-fix-display-Add-adaptive-screen-change-flag.patch
|
||||
patch0009: 0001-fix-systeminfo-Adjusting-the-reading-method-of-cpu-i.patch
|
||||
Patch0010: 0001-feature-power-Compatiable-two-power-profile-daemon-w.patch
|
||||
Patch0011: 0001-fix-edid-Fix-the-problem-that-cannot-match-correct-m.patch
|
||||
Patch0012: 0001-fix-keyboard-Add-capslock-and-numlock-tips-switch.patch
|
||||
Patch0013: 0001-fix-power-Add-battery-charging-and-discharging-time.patch
|
||||
Patch0014: 0001-fix-keyboard-Fix-ci-build-error.patch
|
||||
Patch0015: 0001-fix-display-Fix-nvidia-display-while-no-enabled-moni.patch
|
||||
Patch0016: 0001-fix-xsettings-Fix-the-problem-that-variable-serial-i.patch
|
||||
Patch0017: 0001-fix-accounts-Fix-user-icon-file-display-while-change.patch
|
||||
Patch0018: 0001-fix-keybindings-Remove-power-and-logout-invalid-key-.patch
|
||||
Patch0019: 0001-fix-power-Change-poweroff-action-from-key-press-to-r.patch
|
||||
Patch0020: 0001-feature-font-Change-the-default-GTK-application-font.patch
|
||||
Patch0021: 0001-fix-power-Fix-related-project-build-with-power-event.patch
|
||||
Patch0022: 0001-fix-display-Fix-multi-screen-auto-display-while-swit.patch
|
||||
Patch0023: 0001-fix-systeminfo-Fix-to-get-pci-info-for-multiple-devi.patch
|
||||
Patch0024: 0001-fix-plugin-remove-active-or-deactive-mate-plugin-cod.patch
|
||||
Patch0025: 0001-fix-display-fix-the-switch-function-invalidation-pro.patch
|
||||
Source1: 99_unikylin-mate-SettingsDaemon-plugins.gschema.override
|
||||
Source2: 99_unikylin-mate-Marco-global-keybindings.gschema.override
|
||||
|
||||
Patch0000: 0000-fix-xsettings-set-default-icon-theme-to-Spring.patch
|
||||
Patch0001: 0001-fix-xsettings-Fix-font-enlargement-on-4K-screen.patch
|
||||
Patch0002: 0001-fix-media-keys-Fix-use-shortcut-key-with-shift.patch
|
||||
Patch0003: 0003-fix-power-tray-Fixed-an-issue-where-the-laptop-tray-.patch
|
||||
Patch0004: 0004-fix-keybinding-Fix-shortcut-grab-in-system-and-conf-.patch
|
||||
Patch0005: 0005-fix-power-Fix-dpms-force-level-effective-while-state.patch
|
||||
Patch0006: 0006-feature-appearance-Add-support-reset-default-font.patch
|
||||
Patch0007: 0007-fix-keybidning-avoid-shift-to-participate-in-transla.patch
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
BuildRequires: pkgconfig(glibmm-2.4)
|
||||
@ -53,7 +37,13 @@ BuildRequires: jsoncpp-devel
|
||||
BuildRequires: cairomm-devel
|
||||
BuildRequires: kiran-log-gtk3-devel
|
||||
BuildRequires: fmt-devel >= 6.2.1
|
||||
|
||||
%if "%{?kylin_major_version}" == "3" && "%{?kylin_minor_version}" == "3" && "%{?kylin_sub_minor_version}" == "6"
|
||||
BuildRequires: python36-jinja2
|
||||
%else
|
||||
BuildRequires: python%{python3_pkgversion}-jinja2
|
||||
%endif
|
||||
|
||||
BuildRequires: gdbus-codegen-glibmm
|
||||
BuildRequires: gtest-devel
|
||||
BuildRequires: libnotify-devel
|
||||
@ -61,6 +51,7 @@ BuildRequires: pulseaudio-libs-devel
|
||||
BuildRequires: libgtop2-devel
|
||||
BuildRequires: libgudev-devel
|
||||
BuildRequires: cryptopp-devel
|
||||
BuildRequires: libwnck3-devel
|
||||
|
||||
|
||||
%description
|
||||
@ -111,6 +102,7 @@ Requires: xorg-x11-server-utils
|
||||
Requires: kiran-cc-daemon-common
|
||||
Requires: upower
|
||||
Requires: pulseaudio
|
||||
Requires: libwnck3
|
||||
|
||||
%description -n kiran-session-daemon
|
||||
Session DBus daemon for Kiran Desktop
|
||||
@ -132,17 +124,15 @@ Development files for communicating with control center daemon
|
||||
|
||||
%build
|
||||
|
||||
%if "%{ks_custom_name}" == "GC"
|
||||
%cmake -Dfilter-desktop-extend-key=false
|
||||
%else
|
||||
%cmake
|
||||
%endif
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
||||
install -D -m 0644 %SOURCE1 %{buildroot}%{_datadir}/glib-2.0/schemas/99_unikylin-mate-SettingsDaemon-plugins.gschema.override
|
||||
install -D -m 0644 %SOURCE2 %{buildroot}%{_datadir}/glib-2.0/schemas/99_unikylin-mate-Marco-global-keybindings.gschema.override
|
||||
|
||||
%post -n kiran-system-daemon
|
||||
%systemd_post kiran-system-daemon.service
|
||||
@ -192,10 +182,8 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
|
||||
%{_datadir}/polkit-1/actions/com.kylinsec.Kiran.SessionDaemon*.policy
|
||||
%dir %{_datadir}/kiran-cc-daemon/keybindings
|
||||
%{_datadir}/kiran-cc-daemon/keybindings/*.xml
|
||||
%{_datadir}/kiran-cc-daemon/kiran-session-daemon.gresource
|
||||
%dir %{_datadir}/kiran-cc-daemon/images
|
||||
%{_datadir}/kiran-cc-daemon/images/*.png
|
||||
%{_datadir}/glib-2.0/schemas/99_unikylin-mate-SettingsDaemon-plugins.gschema.override
|
||||
%{_datadir}/glib-2.0/schemas/99_unikylin-mate-Marco-global-keybindings.gschema.override
|
||||
|
||||
%files common
|
||||
%{_includedir}/kiran-cc-daemon/error-i.h
|
||||
@ -215,47 +203,46 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
|
||||
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
|
||||
|
||||
%changelog
|
||||
* Sun Oct 8 2023 tangjie02 <tangjie02@kylinsec.com.cn> - 2.5.1-30
|
||||
- KYOS-B: fix the switch function invalidation problem after turn off monitor, then logout and relogin session.(#17149)
|
||||
* Mon Mar 04 2024 liuxinhao <liuxinhao@kylinsec.com.cn> - 2.6.1-8
|
||||
- KYOS-B: avoid shift to participate in translator keycodes(#25039)
|
||||
|
||||
* Mon Sep 18 2023 yuanxing <yuanxing@kylinsec.com.cn> - 2.5.1-29
|
||||
- KYOS-F: don't close clipboard mate plugin
|
||||
* Wed Feb 21 2024 meizhigang <meizhigang@kylinsec.com.cn> - 2.6.1-7
|
||||
- KYOS-F: Add support reset default font(#20203)
|
||||
|
||||
* Thu Sep 14 2023 yuanxing <yuanxing@kylinsec.com.cn> - 2.5.1-28
|
||||
- KYOS-F: remove active/deactive mate setting daemon plugin code
|
||||
* Wed Jan 31 2024 meizhigang <meizhigang@kylinsec.com.cn> - 2.6.1-6
|
||||
- KYOS-B: Fix dpms force level effective while state changed (#24589)
|
||||
|
||||
* Thu Sep 14 2023 yuanxing <yuanxing@kylinsec.com.cn> - 2.5.1-27
|
||||
- KYOS-F: add mate settings daemon plugin gschema override file
|
||||
* Tue Jan 30 2024 meizhigang <meizhigang.kylinsec.com.cn> - 2.6.1-5
|
||||
- KYOS-B: Fix shortcut grab in system and conf saved in custom (#25039 #29448)
|
||||
|
||||
* Mon Sep 11 2023 longcheng <longcheng@kylinsec.com.cn> - 2.5.1-26
|
||||
- KYOS-B: change BuildRequires in redhat 7 (#14460)
|
||||
* Fri Jan 19 2024 yangfeng <yangfeng@kylinsec.com.cn> - 2.6.1-4
|
||||
- KYOS-B: Fixed an issue where the laptop tray battery icon is not the same size as other icons. (#25531)
|
||||
|
||||
* Wed Sep 06 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-25
|
||||
- KYOS-B: Fix to get pci info for multiple device subclass
|
||||
* Fri Jan 05 2024 meizhigang <meizhigang.kylinsec.com.cn> - 2.6.1-3
|
||||
- KYOS-B: Fix font enlargement on 4K screen (#24084)
|
||||
- KYOS-B: Fix use shortcut key with shift (#25039)
|
||||
|
||||
* Thu Aug 24 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-24
|
||||
- KYOS-B: Fix multi screen auto display while switch style (#13176)
|
||||
* Fri Dec 29 2023 yanglan <yanglan@kylinsec.com.cn> - 2.6.1-2.kb3
|
||||
- rebuild for KiranUI-2.6-next
|
||||
|
||||
* Wed Aug 23 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-23
|
||||
- KYOS-B: Fix related project build with power event param (#11422)
|
||||
* Mon Dec 25 2023 yanglan <yanglan@kylinsec.com.cn> - 2.6.1-2.kb2
|
||||
- rebuild for KiranUI-2.6-next
|
||||
|
||||
* Tue Aug 22 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.1-22
|
||||
- KYOS-B: Change the default GTK application font size from 10 to 9 (#13006)
|
||||
* Thu Dec 14 2023 yuanxing <yuanxing.kylinsec.com.cn> - 2.6.1-2
|
||||
- KYOS-F: change the default icon theme to Spring
|
||||
|
||||
* Mon Aug 21 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-21
|
||||
- KYOS-B: Change poweroff action from key press to release (#11422)
|
||||
* Tue Dec 12 2023 meizhigang <meizhigang.kylinsec.com.cn> - 2.6.1-1
|
||||
- rebuild for KiranUI-2.6-next
|
||||
- KYOS-B: Add interface for get card list(#20195)
|
||||
|
||||
* Fri Aug 18 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-20
|
||||
- KYOS-B: Remove power and logout invalid key from normal desktop (#11242)
|
||||
* Wed Nov 29 2023 meizhigang <meizhigang.kylinsec.com.cn> - 2.6.0-1
|
||||
- rebuild for KiranUI-2.6-next
|
||||
|
||||
* Wed Aug 16 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-19
|
||||
- KYOS-F: Fix user icon file display while change and login (#12711)
|
||||
* Mon Sep 11 2023 longcheng <longcheng@kylinsec.com.cn> - 2.5.1-16.kb2
|
||||
- KYOS-B: change BuildRequires in redhat 7 (#14460)
|
||||
|
||||
* Thu Aug 10 2023 tangjie02 <tangjie02@kylinsec.com.cn> - 2.5.1-18
|
||||
- KYOS-F: Fix the problem that variable serial isn't increased when xsettings registry property is updated.(#11637)
|
||||
|
||||
* Mon Jul 31 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-17
|
||||
- KYOS-F: Fix nvidia display while no enabled monitor (#9609)
|
||||
* Mon Jul 24 2023 kpkg <kpkg.kylinsec.com.cn> - 2.5.1-16.kb1
|
||||
- rebuild for KiranUI-2.5-next
|
||||
|
||||
* Fri Jul 21 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-16
|
||||
- KYOS-F: Add battery charging and discharging time (#9506)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user