From 270cdca14f74c28ae7c36ec2d23843398924116b Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Tue, 5 Sep 2023 23:36:12 -0400 Subject: [PATCH] Add TOUCHPAD_TOGGLE for linux --- src/keymapper.rs | 3 +-- src/linux/mod.rs | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/keymapper.rs b/src/keymapper.rs index bc99f08..1da05b8 100644 --- a/src/keymapper.rs +++ b/src/keymapper.rs @@ -15,7 +15,7 @@ const HALF_KEY_SEPARATOR: char = ':'; // nightly only... //pub trait KeyCode = Into + TryFrom + Copy + Clone + Eq + Hash + Default + 'static; -#[derive(PartialEq)] +#[derive(PartialEq, Debug)] pub enum KeyState { DOWN, UP, @@ -255,7 +255,6 @@ impl KeyMaps //impl KeyMapper for KeyMaps { //impl KeyMaps { pub fn send_event(&mut self, mut event: &mut E, device: &K) -> Result { - //println!("type: {} code: {} value: {}", event.type_, event.code, event.value); let value = event.value(); if value != KeyState::OTHER { // todo: index check here... diff --git a/src/linux/mod.rs b/src/linux/mod.rs index 9693e93..02f8abc 100644 --- a/src/linux/mod.rs +++ b/src/linux/mod.rs @@ -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() }