File indexing completed on 2024-11-24 05:00:46
0001 /* 0002 SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QString> 0010 #include <backends/libinputcommon.h> 0011 0012 class QDBusInterface; 0013 0014 class KWinWaylandTouchpad : public LibinputCommon 0015 { 0016 Q_OBJECT 0017 0018 Q_PROPERTY(qreal scrollFactor READ scrollFactor WRITE setScrollFactor NOTIFY scrollFactorChanged) 0019 0020 public: 0021 KWinWaylandTouchpad(QString dbusName); 0022 ~KWinWaylandTouchpad() override; 0023 0024 bool init(); 0025 0026 bool getConfig(); 0027 bool getDefaultConfig(); 0028 bool applyConfig(); 0029 bool isChangedConfig() const; 0030 0031 // 0032 // general 0033 QString name() const override 0034 { 0035 return m_name.val; 0036 } 0037 QString sysName() const 0038 { 0039 return m_sysName.val; 0040 } 0041 bool supportsDisableEvents() const override 0042 { 0043 return m_supportsDisableEvents.val; 0044 } 0045 void setEnabled(bool enabled) override 0046 { 0047 m_enabled.set(enabled); 0048 } 0049 bool isEnabled() const override 0050 { 0051 return m_enabled.val; 0052 } 0053 // 0054 // advanced 0055 bool supportsLeftHanded() const override 0056 { 0057 return m_supportsLeftHanded.val; 0058 } 0059 bool supportsDisableEventsOnExternalMouse() const override 0060 { 0061 return m_supportsDisableEventsOnExternalMouse.val; 0062 } 0063 bool supportsDisableWhileTyping() const override 0064 { 0065 return m_supportsDisableWhileTyping.val; 0066 } 0067 bool supportsMiddleEmulation() const override 0068 { 0069 return m_supportsMiddleEmulation.val; 0070 } 0071 // 0072 // tapping 0073 void setLmrTapButtonMap(bool set) override 0074 { 0075 m_lmrTapButtonMap.set(set); 0076 } 0077 // 0078 // acceleration speed and profile 0079 bool supportsPointerAcceleration() const override 0080 { 0081 return m_supportsPointerAcceleration.val; 0082 } 0083 bool supportsPointerAccelerationProfileFlat() const override 0084 { 0085 return m_supportsPointerAccelerationProfileFlat.val; 0086 } 0087 bool supportsPointerAccelerationProfileAdaptive() const override 0088 { 0089 return m_supportsPointerAccelerationProfileAdaptive.val; 0090 } 0091 // 0092 // scrolling 0093 bool supportsNaturalScroll() const override 0094 { 0095 return m_supportsNaturalScroll.val; 0096 } 0097 bool supportsHorizontalScrolling() const override 0098 { 0099 return false; 0100 } 0101 bool supportsScrollTwoFinger() const override 0102 { 0103 return m_supportsScrollTwoFinger.val; 0104 } 0105 bool supportsScrollEdge() const override 0106 { 0107 return m_supportsScrollEdge.val; 0108 } 0109 bool supportsScrollOnButtonDown() const override 0110 { 0111 return m_supportsScrollOnButtonDown.val; 0112 } 0113 0114 // 0115 // Scroll Factor 0116 bool supportsScrollFactor() const override 0117 { 0118 return true; 0119 } 0120 qreal scrollFactor() const 0121 { 0122 return m_scrollFactor.val; 0123 } 0124 void setScrollFactor(qreal factor) 0125 { 0126 return m_scrollFactor.set(factor); 0127 } 0128 0129 // 0130 // Click method 0131 bool supportsClickMethodAreas() const override 0132 { 0133 return m_supportsClickMethodAreas.val; 0134 } 0135 bool supportsClickMethodClickfinger() const override 0136 { 0137 return m_supportsClickMethodClickfinger.val; 0138 } 0139 0140 Q_SIGNALS: 0141 void scrollFactorChanged(); 0142 0143 private: 0144 template<typename T> 0145 bool valueLoader(Prop<T> &prop); 0146 0147 template<typename T> 0148 QString valueWriter(const Prop<T> &prop); 0149 // 0150 // general 0151 Prop<QString> m_name = Prop<QString>("name", QString()); 0152 Prop<QString> m_sysName = Prop<QString>("sysName", QString()); 0153 0154 // 0155 // advanced 0156 Prop<bool> m_supportsLeftHanded = PropBool("supportsLeftHanded"); 0157 Prop<bool> m_supportsDisableWhileTyping = PropBool("supportsDisableWhileTyping"); 0158 Prop<bool> m_supportsMiddleEmulation = PropBool("supportsMiddleEmulation"); 0159 0160 // 0161 // acceleration speed and profile 0162 Prop<bool> m_supportsPointerAcceleration = PropBool("supportsPointerAcceleration"); 0163 0164 // 0165 // scrolling 0166 Prop<bool> m_supportsNaturalScroll = PropBool("supportsNaturalScroll"); 0167 Prop<qreal> m_scrollFactor = Prop<qreal>("scrollFactor", 0); 0168 0169 QDBusInterface *m_iface; 0170 };