aboutsummaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
authorIvan Chinenov <hjvt@hjvt.dev>2025-02-14 08:15:45 +0300
committerGitHub <noreply@github.com>2025-02-14 05:15:45 +0000
commit9e794f358b7d44b4e04346dffbd684b2860d6fcc (patch)
treec58dffc3306922fdafa6506c25933a37b8762972 /src/input
parent4e17cbb9ead83711c927fa511d149af83571ee10 (diff)
downloadniri-9e794f358b7d44b4e04346dffbd684b2860d6fcc.tar.gz
niri-9e794f358b7d44b4e04346dffbd684b2860d6fcc.tar.bz2
niri-9e794f358b7d44b4e04346dffbd684b2860d6fcc.zip
feat: support for setting tablet calibration matrix; this allows for rotating tablet inputs (#1122)
* feat: support for setting tablet calibration matrix * Change default matrix
Diffstat (limited to 'src/input')
-rw-r--r--src/input/mod.rs14
1 files changed, 14 insertions, 0 deletions
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);
}
}