autocommit 2022-04-01 01:44:10 CEST
This commit is contained in:
parent
ab4ac883ee
commit
2dd433aa04
32 changed files with 626 additions and 139 deletions
|
|
@ -2,10 +2,12 @@ use crate::libinput::consts::{AccelProfile, DeviceCapability};
|
|||
use crate::libinput::sys::{
|
||||
libinput_device, libinput_device_config_accel_set_profile,
|
||||
libinput_device_config_accel_set_speed, libinput_device_config_left_handed_set,
|
||||
libinput_device_get_user_data, libinput_device_has_capability, libinput_device_set_user_data,
|
||||
libinput_device_unref, libinput_path_remove_device,
|
||||
libinput_device_get_name, libinput_device_get_user_data, libinput_device_has_capability,
|
||||
libinput_device_set_user_data, libinput_device_unref, libinput_path_remove_device,
|
||||
};
|
||||
use crate::libinput::LibInput;
|
||||
use bstr::ByteSlice;
|
||||
use std::ffi::CStr;
|
||||
use std::marker::PhantomData;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
|
@ -65,6 +67,13 @@ impl<'a> LibInputDevice<'a> {
|
|||
libinput_device_config_accel_set_speed(self.dev, speed);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn name(&self) -> String {
|
||||
unsafe {
|
||||
let name = libinput_device_get_name(self.dev);
|
||||
CStr::from_ptr(name).to_bytes().as_bstr().to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl RegisteredDevice {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ extern "C" {
|
|||
device: *mut libinput_device,
|
||||
speed: f64,
|
||||
) -> libinput_config_status;
|
||||
pub fn libinput_device_get_name(device: *mut libinput_device) -> *const c::c_char;
|
||||
|
||||
pub fn libinput_event_destroy(event: *mut libinput_event);
|
||||
pub fn libinput_event_get_type(event: *mut libinput_event) -> libinput_event_type;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue