From 60c414ccadd0e2ff6be22bb880f605a164f451d5 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Tue, 4 Oct 2022 21:46:41 +0100 Subject: [PATCH] add left_handed config for input --- src/config/ConfigManager.cpp | 2 ++ src/managers/input/InputManager.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index cb47d86e6..a085f2a6d 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -137,6 +137,7 @@ void CConfigManager::setDefaultVars() { configValues["input:numlock_by_default"].intValue = 0; configValues["input:force_no_accel"].intValue = 0; configValues["input:float_switch_override_focus"].intValue = 1; + configValues["input:left_handed"].intValue = 0; configValues["input:touchpad:natural_scroll"].intValue = 0; configValues["input:touchpad:disable_while_typing"].intValue = 1; configValues["input:touchpad:clickfinger_behavior"].intValue = 0; @@ -180,6 +181,7 @@ void CConfigManager::setDeviceDefaultVars(const std::string& dev) { cfgValues["middle_button_emulation"].intValue = 0; cfgValues["tap-to-click"].intValue = 1; cfgValues["drag_lock"].intValue = 0; + cfgValues["left_handed"].intValue = 0; } void CConfigManager::setDefaultAnimationVars() { diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 6b717ed27..56e03b8f6 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -692,6 +692,11 @@ void CInputManager::setMouseConfigs() { else libinput_device_config_click_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER); + if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "left_handed") : g_pConfigManager->getInt("input:touchpad:left_handed")) == 0) + libinput_device_config_left_handed_set(LIBINPUTDEV, 0); + else + libinput_device_config_left_handed_set(LIBINPUTDEV, 1); + if (libinput_device_config_middle_emulation_is_available(LIBINPUTDEV)) { // middleclick on r+l mouse button pressed if ((HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "middle_button_emulation") : g_pConfigManager->getInt("input:touchpad:middle_button_emulation")) == 1) libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_ENABLED);