mirror of
https://github.com/htrefil/rkvm.git
synced 2024-11-16 07:47:24 +01:00
Turn MtBlobId into an axis
This commit is contained in:
parent
9b9a63ace8
commit
1fbcb0c606
3 changed files with 3 additions and 4 deletions
|
@ -6,8 +6,6 @@ use serde::{Deserialize, Serialize};
|
||||||
pub enum AbsEvent {
|
pub enum AbsEvent {
|
||||||
Axis { axis: AbsAxis, value: i32 },
|
Axis { axis: AbsAxis, value: i32 },
|
||||||
MtToolType { value: ToolType },
|
MtToolType { value: ToolType },
|
||||||
// TODO: This might actually belong to the Axis variant.
|
|
||||||
MtBlobId { value: i32 },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
|
||||||
|
@ -47,6 +45,7 @@ pub enum AbsAxis {
|
||||||
MtOrientation,
|
MtOrientation,
|
||||||
MtPositionX,
|
MtPositionX,
|
||||||
MtPositionY,
|
MtPositionY,
|
||||||
|
MtBlobId,
|
||||||
MtTrackingId,
|
MtTrackingId,
|
||||||
MtPressure,
|
MtPressure,
|
||||||
MtDistance,
|
MtDistance,
|
||||||
|
@ -92,6 +91,7 @@ impl AbsAxis {
|
||||||
glue::ABS_MT_ORIENTATION => Self::MtOrientation,
|
glue::ABS_MT_ORIENTATION => Self::MtOrientation,
|
||||||
glue::ABS_MT_POSITION_X => Self::MtPositionX,
|
glue::ABS_MT_POSITION_X => Self::MtPositionX,
|
||||||
glue::ABS_MT_POSITION_Y => Self::MtPositionY,
|
glue::ABS_MT_POSITION_Y => Self::MtPositionY,
|
||||||
|
glue::ABS_MT_BLOB_ID => Self::MtBlobId,
|
||||||
glue::ABS_MT_TRACKING_ID => Self::MtTrackingId,
|
glue::ABS_MT_TRACKING_ID => Self::MtTrackingId,
|
||||||
glue::ABS_MT_PRESSURE => Self::MtPressure,
|
glue::ABS_MT_PRESSURE => Self::MtPressure,
|
||||||
glue::ABS_MT_DISTANCE => Self::MtDistance,
|
glue::ABS_MT_DISTANCE => Self::MtDistance,
|
||||||
|
@ -140,6 +140,7 @@ impl AbsAxis {
|
||||||
Self::MtOrientation => glue::ABS_MT_ORIENTATION,
|
Self::MtOrientation => glue::ABS_MT_ORIENTATION,
|
||||||
Self::MtPositionX => glue::ABS_MT_POSITION_X,
|
Self::MtPositionX => glue::ABS_MT_POSITION_X,
|
||||||
Self::MtPositionY => glue::ABS_MT_POSITION_Y,
|
Self::MtPositionY => glue::ABS_MT_POSITION_Y,
|
||||||
|
Self::MtBlobId => glue::ABS_MT_BLOB_ID,
|
||||||
Self::MtTrackingId => glue::ABS_MT_TRACKING_ID,
|
Self::MtTrackingId => glue::ABS_MT_TRACKING_ID,
|
||||||
Self::MtPressure => glue::ABS_MT_PRESSURE,
|
Self::MtPressure => glue::ABS_MT_PRESSURE,
|
||||||
Self::MtDistance => glue::ABS_MT_DISTANCE,
|
Self::MtDistance => glue::ABS_MT_DISTANCE,
|
||||||
|
|
|
@ -52,7 +52,6 @@ impl Interceptor {
|
||||||
glue::ABS_MT_TOOL_TYPE => {
|
glue::ABS_MT_TOOL_TYPE => {
|
||||||
ToolType::from_raw(value).map(|value| AbsEvent::MtToolType { value })
|
ToolType::from_raw(value).map(|value| AbsEvent::MtToolType { value })
|
||||||
}
|
}
|
||||||
glue::ABS_MT_BLOB_ID => Some(AbsEvent::MtBlobId { value }),
|
|
||||||
_ => AbsAxis::from_raw(code).map(|axis| AbsEvent::Axis { axis, value }),
|
_ => AbsAxis::from_raw(code).map(|axis| AbsEvent::Axis { axis, value }),
|
||||||
}
|
}
|
||||||
.map(Event::Abs),
|
.map(Event::Abs),
|
||||||
|
|
|
@ -34,7 +34,6 @@ impl Writer {
|
||||||
AbsEvent::MtToolType { value } => {
|
AbsEvent::MtToolType { value } => {
|
||||||
(glue::EV_ABS, glue::ABS_MT_TOOL_TYPE as _, value.to_raw())
|
(glue::EV_ABS, glue::ABS_MT_TOOL_TYPE as _, value.to_raw())
|
||||||
}
|
}
|
||||||
AbsEvent::MtBlobId { value } => (glue::EV_ABS, glue::ABS_MT_BLOB_ID as _, *value),
|
|
||||||
},
|
},
|
||||||
Event::Key(KeyEvent { down, key }) => (glue::EV_KEY, key.to_raw(), *down as _),
|
Event::Key(KeyEvent { down, key }) => (glue::EV_KEY, key.to_raw(), *down as _),
|
||||||
Event::Sync(event) => (glue::EV_SYN, event.to_raw(), 0),
|
Event::Sync(event) => (glue::EV_SYN, event.to_raw(), 0),
|
||||||
|
|
Loading…
Reference in a new issue