fix(touchpad):Fix touchpad control with the type psmouse
-适配psmouse类型触摸板设备 Related #34878
This commit is contained in:
parent
0e3c02d53f
commit
cd7f76e413
188
0014-fix-touchpad-Fix-touchpad-control-with-the-type-psmo.patch
Normal file
188
0014-fix-touchpad-Fix-touchpad-control-with-the-type-psmo.patch
Normal file
@ -0,0 +1,188 @@
|
||||
From 340bfc9e80cf09aa699db9e447ee934cc06ba364 Mon Sep 17 00:00:00 2001
|
||||
From: meizhigang <meizhigang@kylinsec.com.cn>
|
||||
Date: Tue, 16 Apr 2024 10:13:48 +0800
|
||||
Subject: [PATCH] fix(touchpad):Fix touchpad control with the type psmouse
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
-适配psmouse类型触摸板设备
|
||||
|
||||
Related #34878
|
||||
---
|
||||
plugins/inputdevices/common/device-helper.cpp | 24 ++++++++++++++
|
||||
plugins/inputdevices/common/device-helper.h | 2 ++
|
||||
....kylinsec.Kiran.SessionDaemon.TouchPad.xml | 15 +++++++++
|
||||
.../touchpad/touchpad-manager.cpp | 32 ++++++++++++++++++-
|
||||
.../inputdevices/touchpad/touchpad-manager.h | 11 +++++++
|
||||
5 files changed, 83 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/plugins/inputdevices/common/device-helper.cpp b/plugins/inputdevices/common/device-helper.cpp
|
||||
index 5f3124b..17af064 100644
|
||||
--- a/plugins/inputdevices/common/device-helper.cpp
|
||||
+++ b/plugins/inputdevices/common/device-helper.cpp
|
||||
@@ -90,6 +90,11 @@ bool DeviceHelper::is_touchpad()
|
||||
{
|
||||
RETURN_VAL_IF_TRUE(this->device_ == NULL, false);
|
||||
|
||||
+ if (this->is_psmouse())
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
auto display = gdk_display_get_default();
|
||||
|
||||
if (this->device_info_->type != XInternAtom(GDK_DISPLAY_XDISPLAY(display), XI_TOUCHPAD, True))
|
||||
@@ -105,6 +110,25 @@ bool DeviceHelper::is_touchpad()
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool DeviceHelper::is_psmouse()
|
||||
+{
|
||||
+ RETURN_VAL_IF_TRUE(this->device_ == NULL, false);
|
||||
+
|
||||
+ auto display = gdk_display_get_default();
|
||||
+
|
||||
+ if (this->device_info_->type != XInternAtom(GDK_DISPLAY_XDISPLAY(display), XI_MOUSE, True))
|
||||
+ {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (std::string::npos != this->get_device_name().find("PS/2"))
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
void DeviceHelper::set_property(const std::string &property_name, const std::vector<bool> &property_value)
|
||||
{
|
||||
RETURN_IF_TRUE(this->device_ == NULL);
|
||||
diff --git a/plugins/inputdevices/common/device-helper.h b/plugins/inputdevices/common/device-helper.h
|
||||
index 82b4293..56d5775 100644
|
||||
--- a/plugins/inputdevices/common/device-helper.h
|
||||
+++ b/plugins/inputdevices/common/device-helper.h
|
||||
@@ -41,6 +41,8 @@ public:
|
||||
bool has_property(const std::string &property_name);
|
||||
// 判断设备是否为触摸板
|
||||
bool is_touchpad();
|
||||
+ // 判断设备是否为psmouse
|
||||
+ bool is_psmouse();
|
||||
// 设置属性值
|
||||
void set_property(const std::string &property_name, const std::vector<bool> &property_value);
|
||||
void set_property(const std::string &property_name, float property_value);
|
||||
diff --git a/plugins/inputdevices/touchpad/com.kylinsec.Kiran.SessionDaemon.TouchPad.xml b/plugins/inputdevices/touchpad/com.kylinsec.Kiran.SessionDaemon.TouchPad.xml
|
||||
index 8087b87..f5527ad 100644
|
||||
--- a/plugins/inputdevices/touchpad/com.kylinsec.Kiran.SessionDaemon.TouchPad.xml
|
||||
+++ b/plugins/inputdevices/touchpad/com.kylinsec.Kiran.SessionDaemon.TouchPad.xml
|
||||
@@ -36,6 +36,21 @@
|
||||
Click methods are usually only available on clickpads.</description>
|
||||
</property>
|
||||
|
||||
+ <property name="disable_while_typing_support" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>The support of disable while typing.</description>>
|
||||
+ </property>
|
||||
+
|
||||
+ <property name="tap_to_click_support" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>The support of tap to click.</description>
|
||||
+ </property>
|
||||
+
|
||||
+ <property name="click_method_support" type="b" access="readwrite">
|
||||
+ <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
+ <description>The support of click method.</description>
|
||||
+ </property>
|
||||
+
|
||||
<property name="scroll_method" type="i" access="readwrite">
|
||||
<annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="true"/>
|
||||
<description>Enables a scroll method. Permitted methods are twofinger, edge and button.</description>
|
||||
diff --git a/plugins/inputdevices/touchpad/touchpad-manager.cpp b/plugins/inputdevices/touchpad/touchpad-manager.cpp
|
||||
index ad933d6..5465c6f 100644
|
||||
--- a/plugins/inputdevices/touchpad/touchpad-manager.cpp
|
||||
+++ b/plugins/inputdevices/touchpad/touchpad-manager.cpp
|
||||
@@ -51,7 +51,10 @@ TouchPadManager::TouchPadManager() : dbus_connect_id_(0),
|
||||
scroll_method_(0),
|
||||
natural_scroll_(false),
|
||||
touchpad_enabled_(true),
|
||||
- motion_acceleration_(0)
|
||||
+ motion_acceleration_(0),
|
||||
+ disable_while_typing_support_(false),
|
||||
+ tap_to_click_support_(false),
|
||||
+ click_method_support_(false)
|
||||
{
|
||||
this->touchpad_settings_ = Gio::Settings::create(TOUCHPAD_SCHEMA_ID);
|
||||
}
|
||||
@@ -124,6 +127,33 @@ void TouchPadManager::init()
|
||||
}
|
||||
});
|
||||
|
||||
+ XInputHelper::foreach_device([this](std::shared_ptr<DeviceHelper> device_helper)
|
||||
+ {
|
||||
+ if (device_helper->has_property(TOUCHPAD_PROP_DISABLE_WHILE_TYPING) &&
|
||||
+ device_helper->is_touchpad())
|
||||
+ {
|
||||
+ this->disable_while_typing_support_ = true;
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ XInputHelper::foreach_device([this](std::shared_ptr<DeviceHelper> device_helper)
|
||||
+ {
|
||||
+ if (device_helper->has_property(TOUCHPAD_PROP_TAPPING_ENABLED) &&
|
||||
+ device_helper->is_touchpad())
|
||||
+ {
|
||||
+ this->tap_to_click_support_ = true;
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
+ XInputHelper::foreach_device([this](std::shared_ptr<DeviceHelper> device_helper)
|
||||
+ {
|
||||
+ if (device_helper->has_property(TOUCHPAD_PROP_CLICK_METHOD) &&
|
||||
+ device_helper->is_touchpad())
|
||||
+ {
|
||||
+ this->click_method_support_ = true;
|
||||
+ }
|
||||
+ });
|
||||
+
|
||||
this->load_from_settings();
|
||||
this->set_all_props_to_devices();
|
||||
|
||||
diff --git a/plugins/inputdevices/touchpad/touchpad-manager.h b/plugins/inputdevices/touchpad/touchpad-manager.h
|
||||
index 1c26417..c9c9818 100644
|
||||
--- a/plugins/inputdevices/touchpad/touchpad-manager.h
|
||||
+++ b/plugins/inputdevices/touchpad/touchpad-manager.h
|
||||
@@ -45,6 +45,9 @@ protected:
|
||||
virtual bool natural_scroll_setHandler(bool value);
|
||||
virtual bool touchpad_enabled_setHandler(bool value);
|
||||
virtual bool motion_acceleration_setHandler(double value);
|
||||
+ virtual bool disable_while_typing_support_setHandler(bool value) { return true; };
|
||||
+ virtual bool tap_to_click_support_setHandler(bool value) { return true; };
|
||||
+ virtual bool click_method_support_setHandler(bool value) { return true; };
|
||||
|
||||
// 是否存在触摸板设备
|
||||
virtual bool has_touchpad_get() { return this->has_touchpad_; };
|
||||
@@ -69,6 +72,10 @@ protected:
|
||||
// 移动加速,范围为[-1,1]
|
||||
virtual double motion_acceleration_get() { return this->motion_acceleration_; };
|
||||
|
||||
+ virtual bool disable_while_typing_support_get() { return this->disable_while_typing_support_; };
|
||||
+ virtual bool tap_to_click_support_get() { return this->tap_to_click_support_; };
|
||||
+ virtual bool click_method_support_get() { return this->click_method_support_; };
|
||||
+
|
||||
private:
|
||||
void init();
|
||||
|
||||
@@ -106,5 +113,9 @@ private:
|
||||
bool natural_scroll_;
|
||||
bool touchpad_enabled_;
|
||||
double motion_acceleration_;
|
||||
+
|
||||
+ bool disable_while_typing_support_;
|
||||
+ bool tap_to_click_support_;
|
||||
+ bool click_method_support_;
|
||||
};
|
||||
} // namespace Kiran
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: kiran-cc-daemon
|
||||
Version: 2.6.1
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
Summary: DBus daemon for Kiran Desktop
|
||||
|
||||
License: MulanPSL-2.0
|
||||
@ -22,6 +22,7 @@ Patch0010: 0010-feature-CI-ref-new-CI-entry-point.patch
|
||||
Patch0011: 0011-fix-audio-Fix-audio-stream-volume-retain-while-set-m.patch
|
||||
Patch0012: 0012-fix-power-Fix-battery-charging-and-discharging-time.patch
|
||||
Patch0013: 0013-fix-power-Fix-sys-backlight-set-only-in-notebook-wit.patch
|
||||
Patch0014: 0014-fix-touchpad-Fix-touchpad-control-with-the-type-psmo.patch
|
||||
|
||||
BuildRequires: cmake >= 3.2
|
||||
BuildRequires: pkgconfig(glibmm-2.4)
|
||||
@ -208,6 +209,9 @@ glib-compile-schemas /usr/share/glib-2.0/schemas &> /dev/nulls || :
|
||||
%{_libdir}/pkgconfig/kiran-cc-daemon.pc
|
||||
|
||||
%changelog
|
||||
* Wed Apr 17 2024 meizhigang <meizhigang@kylinsec.com.cn> - 2.6.1-12
|
||||
- KYOS-B: Fix touchpad control with the type psmouse (#34878)
|
||||
|
||||
* Wed Apr 10 2024 meizhigang <meizhigang@kylinsec.com.cn> - 2.6.1-11
|
||||
- KYOS-B: Add battery charging and discharging time (#28618)
|
||||
- KYOS-B: Fix sys backlight set only in notebook with battery (#31917)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user