diff options
| author | Khalid J. <khalid.y96@outlook.com> | 2025-03-06 14:24:36 +0300 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-03-11 00:51:42 +0000 |
| commit | b21edb1a9753ba8c236302c1d6dba9ea2418b1d3 (patch) | |
| tree | 8e4206c21634ecdc7081f25fff9e409a1b51d276 /src/managers/input/InputManager.cpp | |
| parent | e4af4b5e2e3566a5fa95505b0d0ef5e5c9e174b8 (diff) | |
input: fix touch calibration matrix overriding
make the default behavior non-overriding to avoid overriding user-set
values elswehere.
Diffstat (limited to 'src/managers/input/InputManager.cpp')
| -rw-r--r-- | src/managers/input/InputManager.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index eb72c7b4..04f2ae3e 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1578,10 +1578,13 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) { 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->hlName, "transform", "input:touchdevice:transform"), 0, 7); - Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->hlName); - if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV)) - libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); + if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV)) { + Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->hlName); + // default value of transform being -1 means it's unset. + const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->hlName, "transform", "input:touchdevice:transform"), -1, 7); + if (ROTATION > -1) + libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); + } auto output = g_pConfigManager->getDeviceString(PTOUCHDEV->hlName, "output", "input:touchdevice:output"); bool bound = !output.empty() && output != STRVAL_EMPTY; @@ -1623,9 +1626,10 @@ void CInputManager::setTabletConfigs() { const auto RELINPUT = g_pConfigManager->getDeviceInt(NAME, "relative_input", "input:tablet:relative_input"); t->relativeInput = RELINPUT; - const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(NAME, "transform", "input:tablet:transform"), 0, 7); + const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(NAME, "transform", "input:tablet:transform"), -1, 7); Debug::log(LOG, "Setting calibration matrix for device {}", NAME); - libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); + if (ROTATION > -1) + libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); if (g_pConfigManager->getDeviceInt(NAME, "left_handed", "input:tablet:left_handed") == 0) libinput_device_config_left_handed_set(LIBINPUTDEV, 0); |
