Add map_to_output input option for touch devices

This commit is contained in:
Ian Douglas Scott 2023-12-27 19:17:13 -08:00 committed by Victoria Brekenfeld
parent 70bb9b9a2e
commit 45946fc75d
4 changed files with 54 additions and 5 deletions

View file

@ -79,6 +79,7 @@ pub fn for_device(device: &InputDevice) -> InputConfig {
} else {
None
},
map_to_output: None,
}
}

View file

@ -426,6 +426,16 @@ impl Config {
.map_or(1.0, |x| x.0)
}
pub fn map_to_output(&self, device: &InputDevice) -> Option<&str> {
let (device_config, default_config) = self.get_device_config(device);
Some(
input_config::get_config(device_config, default_config, |x| {
x.map_to_output.as_deref()
})?
.0,
)
}
fn get_device_config(&self, device: &InputDevice) -> (Option<&InputConfig>, &InputConfig) {
let default_config = if device.config_tap_finger_count() > 0 {
&self.input_touchpad