Impl key events

This commit is contained in:
Drakulix 2017-04-15 20:26:44 +02:00
parent 3edb489a92
commit a5cfed8715
1 changed files with 21 additions and 1 deletions

View File

@ -148,7 +148,18 @@ impl InputBackend for LibinputInputBackend {
} }
}, },
Event::Touch(touch_event) => {}, Event::Touch(touch_event) => {},
Event::Keyboard(keyboard_event) => {}, Event::Keyboard(keyboard_event) => {
use ::input::event::keyboard::*;
match keyboard_event {
KeyboardEvent::Key(event) => {
if let Some(ref mut handler) = self.handler {
let device_seat = event.device().seat();
handler.on_keyboard_key(self.seats.get(&device_seat).expect("Recieved key event of non existing Seat"),
event.time(), event.key(), event.key_state().into(), event.seat_key_count());
}
}
}
},
Event::Pointer(pointer_event) => {}, Event::Pointer(pointer_event) => {},
_ => {}, //FIXME: What to do with the rest. _ => {}, //FIXME: What to do with the rest.
} }
@ -156,3 +167,12 @@ impl InputBackend for LibinputInputBackend {
Ok(()) Ok(())
} }
} }
impl From<::input::event::keyboard::KeyState> for ::backend::input::KeyState {
fn from(libinput: ::input::event::keyboard::KeyState) -> Self {
match libinput {
::input::event::keyboard::KeyState::Pressed => ::backend::input::KeyState::Pressed,
::input::event::keyboard::KeyState::Released => ::backend::input::KeyState::Released,
}
}
}