summaryrefslogtreecommitdiffstats
path: root/kcontrol/input/touchpad_settings.h
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2024-06-01 22:46:37 +0300
committerMavridis Philippe <mavridisf@gmail.com>2024-09-08 01:35:16 +0300
commit2af9d1ed2ccf0c303df4b6a845395ebd7b099c3b (patch)
treee745b4f24bf1a3a4b4ccd8244f82b6d60b744209 /kcontrol/input/touchpad_settings.h
parent63178a8866996791c95b349988a064c26a826025 (diff)
downloadtdebase-2af9d1ed2ccf0c303df4b6a845395ebd7b099c3b.tar.gz
tdebase-2af9d1ed2ccf0c303df4b6a845395ebd7b099c3b.zip
KControl: add touchpad configuration module
Supports the Libinput and Synaptics drivers, includes documentation and inpupt-touchpad icon. Signed-off-by: Mavridis Philippe <mavridisf@gmail.com> (cherry picked from commit 8bd4c502f65ad364261913150ce59a74c993ca1c)
Diffstat (limited to 'kcontrol/input/touchpad_settings.h')
-rw-r--r--kcontrol/input/touchpad_settings.h107
1 files changed, 107 insertions, 0 deletions
diff --git a/kcontrol/input/touchpad_settings.h b/kcontrol/input/touchpad_settings.h
new file mode 100644
index 000000000..8cdfea951
--- /dev/null
+++ b/kcontrol/input/touchpad_settings.h
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ tdecm_touchpad
+ A touchpad module for the TDE Control Centre
+
+ Copyright © 2024 Mavridis Philippe <mavridisf@gmail.com>
+
+ This program is free software: you can redistribute it and/or modify it under
+ the terms of the GNU General Public License as published by the Free Software
+ Foundation, either version 3 of the License, or (at your option) any later
+ version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along with
+ this program. If not, see <https://www.gnu.org/licenses/>.
+
+*******************************************************************************/
+
+#ifndef __TOUCHPAD_SETTINGS_H__
+#define __TOUCHPAD_SETTINGS_H__
+
+// TQt
+#include <tqvaluelist.h>
+
+// Macros
+#define DEL(var) \
+ if (var) { delete var; var = nullptr; }
+
+#define ATOM(var, atom) \
+ Atom var = XInternAtom(display, atom, true);
+
+#define PROP(var, property) \
+ XIProperty var = XIProperty(m_touchpad.id, property);
+
+#define SET_PROP(property, type) \
+ DEL(prop) \
+ prop = new XIProperty(m_touchpad.id, property); \
+ if (prop->type == nullptr) \
+ { \
+ kdWarning() << "Failed to set property " << property << endl; \
+ ++fail; \
+ } \
+ else
+
+#define IF_DRIVER(drv) \
+ if (touchpad().driver == Touchpad::Driver::drv)
+
+
+/****************************** struct Touchpad *******************************/
+#undef None
+
+struct Touchpad
+{
+ enum Driver { None, LibInput, Synaptics };
+
+ bool valid = false;
+ unsigned int id;
+ TQCString name;
+ Driver driver = Touchpad::Driver::None;
+
+ void init(unsigned int _id, TQCString _name)
+ {
+ valid = true;
+ id = _id;
+ name = _name;
+ }
+};
+
+
+/***************************** TouchpadSettings *******************************/
+class TouchpadSettings
+{
+ public:
+ TouchpadSettings();
+
+ void load(bool defaults = false);
+ void save();
+ void apply(bool force = false);
+
+ TQValueList<bool> getScrollMethodsAvailability();
+ TQValueList<bool> getAccelProfilesAvailability();
+
+ bool enabled, tapClick, tapDrag, tapDragLock, tapMapping, offWhileTyping,
+ leftHandedMode, midButtonEmulation, naturalScroll, scrollMethod;
+ int scrollDirections, naturalScrollDirections;
+
+ int accelSpeed, accelProfile;
+
+ bool foundTouchpad();
+ Touchpad touchpad();
+
+ // Enable/disable touchpad without applying all settings
+ bool setTouchpadEnabled(bool on);
+
+ bool supportedTouchpad();
+
+ protected:
+ bool findTouchpad();
+
+ private:
+ Touchpad m_touchpad;
+ bool m_foundTouchpad;
+};
+
+#endif // __TOUCHPAD_SETTINGS_H__ \ No newline at end of file