!59 Add modifier lock tips enable key and fix audio coredump
From: @meizhigang Reviewed-by: @stonefly128 Signed-off-by: @stonefly128
This commit is contained in:
commit
18cc0819be
@ -0,0 +1,55 @@
|
||||
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
|
||||
|
||||
@ -0,0 +1,68 @@
|
||||
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
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
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,11 +1,14 @@
|
||||
Name: kiran-cc-daemon
|
||||
Version: 2.5.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: DBus daemon for Kiran Desktop
|
||||
|
||||
License: MulanPSL-2.0
|
||||
Source0: %{name}-%{version}.tar.gz
|
||||
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
|
||||
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
@ -170,6 +173,11 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
|
||||
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
|
||||
|
||||
%changelog
|
||||
* Fri Apr 14 2023 meizhigang <meizhigang@kylinsec.com.cn> - 2.5.1-3
|
||||
- KYOS-B: Add modifier lock window tips enable key with gsettings (#67766)
|
||||
- KYOS-B: Fix coredump problem caused by nullpointer to string
|
||||
- KYOS-B: Fix the type of return value in template
|
||||
|
||||
* Mon Apr 10 2023 wangyucheng <wangyucheng@kylinsec.om.cn> - 2.5.1-2
|
||||
- KYOS-T: add some translation
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user