wayland: implement tablet-v2
This commit is contained in:
parent
86e283d255
commit
7ed499eabd
62 changed files with 5174 additions and 318 deletions
|
|
@ -21,9 +21,19 @@ use {
|
|||
libinput_device_config_tap_get_enabled, libinput_device_config_tap_get_finger_count,
|
||||
libinput_device_config_tap_set_drag_enabled,
|
||||
libinput_device_config_tap_set_drag_lock_enabled,
|
||||
libinput_device_config_tap_set_enabled, 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,
|
||||
libinput_device_config_tap_set_enabled, libinput_device_get_device_group,
|
||||
libinput_device_get_id_product, libinput_device_get_id_vendor,
|
||||
libinput_device_get_name, libinput_device_get_user_data, libinput_device_group,
|
||||
libinput_device_group_get_user_data, libinput_device_group_set_user_data,
|
||||
libinput_device_has_capability, libinput_device_set_user_data,
|
||||
libinput_device_tablet_pad_get_mode_group, libinput_device_tablet_pad_get_num_buttons,
|
||||
libinput_device_tablet_pad_get_num_mode_groups,
|
||||
libinput_device_tablet_pad_get_num_rings, libinput_device_tablet_pad_get_num_strips,
|
||||
libinput_device_unref, libinput_path_remove_device, libinput_tablet_pad_mode_group,
|
||||
libinput_tablet_pad_mode_group_get_index, libinput_tablet_pad_mode_group_get_mode,
|
||||
libinput_tablet_pad_mode_group_get_num_modes,
|
||||
libinput_tablet_pad_mode_group_has_button, libinput_tablet_pad_mode_group_has_ring,
|
||||
libinput_tablet_pad_mode_group_has_strip,
|
||||
},
|
||||
LibInput,
|
||||
},
|
||||
|
|
@ -36,6 +46,16 @@ pub struct LibInputDevice<'a> {
|
|||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct LibInputDeviceGroup<'a> {
|
||||
pub(super) group: *mut libinput_device_group,
|
||||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct LibInputTabletPadModeGroup<'a> {
|
||||
pub(super) group: *mut libinput_tablet_pad_mode_group,
|
||||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct RegisteredDevice {
|
||||
pub(super) _li: Rc<LibInput>,
|
||||
pub(super) dev: *mut libinput_device,
|
||||
|
|
@ -191,6 +211,96 @@ impl<'a> LibInputDevice<'a> {
|
|||
pub fn has_natural_scrolling(&self) -> bool {
|
||||
unsafe { libinput_device_config_scroll_has_natural_scroll(self.dev) != 0 }
|
||||
}
|
||||
|
||||
pub fn device_group(&self) -> LibInputDeviceGroup<'_> {
|
||||
LibInputDeviceGroup {
|
||||
group: unsafe { libinput_device_get_device_group(self.dev) },
|
||||
_phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn product(&self) -> u32 {
|
||||
unsafe { libinput_device_get_id_product(self.dev) as u32 }
|
||||
}
|
||||
|
||||
pub fn vendor(&self) -> u32 {
|
||||
unsafe { libinput_device_get_id_vendor(self.dev) as u32 }
|
||||
}
|
||||
|
||||
pub fn pad_num_buttons(&self) -> u32 {
|
||||
match unsafe { libinput_device_tablet_pad_get_num_buttons(self.dev) } {
|
||||
-1 => 0,
|
||||
n => n as u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pad_num_rings(&self) -> u32 {
|
||||
match unsafe { libinput_device_tablet_pad_get_num_rings(self.dev) } {
|
||||
-1 => 0,
|
||||
n => n as u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pad_num_strips(&self) -> u32 {
|
||||
match unsafe { libinput_device_tablet_pad_get_num_strips(self.dev) } {
|
||||
-1 => 0,
|
||||
n => n as u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pad_num_mode_groups(&self) -> u32 {
|
||||
match unsafe { libinput_device_tablet_pad_get_num_mode_groups(self.dev) } {
|
||||
-1 => 0,
|
||||
n => n as u32,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pad_mode_group(&self, group: u32) -> Option<LibInputTabletPadModeGroup<'_>> {
|
||||
let group = unsafe { libinput_device_tablet_pad_get_mode_group(self.dev, group as _) };
|
||||
if group.is_null() {
|
||||
return None;
|
||||
}
|
||||
Some(LibInputTabletPadModeGroup {
|
||||
group,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> LibInputDeviceGroup<'a> {
|
||||
pub fn user_data(&self) -> usize {
|
||||
unsafe { libinput_device_group_get_user_data(self.group) }
|
||||
}
|
||||
|
||||
pub fn set_user_data(&self, user_data: usize) {
|
||||
unsafe { libinput_device_group_set_user_data(self.group, user_data) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> LibInputTabletPadModeGroup<'a> {
|
||||
pub fn index(&self) -> u32 {
|
||||
unsafe { libinput_tablet_pad_mode_group_get_index(self.group) as u32 }
|
||||
}
|
||||
|
||||
pub fn num_modes(&self) -> u32 {
|
||||
unsafe { libinput_tablet_pad_mode_group_get_num_modes(self.group) as u32 }
|
||||
}
|
||||
|
||||
pub fn mode(&self) -> u32 {
|
||||
unsafe { libinput_tablet_pad_mode_group_get_mode(self.group) as u32 }
|
||||
}
|
||||
|
||||
pub fn has_button(&self, button: u32) -> bool {
|
||||
unsafe { libinput_tablet_pad_mode_group_has_button(self.group, button as _) != 0 }
|
||||
}
|
||||
|
||||
pub fn has_ring(&self, ring: u32) -> bool {
|
||||
unsafe { libinput_tablet_pad_mode_group_has_ring(self.group, ring as _) != 0 }
|
||||
}
|
||||
|
||||
pub fn has_strip(&self, strip: u32) -> bool {
|
||||
unsafe { libinput_tablet_pad_mode_group_has_strip(self.group, strip as _) != 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl RegisteredDevice {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
use {
|
||||
crate::libinput::{
|
||||
consts::{ButtonState, EventType, KeyState, PointerAxis, Switch, SwitchState},
|
||||
device::LibInputDevice,
|
||||
consts::{
|
||||
ButtonState, EventType, KeyState, PointerAxis, Switch, SwitchState,
|
||||
TabletPadRingAxisSource, TabletPadStripAxisSource, TabletToolProximityState,
|
||||
TabletToolTipState, TabletToolType,
|
||||
},
|
||||
device::{LibInputDevice, LibInputTabletPadModeGroup},
|
||||
sys::{
|
||||
libinput_event, libinput_event_destroy, libinput_event_gesture,
|
||||
libinput_event_gesture_get_angle_delta, libinput_event_gesture_get_cancelled,
|
||||
|
|
@ -11,6 +15,7 @@ use {
|
|||
libinput_event_gesture_get_time_usec, libinput_event_get_device,
|
||||
libinput_event_get_gesture_event, libinput_event_get_keyboard_event,
|
||||
libinput_event_get_pointer_event, libinput_event_get_switch_event,
|
||||
libinput_event_get_tablet_pad_event, libinput_event_get_tablet_tool_event,
|
||||
libinput_event_get_type, libinput_event_keyboard, libinput_event_keyboard_get_key,
|
||||
libinput_event_keyboard_get_key_state, libinput_event_keyboard_get_time_usec,
|
||||
libinput_event_pointer, libinput_event_pointer_get_button,
|
||||
|
|
@ -20,7 +25,25 @@ use {
|
|||
libinput_event_pointer_get_scroll_value_v120, libinput_event_pointer_get_time_usec,
|
||||
libinput_event_pointer_has_axis, libinput_event_switch,
|
||||
libinput_event_switch_get_switch, libinput_event_switch_get_switch_state,
|
||||
libinput_event_switch_get_time_usec,
|
||||
libinput_event_switch_get_time_usec, libinput_event_tablet_pad,
|
||||
libinput_event_tablet_pad_get_button_number,
|
||||
libinput_event_tablet_pad_get_button_state, libinput_event_tablet_pad_get_mode,
|
||||
libinput_event_tablet_pad_get_mode_group, libinput_event_tablet_pad_get_ring_number,
|
||||
libinput_event_tablet_pad_get_ring_position, libinput_event_tablet_pad_get_ring_source,
|
||||
libinput_event_tablet_pad_get_strip_number,
|
||||
libinput_event_tablet_pad_get_strip_position,
|
||||
libinput_event_tablet_pad_get_strip_source, libinput_event_tablet_pad_get_time_usec,
|
||||
libinput_event_tablet_tool, libinput_event_tablet_tool_get_button,
|
||||
libinput_event_tablet_tool_get_button_state,
|
||||
libinput_event_tablet_tool_get_proximity_state,
|
||||
libinput_event_tablet_tool_get_time_usec, libinput_event_tablet_tool_get_tip_state,
|
||||
libinput_event_tablet_tool_get_tool,
|
||||
libinput_event_tablet_tool_get_wheel_delta_discrete,
|
||||
libinput_event_tablet_tool_get_x_transformed,
|
||||
libinput_event_tablet_tool_get_y_transformed, libinput_tablet_tool,
|
||||
libinput_tablet_tool_get_serial, libinput_tablet_tool_get_tool_id,
|
||||
libinput_tablet_tool_get_type, libinput_tablet_tool_get_user_data,
|
||||
libinput_tablet_tool_set_user_data,
|
||||
},
|
||||
},
|
||||
std::marker::PhantomData,
|
||||
|
|
@ -51,6 +74,21 @@ pub struct LibInputEventSwitch<'a> {
|
|||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct LibInputEventTabletTool<'a> {
|
||||
pub(super) event: *mut libinput_event_tablet_tool,
|
||||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct LibInputEventTabletPad<'a> {
|
||||
pub(super) event: *mut libinput_event_tablet_pad,
|
||||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
pub struct LibInputTabletTool<'a> {
|
||||
pub(super) tool: *mut libinput_tablet_tool,
|
||||
pub(super) _phantom: PhantomData<&'a ()>,
|
||||
}
|
||||
|
||||
impl<'a> Drop for LibInputEvent<'a> {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
|
|
@ -59,6 +97,22 @@ impl<'a> Drop for LibInputEvent<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! converter {
|
||||
($name:ident, $out:ident, $f:ident) => {
|
||||
pub fn $name(&self) -> Option<$out> {
|
||||
let res = unsafe { $f(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some($out {
|
||||
event: res,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl<'a> LibInputEvent<'a> {
|
||||
pub fn ty(&self) -> EventType {
|
||||
unsafe { EventType(libinput_event_get_type(self.event)) }
|
||||
|
|
@ -71,53 +125,36 @@ impl<'a> LibInputEvent<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn keyboard_event(&self) -> Option<LibInputEventKeyboard> {
|
||||
let res = unsafe { libinput_event_get_keyboard_event(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(LibInputEventKeyboard {
|
||||
event: res,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn pointer_event(&self) -> Option<LibInputEventPointer> {
|
||||
let res = unsafe { libinput_event_get_pointer_event(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(LibInputEventPointer {
|
||||
event: res,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn gesture_event(&self) -> Option<LibInputEventGesture> {
|
||||
let res = unsafe { libinput_event_get_gesture_event(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(LibInputEventGesture {
|
||||
event: res,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn switch_event(&self) -> Option<LibInputEventSwitch> {
|
||||
let res = unsafe { libinput_event_get_switch_event(self.event) };
|
||||
if res.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(LibInputEventSwitch {
|
||||
event: res,
|
||||
_phantom: Default::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
converter!(
|
||||
keyboard_event,
|
||||
LibInputEventKeyboard,
|
||||
libinput_event_get_keyboard_event
|
||||
);
|
||||
converter!(
|
||||
pointer_event,
|
||||
LibInputEventPointer,
|
||||
libinput_event_get_pointer_event
|
||||
);
|
||||
converter!(
|
||||
gesture_event,
|
||||
LibInputEventGesture,
|
||||
libinput_event_get_gesture_event
|
||||
);
|
||||
converter!(
|
||||
switch_event,
|
||||
LibInputEventSwitch,
|
||||
libinput_event_get_switch_event
|
||||
);
|
||||
converter!(
|
||||
tablet_tool_event,
|
||||
LibInputEventTabletTool,
|
||||
libinput_event_get_tablet_tool_event
|
||||
);
|
||||
converter!(
|
||||
tablet_pad_event,
|
||||
LibInputEventTabletPad,
|
||||
libinput_event_get_tablet_pad_event
|
||||
);
|
||||
}
|
||||
|
||||
impl<'a> LibInputEventKeyboard<'a> {
|
||||
|
|
@ -228,3 +265,205 @@ impl<'a> LibInputEventSwitch<'a> {
|
|||
unsafe { SwitchState(libinput_event_switch_get_switch_state(self.event)) }
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! has_changed {
|
||||
($name:ident, $f:ident) => {
|
||||
pub fn $name(&self) -> bool {
|
||||
unsafe { crate::libinput::sys::$f(self.event) != 0 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! get_double {
|
||||
($name:ident, $f:ident) => {
|
||||
pub fn $name(&self) -> f64 {
|
||||
unsafe { crate::libinput::sys::$f(self.event) }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! has_capability {
|
||||
($name:ident, $f:ident) => {
|
||||
pub fn $name(&self) -> bool {
|
||||
unsafe { crate::libinput::sys::$f(self.tool) != 0 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
impl<'a> LibInputTabletTool<'a> {
|
||||
pub fn user_data(&self) -> usize {
|
||||
unsafe { libinput_tablet_tool_get_user_data(self.tool) }
|
||||
}
|
||||
|
||||
pub fn set_user_data(&self, user_data: usize) {
|
||||
unsafe { libinput_tablet_tool_set_user_data(self.tool, user_data) }
|
||||
}
|
||||
|
||||
pub fn type_(&self) -> TabletToolType {
|
||||
unsafe { TabletToolType(libinput_tablet_tool_get_type(self.tool)) }
|
||||
}
|
||||
|
||||
pub fn tool_id(&self) -> u64 {
|
||||
unsafe { libinput_tablet_tool_get_tool_id(self.tool) }
|
||||
}
|
||||
|
||||
pub fn serial(&self) -> u64 {
|
||||
unsafe { libinput_tablet_tool_get_serial(self.tool) }
|
||||
}
|
||||
|
||||
has_capability!(has_pressure, libinput_tablet_tool_has_pressure);
|
||||
has_capability!(has_distance, libinput_tablet_tool_has_distance);
|
||||
has_capability!(has_tilt, libinput_tablet_tool_has_tilt);
|
||||
has_capability!(has_rotation, libinput_tablet_tool_has_rotation);
|
||||
has_capability!(has_slider, libinput_tablet_tool_has_slider);
|
||||
// has_capability!(has_size, libinput_tablet_tool_has_size);
|
||||
has_capability!(has_wheel, libinput_tablet_tool_has_wheel);
|
||||
}
|
||||
|
||||
impl<'a> LibInputEventTabletTool<'a> {
|
||||
pub fn tool(&self) -> LibInputTabletTool<'_> {
|
||||
LibInputTabletTool {
|
||||
tool: unsafe { libinput_event_tablet_tool_get_tool(self.event) },
|
||||
_phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn time_usec(&self) -> u64 {
|
||||
unsafe { libinput_event_tablet_tool_get_time_usec(self.event) }
|
||||
}
|
||||
|
||||
has_changed!(x_has_changed, libinput_event_tablet_tool_x_has_changed);
|
||||
has_changed!(y_has_changed, libinput_event_tablet_tool_y_has_changed);
|
||||
has_changed!(
|
||||
pressure_has_changed,
|
||||
libinput_event_tablet_tool_pressure_has_changed
|
||||
);
|
||||
has_changed!(
|
||||
distance_has_changed,
|
||||
libinput_event_tablet_tool_distance_has_changed
|
||||
);
|
||||
has_changed!(
|
||||
tilt_x_has_changed,
|
||||
libinput_event_tablet_tool_tilt_x_has_changed
|
||||
);
|
||||
has_changed!(
|
||||
tilt_y_has_changed,
|
||||
libinput_event_tablet_tool_tilt_y_has_changed
|
||||
);
|
||||
has_changed!(
|
||||
rotation_has_changed,
|
||||
libinput_event_tablet_tool_rotation_has_changed
|
||||
);
|
||||
has_changed!(
|
||||
slider_has_changed,
|
||||
libinput_event_tablet_tool_slider_has_changed
|
||||
);
|
||||
// has_changed!(
|
||||
// size_major_has_changed,
|
||||
// libinput_event_tablet_tool_size_major_has_changed
|
||||
// );
|
||||
// has_changed!(
|
||||
// size_minor_has_changed,
|
||||
// libinput_event_tablet_tool_size_minor_has_changed
|
||||
// );
|
||||
has_changed!(
|
||||
wheel_has_changed,
|
||||
libinput_event_tablet_tool_wheel_has_changed
|
||||
);
|
||||
|
||||
// get_double!(x, libinput_event_tablet_tool_get_x);
|
||||
// get_double!(y, libinput_event_tablet_tool_get_y);
|
||||
get_double!(dx, libinput_event_tablet_tool_get_dx);
|
||||
get_double!(dy, libinput_event_tablet_tool_get_dy);
|
||||
get_double!(pressure, libinput_event_tablet_tool_get_pressure);
|
||||
get_double!(distance, libinput_event_tablet_tool_get_distance);
|
||||
get_double!(tilt_x, libinput_event_tablet_tool_get_tilt_x);
|
||||
get_double!(tilt_y, libinput_event_tablet_tool_get_tilt_y);
|
||||
get_double!(rotation, libinput_event_tablet_tool_get_rotation);
|
||||
get_double!(
|
||||
slider_position,
|
||||
libinput_event_tablet_tool_get_slider_position
|
||||
);
|
||||
// get_double!(size_major, libinput_event_tablet_tool_get_size_major);
|
||||
// get_double!(size_minor, libinput_event_tablet_tool_get_size_minor);
|
||||
get_double!(wheel_delta, libinput_event_tablet_tool_get_wheel_delta);
|
||||
|
||||
pub fn wheel_delta_discrete(&self) -> i32 {
|
||||
unsafe { libinput_event_tablet_tool_get_wheel_delta_discrete(self.event) as _ }
|
||||
}
|
||||
|
||||
pub fn x_transformed(&self, width: u32) -> f64 {
|
||||
unsafe { libinput_event_tablet_tool_get_x_transformed(self.event, width) }
|
||||
}
|
||||
|
||||
pub fn y_transformed(&self, width: u32) -> f64 {
|
||||
unsafe { libinput_event_tablet_tool_get_y_transformed(self.event, width) }
|
||||
}
|
||||
|
||||
pub fn proximity_state(&self) -> TabletToolProximityState {
|
||||
unsafe {
|
||||
TabletToolProximityState(libinput_event_tablet_tool_get_proximity_state(self.event))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tip_state(&self) -> TabletToolTipState {
|
||||
unsafe { TabletToolTipState(libinput_event_tablet_tool_get_tip_state(self.event)) }
|
||||
}
|
||||
|
||||
pub fn button(&self) -> u32 {
|
||||
unsafe { libinput_event_tablet_tool_get_button(self.event) }
|
||||
}
|
||||
|
||||
pub fn button_state(&self) -> ButtonState {
|
||||
unsafe { ButtonState(libinput_event_tablet_tool_get_button_state(self.event)) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> LibInputEventTabletPad<'a> {
|
||||
pub fn time_usec(&self) -> u64 {
|
||||
unsafe { libinput_event_tablet_pad_get_time_usec(self.event) }
|
||||
}
|
||||
|
||||
pub fn ring_position(&self) -> f64 {
|
||||
unsafe { libinput_event_tablet_pad_get_ring_position(self.event) }
|
||||
}
|
||||
|
||||
pub fn ring_number(&self) -> u32 {
|
||||
unsafe { libinput_event_tablet_pad_get_ring_number(self.event) as u32 }
|
||||
}
|
||||
|
||||
pub fn ring_source(&self) -> TabletPadRingAxisSource {
|
||||
unsafe { TabletPadRingAxisSource(libinput_event_tablet_pad_get_ring_source(self.event)) }
|
||||
}
|
||||
|
||||
pub fn strip_position(&self) -> f64 {
|
||||
unsafe { libinput_event_tablet_pad_get_strip_position(self.event) }
|
||||
}
|
||||
|
||||
pub fn strip_number(&self) -> u32 {
|
||||
unsafe { libinput_event_tablet_pad_get_strip_number(self.event) as u32 }
|
||||
}
|
||||
|
||||
pub fn strip_source(&self) -> TabletPadStripAxisSource {
|
||||
unsafe { TabletPadStripAxisSource(libinput_event_tablet_pad_get_strip_source(self.event)) }
|
||||
}
|
||||
|
||||
pub fn button_number(&self) -> u32 {
|
||||
unsafe { libinput_event_tablet_pad_get_button_number(self.event) }
|
||||
}
|
||||
|
||||
pub fn button_state(&self) -> ButtonState {
|
||||
unsafe { ButtonState(libinput_event_tablet_pad_get_button_state(self.event)) }
|
||||
}
|
||||
|
||||
pub fn mode(&self) -> u32 {
|
||||
unsafe { libinput_event_tablet_pad_get_mode(self.event) as u32 }
|
||||
}
|
||||
|
||||
pub fn mode_group(&self) -> LibInputTabletPadModeGroup {
|
||||
LibInputTabletPadModeGroup {
|
||||
group: unsafe { libinput_event_tablet_pad_get_mode_group(self.event) },
|
||||
_phantom: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ pub struct libinput(u8);
|
|||
#[repr(transparent)]
|
||||
pub struct libinput_device(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_device_group(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_event(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_event_keyboard(u8);
|
||||
|
|
@ -18,6 +20,16 @@ pub struct libinput_event_pointer(u8);
|
|||
pub struct libinput_event_gesture(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_event_switch(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_event_tablet_tool(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_event_tablet_pad(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_tablet_pad_mode_group(u8);
|
||||
#[repr(transparent)]
|
||||
pub struct libinput_tablet_tool(u8);
|
||||
// #[repr(transparent)]
|
||||
// pub struct libinput_tablet_pad(u8);
|
||||
|
||||
#[link(name = "input")]
|
||||
extern "C" {
|
||||
|
|
@ -166,6 +178,185 @@ extern "C" {
|
|||
event: *mut libinput_event_switch,
|
||||
) -> libinput_switch_state;
|
||||
pub fn libinput_event_switch_get_time_usec(event: *mut libinput_event_switch) -> u64;
|
||||
|
||||
pub fn libinput_device_get_device_group(
|
||||
device: *mut libinput_device,
|
||||
) -> *mut libinput_device_group;
|
||||
pub fn libinput_device_group_set_user_data(group: *mut libinput_device_group, user_data: usize);
|
||||
pub fn libinput_device_group_get_user_data(group: *mut libinput_device_group) -> usize;
|
||||
|
||||
pub fn libinput_device_get_id_product(device: *mut libinput_device) -> c::c_uint;
|
||||
pub fn libinput_device_get_id_vendor(device: *mut libinput_device) -> c::c_uint;
|
||||
|
||||
pub fn libinput_event_get_tablet_tool_event(
|
||||
event: *mut libinput_event,
|
||||
) -> *mut libinput_event_tablet_tool;
|
||||
pub fn libinput_event_get_tablet_pad_event(
|
||||
event: *mut libinput_event,
|
||||
) -> *mut libinput_event_tablet_pad;
|
||||
pub fn libinput_event_tablet_tool_get_tool(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> *mut libinput_tablet_tool;
|
||||
pub fn libinput_event_tablet_pad_get_mode_group(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> *mut libinput_tablet_pad_mode_group;
|
||||
pub fn libinput_event_tablet_tool_x_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_y_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_pressure_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_distance_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_tilt_x_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_tilt_y_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_rotation_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_slider_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
// pub fn libinput_event_tablet_tool_size_major_has_changed(
|
||||
// event: *mut libinput_event_tablet_tool,
|
||||
// ) -> c::c_int;
|
||||
// pub fn libinput_event_tablet_tool_size_minor_has_changed(
|
||||
// event: *mut libinput_event_tablet_tool,
|
||||
// ) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_wheel_has_changed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
// pub fn libinput_event_tablet_tool_get_x(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
// pub fn libinput_event_tablet_tool_get_y(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_dx(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_dy(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_pressure(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_distance(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_tilt_x(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_tilt_y(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_rotation(event: *mut libinput_event_tablet_tool) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_slider_position(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> f64;
|
||||
// pub fn libinput_event_tablet_tool_get_size_major(event: *mut libinput_event_tablet_tool)
|
||||
// -> f64;
|
||||
// pub fn libinput_event_tablet_tool_get_size_minor(event: *mut libinput_event_tablet_tool)
|
||||
// -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_wheel_delta(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_wheel_delta_discrete(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_event_tablet_tool_get_x_transformed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
width: u32,
|
||||
) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_y_transformed(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
width: u32,
|
||||
) -> f64;
|
||||
pub fn libinput_event_tablet_tool_get_proximity_state(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> libinput_tablet_tool_proximity_state;
|
||||
pub fn libinput_event_tablet_tool_get_tip_state(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> libinput_tablet_tool_tip_state;
|
||||
pub fn libinput_event_tablet_tool_get_button(event: *mut libinput_event_tablet_tool) -> u32;
|
||||
pub fn libinput_event_tablet_tool_get_button_state(
|
||||
event: *mut libinput_event_tablet_tool,
|
||||
) -> libinput_button_state;
|
||||
// pub fn libinput_event_tablet_tool_get_seat_button_count(
|
||||
// event: *mut libinput_event_tablet_tool,
|
||||
// ) -> u32;
|
||||
pub fn libinput_event_tablet_tool_get_time_usec(event: *mut libinput_event_tablet_tool) -> u64;
|
||||
pub fn libinput_tablet_tool_get_type(
|
||||
tool: *mut libinput_tablet_tool,
|
||||
) -> libinput_tablet_tool_type;
|
||||
pub fn libinput_tablet_tool_get_tool_id(tool: *mut libinput_tablet_tool) -> u64;
|
||||
pub fn libinput_tablet_tool_has_pressure(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_has_distance(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_has_tilt(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_has_rotation(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_has_slider(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
// pub fn libinput_tablet_tool_has_size(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_has_wheel(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
// pub fn libinput_tablet_tool_has_button(tool: *mut libinput_tablet_tool, code: u32) -> c::c_int;
|
||||
// pub fn libinput_tablet_tool_is_unique(tool: *mut libinput_tablet_tool) -> c::c_int;
|
||||
pub fn libinput_tablet_tool_get_serial(tool: *mut libinput_tablet_tool) -> u64;
|
||||
pub fn libinput_tablet_tool_get_user_data(tool: *mut libinput_tablet_tool) -> usize;
|
||||
pub fn libinput_tablet_tool_set_user_data(tool: *mut libinput_tablet_tool, user_data: usize);
|
||||
pub fn libinput_event_tablet_pad_get_ring_position(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> f64;
|
||||
pub fn libinput_event_tablet_pad_get_ring_number(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> c::c_uint;
|
||||
pub fn libinput_event_tablet_pad_get_ring_source(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> libinput_tablet_pad_ring_axis_source;
|
||||
pub fn libinput_event_tablet_pad_get_strip_position(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> f64;
|
||||
pub fn libinput_event_tablet_pad_get_strip_number(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> c::c_uint;
|
||||
pub fn libinput_event_tablet_pad_get_strip_source(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> libinput_tablet_pad_strip_axis_source;
|
||||
pub fn libinput_event_tablet_pad_get_button_number(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> u32;
|
||||
pub fn libinput_event_tablet_pad_get_button_state(
|
||||
event: *mut libinput_event_tablet_pad,
|
||||
) -> libinput_button_state;
|
||||
// pub fn libinput_event_tablet_pad_get_key(event: *mut libinput_event_tablet_pad) -> u32;
|
||||
// pub fn libinput_event_tablet_pad_get_key_state(
|
||||
// event: *mut libinput_event_tablet_pad,
|
||||
// ) -> libinput_key_state;
|
||||
pub fn libinput_event_tablet_pad_get_mode(event: *mut libinput_event_tablet_pad) -> c::c_uint;
|
||||
pub fn libinput_event_tablet_pad_get_time_usec(event: *mut libinput_event_tablet_pad) -> u64;
|
||||
pub fn libinput_device_tablet_pad_get_mode_group(
|
||||
device: *mut libinput_device,
|
||||
index: c::c_uint,
|
||||
) -> *mut libinput_tablet_pad_mode_group;
|
||||
pub fn libinput_device_tablet_pad_get_num_mode_groups(device: *mut libinput_device)
|
||||
-> c::c_int;
|
||||
pub fn libinput_device_tablet_pad_get_num_buttons(device: *mut libinput_device) -> c::c_int;
|
||||
pub fn libinput_device_tablet_pad_get_num_rings(device: *mut libinput_device) -> c::c_int;
|
||||
pub fn libinput_device_tablet_pad_get_num_strips(device: *mut libinput_device) -> c::c_int;
|
||||
pub fn libinput_tablet_pad_mode_group_get_index(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
) -> c::c_uint;
|
||||
pub fn libinput_tablet_pad_mode_group_get_num_modes(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
) -> c::c_uint;
|
||||
pub fn libinput_tablet_pad_mode_group_get_mode(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
) -> c::c_uint;
|
||||
pub fn libinput_tablet_pad_mode_group_has_button(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
button: c::c_uint,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_tablet_pad_mode_group_has_ring(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
ring: c::c_uint,
|
||||
) -> c::c_int;
|
||||
pub fn libinput_tablet_pad_mode_group_has_strip(
|
||||
group: *mut libinput_tablet_pad_mode_group,
|
||||
strip: c::c_uint,
|
||||
) -> c::c_int;
|
||||
// pub fn libinput_tablet_pad_mode_group_button_is_toggle(
|
||||
// group: *mut libinput_tablet_pad_mode_group,
|
||||
// button: c::c_uint,
|
||||
// ) -> c::c_int;
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue