Adjust InputBackend for libinput compatibility

- Make id be an `u64` to be able to populate it by a hash
- Add internal interface to get a mutable capabilities reference from a `Seat`.
- `InputConfig` type does not need to be `Sized` on `InputBackend`
This commit is contained in:
Drakulix 2017-04-15 00:24:23 +02:00
parent 5369cc2927
commit 7aca2edb13
2 changed files with 10 additions and 4 deletions

View File

@ -12,19 +12,24 @@ use std::error::Error;
/// separated users, all with their own focus, input and cursor available.
///
/// Seats can be checked for equality and hashed for differentiation.
// FIXME: Impl PartialEq, Eq and Hash only dependant on `id`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Seat {
id: u32,
id: u64,
capabilities: SeatCapabilities,
}
impl SeatInternal for Seat {
fn new(id: u32, capabilities: SeatCapabilities) -> Seat {
fn new(id: u64, capabilities: SeatCapabilities) -> Seat {
Seat {
id: id,
capabilities: capabilities,
}
}
fn capabilities_mut(&mut self) -> &mut SeatCapabilities {
&mut self.capabilities
}
}
impl Seat {
@ -182,7 +187,7 @@ pub enum TouchEvent {
/// given events.
pub trait InputBackend: Sized {
/// Type of input device associated with the backend
type InputConfig;
type InputConfig: ?Sized;
/// Type representing errors that may be returned when processing events
type EventError: Error;

View File

@ -28,7 +28,8 @@ pub use glium::*;
/// Internal functions that need to be accessible by the different backend implementations
trait SeatInternal {
fn new(id: u32, capabilities: input::SeatCapabilities) -> Self;
fn new(id: u64, capabilities: input::SeatCapabilities) -> Self;
fn capabilities_mut(&mut self) -> &mut input::SeatCapabilities;
}
trait TouchSlotInternal {