diff --git a/src/input/wacom.rs b/src/input/wacom.rs index 43a1521..473dfd2 100644 --- a/src/input/wacom.rs +++ b/src/input/wacom.rs @@ -22,7 +22,7 @@ pub struct WacomState { last_ytilt: AtomicU16, last_dist: AtomicU16, last_pressure: AtomicU16, - last_tool: Atomic>, + last_touch_state: Atomic, } impl ::std::default::Default for WacomState { @@ -34,7 +34,7 @@ impl ::std::default::Default for WacomState { last_ytilt: AtomicU16::new(0), last_dist: AtomicU16::new(0), last_pressure: AtomicU16::new(0), - last_tool: Atomic::new(None), + last_touch_state: Atomic::new(false), } } } @@ -88,8 +88,8 @@ pub fn decode(ev: &EvInputEvent, outer_state: &InputDeviceState) -> Option unreachable!(), }; match ev.event_type().0 { - ecodes::EV_SYN => match state.last_tool.load(Ordering::Relaxed) { - Some(WacomPen::ToolPen) => Some(InputEvent::WacomEvent { + ecodes::EV_SYN => match state.last_touch_state.load(Ordering::Relaxed) { + false => Some(InputEvent::WacomEvent { event: WacomEvent::Hover { position: cgmath::Point2 { x: (f32::from(state.last_x.load(Ordering::Relaxed)) * *WACOM_HSCALAR), @@ -102,7 +102,7 @@ pub fn decode(ev: &EvInputEvent, outer_state: &InputDeviceState) -> Option Some(InputEvent::WacomEvent { + true => Some(InputEvent::WacomEvent { event: WacomEvent::Draw { position: cgmath::Point2 { x: (f32::from(state.last_x.load(Ordering::Relaxed)) * *WACOM_HSCALAR), @@ -115,7 +115,6 @@ pub fn decode(ev: &EvInputEvent, outer_state: &InputDeviceState) -> Option None, }, ecodes::EV_KEY => { /* key (device detected - device out of range etc.) */ @@ -124,12 +123,16 @@ pub fn decode(ev: &EvInputEvent, outer_state: &InputDeviceState) -> Option Option {