From 9e794f358b7d44b4e04346dffbd684b2860d6fcc Mon Sep 17 00:00:00 2001 From: Ivan Chinenov Date: Fri, 14 Feb 2025 08:15:45 +0300 Subject: feat: support for setting tablet calibration matrix; this allows for rotating tablet inputs (#1122) * feat: support for setting tablet calibration matrix * Change default matrix --- src/input/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/input') diff --git a/src/input/mod.rs b/src/input/mod.rs index 8d9e6d82..a2931b85 100644 --- a/src/input/mod.rs +++ b/src/input/mod.rs @@ -3451,6 +3451,20 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input:: } else { input::SendEventsMode::ENABLED }); + + #[rustfmt::skip] + const IDENTITY_MATRIX: [f32; 6] = [ + 1., 0., 0., + 0., 1., 0., + ]; + + let _ = device.config_calibration_set_matrix( + c.calibration_matrix + .as_deref() + .and_then(|m| m.try_into().ok()) + .or(device.config_calibration_default_matrix()) + .unwrap_or(IDENTITY_MATRIX), + ); let _ = device.config_left_handed_set(c.left_handed); } } -- cgit