Add TOUCHPAD_TOGGLE for linux
moparisthebest/rusty-keys/pipeline/head There was a failure building this commit Details

This commit is contained in:
Travis Burtrum 2023-09-05 23:36:12 -04:00
parent e9705db5ba
commit 270cdca14f
2 changed files with 3 additions and 2 deletions

View File

@ -15,7 +15,7 @@ const HALF_KEY_SEPARATOR: char = ':';
// nightly only...
//pub trait KeyCode = Into<usize> + TryFrom<usize> + Copy + Clone + Eq + Hash + Default + 'static;
#[derive(PartialEq)]
#[derive(PartialEq, Debug)]
pub enum KeyState {
DOWN,
UP,
@ -255,7 +255,6 @@ impl<K, T, E, R> KeyMaps<K, T, E, R>
//impl KeyMapper for KeyMaps {
//impl KeyMaps {
pub fn send_event(&mut self, mut event: &mut E, device: &K) -> Result<R> {
//println!("type: {} code: {} value: {}", event.type_, event.code, event.value);
let value = event.value();
if value != KeyState::OTHER {
// todo: index check here...

View File

@ -228,6 +228,7 @@ pub fn main_res() -> Result<()> {
fn send_event(key_map: &mut LinuxKeyMaps, mut event: input_event, device: &Device) -> Result<()> {
if event.type_ == EV_KEY_U16 {
// println!("type: {} code: {:?} value: {:?}", event.type_, event.code(), event.value());
key_map.send_event(&mut event, &device)?
} else {
device.write_event(&mut event)?
@ -592,6 +593,7 @@ pub fn key_map() -> HashMap<&'static str, u16> {
("P0", KEY_KP0),
("PDOT", KEY_KPDOT),
("PENT", KEY_KPENTER),
("TOUCHPAD_TOGGLE", KEY_TOUCHPAD_TOGGLE),
].iter().cloned().map(|(m, v)| (m, v as u16)).collect()
}