Automatically add udev backend to the event loop store

This commit is contained in:
Drakulix 2017-11-27 17:12:35 +01:00
parent ef2e0571e7
commit 0350dca972
2 changed files with 4 additions and 5 deletions

View File

@ -203,7 +203,7 @@ fn main() {
*/
let context = libudev::Context::new().unwrap();
let bytes = include_bytes!("resources/cursor2.rgba");
let udev
let udev_token
= UdevBackend::new(&mut event_loop, &context, session.clone(), UdevHandlerImpl {
shell_state_token,
compositor_token,
@ -213,7 +213,6 @@ fn main() {
logger: log.clone(),
}, log.clone()).unwrap();
let udev_token = event_loop.state().insert(udev);
let udev_session_id = notifier.register(udev_token.clone());
let (seat_token, _) = Seat::new(&mut event_loop, session.seat().into(), log.clone());

View File

@ -28,7 +28,7 @@ impl<B: From<DrmBackend> + Borrow<DrmBackend> + 'static, H: DrmHandler<B> + 'sta
mut session: S,
mut handler: T,
logger: L)
-> Result<UdevBackend<B, H, S, T>>
-> Result<StateToken<UdevBackend<B, H, S, T>>>
where
L: Into<Option<::slog::Logger>>
{
@ -104,13 +104,13 @@ impl<B: From<DrmBackend> + Borrow<DrmBackend> + 'static, H: DrmHandler<B> + 'sta
builder.match_subsystem("drm").chain_err(|| ErrorKind::FailedToInitMonitor)?;
let monitor = builder.listen().chain_err(|| ErrorKind::FailedToInitMonitor)?;
Ok(UdevBackend {
Ok(evlh.state().insert(UdevBackend {
devices,
monitor,
session,
handler,
logger,
})
}))
}
pub fn close<'a, ST: Into<StateProxy<'a>>>(mut self, state: ST) {