mirror of
https://github.com/YaLTeR/niri.git
synced 2025-10-05 16:12:47 +02:00
Support calibration-matrix in touch input config
This commit is contained in:
committed by
Ivan Molodetskikh
parent
1b41ef146d
commit
03c564736a
@@ -96,6 +96,7 @@ input {
|
|||||||
touch {
|
touch {
|
||||||
// off
|
// off
|
||||||
map-to-output "eDP-1"
|
map-to-output "eDP-1"
|
||||||
|
// calibration-matrix 1.0 0.0 0.0 0.0 1.0 0.0
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable-power-key-handling
|
// disable-power-key-handling
|
||||||
@@ -256,9 +257,11 @@ Settings specific to `touchpad` and `mouse`:
|
|||||||
|
|
||||||
<sup>Since: 25.08</sup> You can also override horizontal and vertical scroll factor separately like so: `scroll-factor horizontal=2.0 vertical=-1.0`
|
<sup>Since: 25.08</sup> You can also override horizontal and vertical scroll factor separately like so: `scroll-factor horizontal=2.0 vertical=-1.0`
|
||||||
|
|
||||||
Settings specific to `tablet`s:
|
Settings specific to `tablet` and `touch`:
|
||||||
|
|
||||||
- `calibration-matrix`: <sup>Since: 25.02</sup> set to six floating point numbers to change the calibration matrix. See the [`LIBINPUT_CALIBRATION_MATRIX` documentation](https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html) for examples.
|
- `calibration-matrix`: set to six floating point numbers to change the calibration matrix. See the [`LIBINPUT_CALIBRATION_MATRIX` documentation](https://wayland.freedesktop.org/libinput/doc/latest/device-configuration-via-udev.html) for examples.
|
||||||
|
- <sup>Since: 25.02</sup> for `tablet`
|
||||||
|
- <sup>Since: next release</sup> for `touch`
|
||||||
|
|
||||||
Tablets and touchscreens are absolute pointing devices that can be mapped to a specific output like so:
|
Tablets and touchscreens are absolute pointing devices that can be mapped to a specific output like so:
|
||||||
|
|
||||||
|
@@ -371,6 +371,8 @@ pub struct Tablet {
|
|||||||
pub struct Touch {
|
pub struct Touch {
|
||||||
#[knuffel(child)]
|
#[knuffel(child)]
|
||||||
pub off: bool,
|
pub off: bool,
|
||||||
|
#[knuffel(child, unwrap(arguments))]
|
||||||
|
pub calibration_matrix: Option<Vec<f32>>,
|
||||||
#[knuffel(child, unwrap(argument))]
|
#[knuffel(child, unwrap(argument))]
|
||||||
pub map_to_output: Option<String>,
|
pub map_to_output: Option<String>,
|
||||||
}
|
}
|
||||||
|
@@ -993,6 +993,7 @@ mod tests {
|
|||||||
},
|
},
|
||||||
touch: Touch {
|
touch: Touch {
|
||||||
off: false,
|
off: false,
|
||||||
|
calibration_matrix: None,
|
||||||
map_to_output: Some(
|
map_to_output: Some(
|
||||||
"eDP-1",
|
"eDP-1",
|
||||||
),
|
),
|
||||||
|
@@ -4564,6 +4564,20 @@ pub fn apply_libinput_settings(config: &niri_config::Input, device: &mut input::
|
|||||||
} else {
|
} else {
|
||||||
input::SendEventsMode::ENABLED
|
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),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user