Update libinput to v0.1.1

This commit is contained in:
Drakulix 2017-04-26 20:09:57 +02:00
parent 29ac97b4a7
commit 4c5e2be11e
2 changed files with 10 additions and 8 deletions

View File

@ -13,7 +13,7 @@ slog = { version = "2.0.0" }
slog-stdlog = "2.0.0-0.2" slog-stdlog = "2.0.0-0.2"
glutin = { version = "~0.7.4", optional = true } glutin = { version = "~0.7.4", optional = true }
glium = { version = "~0.16.0", optional = true } glium = { version = "~0.16.0", optional = true }
input = { version = "0.1", optional = true } input = { version = "~0.1.1", optional = true }
clippy = { version = "*", optional = true } clippy = { version = "*", optional = true }
[dev-dependencies] [dev-dependencies]

View File

@ -8,6 +8,7 @@ use input::event;
use std::io::Error as IoError; use std::io::Error as IoError;
use std::collections::hash_map::{DefaultHasher, Entry, HashMap}; use std::collections::hash_map::{DefaultHasher, Entry, HashMap};
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use std::rc::Rc;
/// Libinput based `InputBackend`. /// Libinput based `InputBackend`.
/// ///
@ -64,7 +65,7 @@ impl backend::KeyboardKeyEvent for event::keyboard::KeyboardKeyEvent {
/// Wrapper for libinput pointer axis events to implement `backend::input::PointerAxisEvent` /// Wrapper for libinput pointer axis events to implement `backend::input::PointerAxisEvent`
pub struct PointerAxisEvent { pub struct PointerAxisEvent {
axis: event::pointer::Axis, axis: event::pointer::Axis,
event: event::pointer::PointerAxisEvent, event: Rc<event::pointer::PointerAxisEvent>,
} }
impl<'a> backend::Event for PointerAxisEvent { impl<'a> backend::Event for PointerAxisEvent {
@ -435,18 +436,19 @@ impl backend::InputBackend for LibinputInputBackend {
handler.on_pointer_move_absolute(seat, motion_abs_event); handler.on_pointer_move_absolute(seat, motion_abs_event);
}, },
PointerEvent::Axis(axis_event) => { PointerEvent::Axis(axis_event) => {
if axis_event.has_axis(Axis::Vertical) { let rc_axis_event = Rc::new(axis_event);
trace!(self.logger, "Calling on_pointer_axis for Axis::Vertical with {:?}", axis_event); if rc_axis_event.has_axis(Axis::Vertical) {
trace!(self.logger, "Calling on_pointer_axis for Axis::Vertical with {:?}", *rc_axis_event);
handler.on_pointer_axis(seat, self::PointerAxisEvent { handler.on_pointer_axis(seat, self::PointerAxisEvent {
axis: Axis::Vertical, axis: Axis::Vertical,
event: axis_event.clone() event: rc_axis_event.clone()
}); });
} }
if axis_event.has_axis(Axis::Horizontal) { if rc_axis_event.has_axis(Axis::Horizontal) {
trace!(self.logger, "Calling on_pointer_axis for Axis::Horizontal with {:?}", axis_event); trace!(self.logger, "Calling on_pointer_axis for Axis::Horizontal with {:?}", *rc_axis_event);
handler.on_pointer_axis(seat, self::PointerAxisEvent { handler.on_pointer_axis(seat, self::PointerAxisEvent {
axis: Axis::Horizontal, axis: Axis::Horizontal,
event: axis_event.clone() event: rc_axis_event.clone()
}); });
} }
}, },