From 4c5e2be11e8bb90a4a753db0069d256a57bfc44d Mon Sep 17 00:00:00 2001 From: Drakulix Date: Wed, 26 Apr 2017 20:09:57 +0200 Subject: [PATCH] Update libinput to v0.1.1 --- Cargo.toml | 2 +- src/backend/libinput.rs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a72b80a..3527288 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ slog = { version = "2.0.0" } slog-stdlog = "2.0.0-0.2" glutin = { version = "~0.7.4", 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 } [dev-dependencies] diff --git a/src/backend/libinput.rs b/src/backend/libinput.rs index 80008a8..aa4a5f5 100644 --- a/src/backend/libinput.rs +++ b/src/backend/libinput.rs @@ -8,6 +8,7 @@ use input::event; use std::io::Error as IoError; use std::collections::hash_map::{DefaultHasher, Entry, HashMap}; use std::hash::{Hash, Hasher}; +use std::rc::Rc; /// 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` pub struct PointerAxisEvent { axis: event::pointer::Axis, - event: event::pointer::PointerAxisEvent, + event: Rc, } impl<'a> backend::Event for PointerAxisEvent { @@ -435,18 +436,19 @@ impl backend::InputBackend for LibinputInputBackend { handler.on_pointer_move_absolute(seat, motion_abs_event); }, PointerEvent::Axis(axis_event) => { - if axis_event.has_axis(Axis::Vertical) { - trace!(self.logger, "Calling on_pointer_axis for Axis::Vertical with {:?}", axis_event); + let rc_axis_event = Rc::new(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 { axis: Axis::Vertical, - event: axis_event.clone() + event: rc_axis_event.clone() }); } - if axis_event.has_axis(Axis::Horizontal) { - trace!(self.logger, "Calling on_pointer_axis for Axis::Horizontal with {:?}", axis_event); + if rc_axis_event.has_axis(Axis::Horizontal) { + trace!(self.logger, "Calling on_pointer_axis for Axis::Horizontal with {:?}", *rc_axis_event); handler.on_pointer_axis(seat, self::PointerAxisEvent { axis: Axis::Horizontal, - event: axis_event.clone() + event: rc_axis_event.clone() }); } },