Revert "Set relative axes"

This reverts commit 4b33dee052.
pull/39/head
Takashi Kokubun 3 years ago
parent 1ed2fd9029
commit 6a8683304c
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD

@ -13,10 +13,9 @@ fn event_loop(input_device: &mut Device) -> Result<(), Box<dyn Error>> {
}
for event in input_device.fetch_events().unwrap() {
println!("event: {:?}", event);
//if event.event_type() == EventType::KEY {
// println!("event: {:?}", event);
//}
if event.event_type() == EventType::KEY {
println!("event: {:?}", event);
}
output_device.emit(&[event]).unwrap();
}
}

@ -1,20 +1,13 @@
use evdev::uinput::{VirtualDevice, VirtualDeviceBuilder};
use evdev::{AttributeSet, Device, RelativeAxisType};
use evdev::{Device};
use std::error::Error;
pub fn build_device(base_device: &Device) -> Result<VirtualDevice, Box<dyn Error>> {
let mut rel_axes = AttributeSet::<RelativeAxisType>::new();
rel_axes.insert(evdev::RelativeAxisType::REL_X);
rel_axes.insert(evdev::RelativeAxisType::REL_Y);
rel_axes.insert(evdev::RelativeAxisType::REL_HWHEEL);
rel_axes.insert(evdev::RelativeAxisType::REL_WHEEL);
rel_axes.insert(evdev::RelativeAxisType::REL_MISC);
let device = VirtualDeviceBuilder::new()?
.name("xremap")
.with_keys(base_device.supported_keys().unwrap())?
.with_relative_axes(&rel_axes)?
.build()
.unwrap();
Ok(device)
}

Loading…
Cancel
Save