Allow relative mouse movement to be negative

This commit is contained in:
Drakulix 2018-03-13 15:06:52 +01:00
parent ae41584db9
commit 81375a085f
2 changed files with 9 additions and 9 deletions

View File

@ -239,22 +239,22 @@ impl PointerAxisEvent for UnusedEvent {
/// Trait for pointer events generated by relative device movement.
pub trait PointerMotionEvent: Event {
/// Delta between the last and new pointer device position interpreted as pixel movement
fn delta(&self) -> (u32, u32) {
fn delta(&self) -> (i32, i32) {
(self.delta_x(), self.delta_y())
}
/// Delta on the x axis between the last and new pointer device position interpreted as pixel movement
fn delta_x(&self) -> u32;
fn delta_x(&self) -> i32;
/// Delta on the y axis between the last and new pointer device position interpreted as pixel movement
fn delta_y(&self) -> u32;
fn delta_y(&self) -> i32;
}
impl PointerMotionEvent for UnusedEvent {
fn delta_x(&self) -> u32 {
fn delta_x(&self) -> i32 {
match *self {}
}
fn delta_y(&self) -> u32 {
fn delta_y(&self) -> i32 {
match *self {}
}
}

View File

@ -133,11 +133,11 @@ impl backend::Event for event::pointer::PointerMotionEvent {
}
impl backend::PointerMotionEvent for event::pointer::PointerMotionEvent {
fn delta_x(&self) -> u32 {
self.dx() as u32
fn delta_x(&self) -> i32 {
self.dx() as i32
}
fn delta_y(&self) -> u32 {
self.dy() as u32
fn delta_y(&self) -> i32 {
self.dy() as i32
}
}