Update to input-rs 0.7

This commit is contained in:
Victor Brekenfeld 2021-10-13 11:28:58 +02:00 committed by Victor Berger
parent 14a4bb25db
commit 3dde8d70ef
5 changed files with 32 additions and 10 deletions

View File

@ -11,6 +11,10 @@
- `PopupSurface::send_configure` now checks the protocol version and returns an `Result` - `PopupSurface::send_configure` now checks the protocol version and returns an `Result`
- `KeyboardHandle::input` filter closure now receives a `KeysymHandle` instead of a `Keysym` and returns a `FilterResult`. - `KeyboardHandle::input` filter closure now receives a `KeysymHandle` instead of a `Keysym` and returns a `FilterResult`.
#### Backend
- Added `TabletToolType::Unknown` as an option for tablet events
### Additions ### Additions
#### Clients & Protocols #### Clients & Protocols

View File

@ -28,7 +28,7 @@ drm-fourcc = "^2.1.1"
drm = { version = "0.5.0", optional = true } drm = { version = "0.5.0", optional = true }
drm-ffi = { version = "0.2.0", optional = true } drm-ffi = { version = "0.2.0", optional = true }
gbm = { version = "0.7.0", optional = true, default-features = false, features = ["drm-support"] } gbm = { version = "0.7.0", optional = true, default-features = false, features = ["drm-support"] }
input = { version = "0.6", default-features = false, features=["libinput_1_14"], optional = true } input = { version = "0.7", default-features = false, features=["libinput_1_14"], optional = true }
lazy_static = "1" lazy_static = "1"
libc = "0.2.103" libc = "0.2.103"
libseat= { version = "0.1.1", optional = true } libseat= { version = "0.1.1", optional = true }

View File

@ -35,6 +35,8 @@ pub enum TabletToolType {
Lens, Lens,
/// A rotary device with positional and rotation data. /// A rotary device with positional and rotation data.
Totem, Totem,
/// Type of the device is not known or does not match any known ones
Unknown,
} }
bitflags! { bitflags! {

View File

@ -19,7 +19,7 @@ use std::{
use calloop::{EventSource, Interest, Mode, Poll, PostAction, Readiness, Token, TokenFactory}; use calloop::{EventSource, Interest, Mode, Poll, PostAction, Readiness, Token, TokenFactory};
use slog::{info, o}; use slog::{info, o, trace};
mod tablet; mod tablet;
@ -403,6 +403,9 @@ impl InputBackend for LibinputInputBackend {
callback(InputEvent::DeviceRemoved { device: removed }); callback(InputEvent::DeviceRemoved { device: removed });
} }
_ => {
trace!(self.logger, "Unknown libinput device event");
}
}, },
libinput::Event::Touch(touch_event) => match touch_event { libinput::Event::Touch(touch_event) => match touch_event {
event::TouchEvent::Down(down_event) => { event::TouchEvent::Down(down_event) => {
@ -420,11 +423,17 @@ impl InputBackend for LibinputInputBackend {
event::TouchEvent::Frame(frame_event) => { event::TouchEvent::Frame(frame_event) => {
callback(InputEvent::TouchFrame { event: frame_event }); callback(InputEvent::TouchFrame { event: frame_event });
} }
_ => {
trace!(self.logger, "Unknown libinput touch event");
}
}, },
libinput::Event::Keyboard(keyboard_event) => match keyboard_event { libinput::Event::Keyboard(keyboard_event) => match keyboard_event {
event::KeyboardEvent::Key(key_event) => { event::KeyboardEvent::Key(key_event) => {
callback(InputEvent::Keyboard { event: key_event }); callback(InputEvent::Keyboard { event: key_event });
} }
_ => {
trace!(self.logger, "Unknown libinput keyboard event");
}
}, },
libinput::Event::Pointer(pointer_event) => match pointer_event { libinput::Event::Pointer(pointer_event) => match pointer_event {
event::PointerEvent::Motion(motion_event) => { event::PointerEvent::Motion(motion_event) => {
@ -441,6 +450,9 @@ impl InputBackend for LibinputInputBackend {
event::PointerEvent::Button(button_event) => { event::PointerEvent::Button(button_event) => {
callback(InputEvent::PointerButton { event: button_event }); callback(InputEvent::PointerButton { event: button_event });
} }
_ => {
trace!(self.logger, "Unknown libinput pointer event");
}
}, },
libinput::Event::Tablet(tablet_event) => match tablet_event { libinput::Event::Tablet(tablet_event) => match tablet_event {
event::TabletToolEvent::Axis(event) => { event::TabletToolEvent::Axis(event) => {
@ -455,6 +467,9 @@ impl InputBackend for LibinputInputBackend {
event::TabletToolEvent::Button(event) => { event::TabletToolEvent::Button(event) => {
callback(InputEvent::TabletToolButton { event }); callback(InputEvent::TabletToolButton { event });
} }
_ => {
trace!(self.logger, "Unknown libinput tablet event");
}
}, },
_ => {} //FIXME: What to do with the rest. _ => {} //FIXME: What to do with the rest.
} }

View File

@ -57,14 +57,15 @@ where
let tool = self.tool(); let tool = self.tool();
let tool_type = match tool.tool_type() { let tool_type = match tool.tool_type() {
tablet_tool::TabletToolType::Pen => TabletToolType::Pen, Some(tablet_tool::TabletToolType::Pen) => TabletToolType::Pen,
tablet_tool::TabletToolType::Eraser => TabletToolType::Eraser, Some(tablet_tool::TabletToolType::Eraser) => TabletToolType::Eraser,
tablet_tool::TabletToolType::Brush => TabletToolType::Brush, Some(tablet_tool::TabletToolType::Brush) => TabletToolType::Brush,
tablet_tool::TabletToolType::Pencil => TabletToolType::Pencil, Some(tablet_tool::TabletToolType::Pencil) => TabletToolType::Pencil,
tablet_tool::TabletToolType::Airbrush => TabletToolType::Airbrush, Some(tablet_tool::TabletToolType::Airbrush) => TabletToolType::Airbrush,
tablet_tool::TabletToolType::Mouse => TabletToolType::Mouse, Some(tablet_tool::TabletToolType::Mouse) => TabletToolType::Mouse,
tablet_tool::TabletToolType::Lens => TabletToolType::Lens, Some(tablet_tool::TabletToolType::Lens) => TabletToolType::Lens,
tablet_tool::TabletToolType::Totem => TabletToolType::Totem, Some(tablet_tool::TabletToolType::Totem) => TabletToolType::Totem,
_ => TabletToolType::Unknown,
}; };
let hardware_serial = tool.serial(); let hardware_serial = tool.serial();