Make libinput backend work without the session feature

This commit is contained in:
Drakulix 2017-12-03 22:44:45 +01:00
parent ae5df5039d
commit 71f107118f
1 changed files with 4 additions and 0 deletions

View File

@ -555,6 +555,7 @@ impl From<event::pointer::ButtonState> for backend::MouseButtonState {
}
}
#[cfg(feature = "backend_session")]
impl SessionObserver for libinput::Libinput {
fn pause<'a>(&mut self, _state: &mut StateProxy<'a>) {
self.suspend()
@ -568,14 +569,17 @@ impl SessionObserver for libinput::Libinput {
/// Wrapper for types implementing the `Session` trait to provide
/// a `LibinputInterface` implementation.
#[cfg(feature = "backend_session")]
pub struct LibinputSessionInterface<S: Session>(S);
#[cfg(feature = "backend_session")]
impl<S: Session> From<S> for LibinputSessionInterface<S> {
fn from(session: S) -> LibinputSessionInterface<S> {
LibinputSessionInterface(session)
}
}
#[cfg(feature = "backend_session")]
impl<S: Session> libinput::LibinputInterface for LibinputSessionInterface<S> {
fn open_restricted(&mut self, path: &Path, flags: i32) -> Result<RawFd, i32> {
use nix::fcntl::OFlag;