summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2024-01-23 19:15:01 -0500
committerGitHub <noreply@github.com>2024-01-24 00:15:01 +0000
commitdf17991b1c3f9f5f8da546f2523e5092e266123a (patch)
treebc83a76f93d8d59081bd4c3abb0612dc13771e21 /src
parent791e1b96b3cd12d56648b3ce7ffb0832eba2b37d (diff)
input: Allow disabling touchscreen input (#4517)
* enable/disable touch device * ConfigManager: update documentation of 'enabled'
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp3
-rw-r--r--src/managers/input/InputManager.cpp8
2 files changed, 8 insertions, 3 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 402d879e..532a8a38 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -255,6 +255,7 @@ void CConfigManager::setDefaultVars() {
configValues["input:touchpad:scroll_factor"].floatValue = 1.f;
configValues["input:touchdevice:transform"].intValue = 0;
configValues["input:touchdevice:output"].strValue = STRVAL_EMPTY;
+ configValues["input:touchdevice:enabled"].intValue = 1;
configValues["input:tablet:transform"].intValue = 0;
configValues["input:tablet:output"].strValue = STRVAL_EMPTY;
configValues["input:tablet:region_position"].vecValue = Vector2D();
@@ -320,7 +321,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) {
cfgValues["scroll_points"].strValue = STRVAL_EMPTY;
cfgValues["transform"].intValue = 0;
cfgValues["output"].strValue = STRVAL_EMPTY;
- cfgValues["enabled"].intValue = 1; // only for mice / touchpads
+ cfgValues["enabled"].intValue = 1; // only for mice, touchpads, and touchdevices
cfgValues["region_position"].vecValue = Vector2D(); // only for tablets
cfgValues["region_size"].vecValue = Vector2D(); // only for tablets
cfgValues["relative_input"].intValue = 0; // only for tablets
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 5a98accb..8a98fe67 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1460,12 +1460,16 @@ void CInputManager::newTouchDevice(wlr_input_device* pDevice) {
}
void CInputManager::setTouchDeviceConfigs(STouchDevice* dev) {
-
auto setConfig = [&](STouchDevice* const PTOUCHDEV) -> void {
if (wlr_input_device_is_libinput(PTOUCHDEV->pWlrDevice)) {
const auto LIBINPUTDEV = (libinput_device*)wlr_libinput_get_device_handle(PTOUCHDEV->pWlrDevice);
- const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "transform", "input:touchdevice:transform"), 0, 7);
+ const auto ENABLED = g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "enabled", "input:touchdevice:enabled");
+ const auto mode = ENABLED ? LIBINPUT_CONFIG_SEND_EVENTS_ENABLED : LIBINPUT_CONFIG_SEND_EVENTS_DISABLED;
+ if (libinput_device_config_send_events_get_mode(LIBINPUTDEV) != mode)
+ libinput_device_config_send_events_set_mode(LIBINPUTDEV, mode);
+
+ const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->name, "transform", "input:touchdevice:transform"), 0, 7);
if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV))
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);