summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKhalid <khalid97262@live.com>2024-03-20 07:00:43 +0300
committerGitHub <noreply@github.com>2024-03-20 04:00:43 +0000
commit9ddf1b105e1b63a77b851af5e541a9412b0e0928 (patch)
tree9cfd0d41c04204b1d6002f17ef9ddfac5f77d0db /src
parent95ac8a34b1809375030b4ec2780a2b7a35ae8162 (diff)
tablet: Add left_handed option for tablets (#5178)
* Add left_handed option for tablets * Update left_handed tablet option's fallback string
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/managers/input/InputManager.cpp5
2 files changed, 6 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index ee7b90bf..d671ffb0 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -476,6 +476,7 @@ CConfigManager::CConfigManager() {
m_pConfig->addConfigValue("input:tablet:region_position", Hyprlang::VEC2{0, 0});
m_pConfig->addConfigValue("input:tablet:region_size", Hyprlang::VEC2{0, 0});
m_pConfig->addConfigValue("input:tablet:relative_input", Hyprlang::INT{0});
+ m_pConfig->addConfigValue("input:tablet:left_handed", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:pass_mouse_when_bound", Hyprlang::INT{0});
m_pConfig->addConfigValue("binds:scroll_event_delay", Hyprlang::INT{300});
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 04981e4e..7d820c8f 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -1418,6 +1418,11 @@ void CInputManager::setTabletConfigs() {
Debug::log(LOG, "Setting calibration matrix for device {}", t.name);
libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]);
+ if (g_pConfigManager->getDeviceInt(t.name, "left_handed", "input:tablet:left_handed") == 0)
+ libinput_device_config_left_handed_set(LIBINPUTDEV, 0);
+ else
+ libinput_device_config_left_handed_set(LIBINPUTDEV, 1);
+
const auto OUTPUT = g_pConfigManager->getDeviceString(t.name, "output", "input:tablet:output");
const auto PMONITOR = g_pCompositor->getMonitorFromString(OUTPUT);
if (!OUTPUT.empty() && OUTPUT != STRVAL_EMPTY && PMONITOR) {