Turn MtBlobId into an axis

This commit is contained in:
Jan Trefil 2023-06-20 22:22:30 +02:00
parent 9b9a63ace8
commit 1fbcb0c606
3 changed files with 3 additions and 4 deletions

View file

@ -6,8 +6,6 @@ use serde::{Deserialize, Serialize};
pub enum AbsEvent {
Axis { axis: AbsAxis, value: i32 },
MtToolType { value: ToolType },
// TODO: This might actually belong to the Axis variant.
MtBlobId { value: i32 },
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
@ -47,6 +45,7 @@ pub enum AbsAxis {
MtOrientation,
MtPositionX,
MtPositionY,
MtBlobId,
MtTrackingId,
MtPressure,
MtDistance,
@ -92,6 +91,7 @@ impl AbsAxis {
glue::ABS_MT_ORIENTATION => Self::MtOrientation,
glue::ABS_MT_POSITION_X => Self::MtPositionX,
glue::ABS_MT_POSITION_Y => Self::MtPositionY,
glue::ABS_MT_BLOB_ID => Self::MtBlobId,
glue::ABS_MT_TRACKING_ID => Self::MtTrackingId,
glue::ABS_MT_PRESSURE => Self::MtPressure,
glue::ABS_MT_DISTANCE => Self::MtDistance,
@ -140,6 +140,7 @@ impl AbsAxis {
Self::MtOrientation => glue::ABS_MT_ORIENTATION,
Self::MtPositionX => glue::ABS_MT_POSITION_X,
Self::MtPositionY => glue::ABS_MT_POSITION_Y,
Self::MtBlobId => glue::ABS_MT_BLOB_ID,
Self::MtTrackingId => glue::ABS_MT_TRACKING_ID,
Self::MtPressure => glue::ABS_MT_PRESSURE,
Self::MtDistance => glue::ABS_MT_DISTANCE,

View file

@ -52,7 +52,6 @@ impl Interceptor {
glue::ABS_MT_TOOL_TYPE => {
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 }),
}
.map(Event::Abs),

View file

@ -34,7 +34,6 @@ impl Writer {
AbsEvent::MtToolType { value } => {
(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::Sync(event) => (glue::EV_SYN, event.to_raw(), 0),