use wlroots_sys::{wlr_event_touch_cancel, wlr_event_touch_down, wlr_event_touch_motion,
wlr_event_touch_up};
#[derive(Debug)]
pub struct Down {
event: *mut wlr_event_touch_down
}
#[derive(Debug)]
pub struct Up {
event: *mut wlr_event_touch_up
}
#[derive(Debug)]
pub struct Motion {
event: *mut wlr_event_touch_motion
}
#[derive(Debug)]
pub struct Cancel {
event: *mut wlr_event_touch_cancel
}
impl Down {
pub(crate) unsafe fn from_ptr(event: *mut wlr_event_touch_down) -> Self {
Down { event }
}
pub fn time_msec(&self) -> u32 {
unsafe { (*self.event).time_msec }
}
pub fn touch_id(&self) -> i32 {
unsafe { (*self.event).touch_id }
}
pub fn location(&self) -> (f64, f64) {
unsafe { ((*self.event).x, (*self.event).y) }
}
}
impl Up {
pub(crate) unsafe fn from_ptr(event: *mut wlr_event_touch_up) -> Self {
Up { event }
}
pub fn time_msec(&self) -> u32 {
unsafe { (*self.event).time_msec }
}
pub fn touch_id(&self) -> i32 {
unsafe { (*self.event).touch_id }
}
}
impl Motion {
pub(crate) unsafe fn from_ptr(event: *mut wlr_event_touch_motion) -> Self {
Motion { event }
}
pub fn time_msec(&self) -> u32 {
unsafe { (*self.event).time_msec }
}
pub fn touch_id(&self) -> i32 {
unsafe { (*self.event).touch_id }
}
pub fn location(&self) -> (f64, f64) {
unsafe { ((*self.event).x, (*self.event).y) }
}
}
impl Cancel {
pub(crate) unsafe fn from_ptr(event: *mut wlr_event_touch_cancel) -> Self {
Cancel { event }
}
pub fn time_msec(&self) -> u32 {
unsafe { (*self.event).time_msec }
}
pub fn touch_id(&self) -> i32 {
unsafe { (*self.event).touch_id }
}
}