Merge pull request #80 from Smithay/fix/relative_mouse_events

Allow relative mouse movement to be negative
This commit is contained in:
Victor Brekenfeld 2018-03-13 18:41:14 +01:00 committed by GitHub
commit e17ebbd9e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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. /// Trait for pointer events generated by relative device movement.
pub trait PointerMotionEvent: Event { pub trait PointerMotionEvent: Event {
/// Delta between the last and new pointer device position interpreted as pixel movement /// 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()) (self.delta_x(), self.delta_y())
} }
/// Delta on the x axis between the last and new pointer device position interpreted as pixel movement /// 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 /// 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 { impl PointerMotionEvent for UnusedEvent {
fn delta_x(&self) -> u32 { fn delta_x(&self) -> i32 {
match *self {} match *self {}
} }
fn delta_y(&self) -> u32 { fn delta_y(&self) -> i32 {
match *self {} match *self {}
} }
} }

View File

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