Upgrade calloop and winit (#114)

* Fix compilation with calloop 0.4

* Use `Into` instead of changing signatures

* Bump winit to 0.18

* Fix logind for calloop 0.4

* Cargo fmt
This commit is contained in:
Pablo Stebler 2018-11-17 18:01:04 +01:00 committed by Victor Berger
parent 734d2ce996
commit 630b659ae6
7 changed files with 20 additions and 15 deletions

View File

@ -8,7 +8,7 @@
### Backends ### Backends
- **[Breaking]** WinitBackend: Upgrade to winit 0.17 - **[Breaking]** WinitBackend: Upgrade to winit 0.18
### Clients & Protocol ### Clients & Protocol

View File

@ -18,8 +18,8 @@ tempfile = "2.1.5"
slog = "2.1.1" slog = "2.1.1"
slog-stdlog = "3.0.2" slog-stdlog = "3.0.2"
libloading = "0.4.0" libloading = "0.4.0"
wayland-client = { version = "0.20.5", optional = true } wayland-client = { version = "0.21.1", features = ["egl"], optional = true }
winit = { version = "0.17.0", optional = true } winit = { version = "0.18.0", optional = true }
drm = { version = "^0.3.1", optional = true } drm = { version = "^0.3.1", optional = true }
gbm = { version = "^0.4.0", optional = true, default-features = false, features = ["drm-support"] } gbm = { version = "^0.4.0", optional = true, default-features = false, features = ["drm-support"] }
glium = { version = "0.19.0", optional = true, default-features = false } glium = { version = "0.19.0", optional = true, default-features = false }

View File

@ -245,7 +245,8 @@ use std::{
use wayland_server::{ use wayland_server::{
calloop::{ calloop::{
generic::{EventedRawFd, Generic}, generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source, mio::Ready,
LoopHandle, Source,
}, },
Display, Display,
}; };
@ -558,7 +559,7 @@ where
Ok(source) => Ok((source, device)), Ok(source) => Ok((source, device)),
Err(e) => { Err(e) => {
let device = Rc::try_unwrap(device).unwrap_or_else(|_| unreachable!()); let device = Rc::try_unwrap(device).unwrap_or_else(|_| unreachable!());
Err((e, device.into_inner())) Err((e.into(), device.into_inner()))
} }
} }
} }

View File

@ -18,7 +18,8 @@ use std::{
use wayland_server::calloop::{ use wayland_server::calloop::{
generic::{EventedRawFd, Generic}, generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source, mio::Ready,
LoopHandle, Source,
}; };
// No idea if this is the same across unix platforms // No idea if this is the same across unix platforms
@ -612,6 +613,6 @@ pub fn libinput_bind<Data: 'static>(
let backend = Rc::try_unwrap(fail_backend) let backend = Rc::try_unwrap(fail_backend)
.unwrap_or_else(|_| unreachable!()) .unwrap_or_else(|_| unreachable!())
.into_inner(); .into_inner();
(e, backend) (e.into(), backend)
}) })
} }

View File

@ -51,7 +51,8 @@ use systemd::login;
use wayland_server::calloop::{ use wayland_server::calloop::{
generic::{Event, EventedRawFd, Generic}, generic::{Event, EventedRawFd, Generic},
LoopHandle, Ready, Source, mio::Ready,
InsertError, LoopHandle, Source,
}; };
struct LogindSessionImpl { struct LogindSessionImpl {
@ -459,10 +460,10 @@ pub fn logind_session_bind<Data: 'static>(
let mut notifier = notifier.clone(); let mut notifier = notifier.clone();
move |evt, _| notifier.event(evt) move |evt, _| notifier.event(evt)
}) })
}).collect::<::std::result::Result<Vec<Source<Generic<EventedRawFd>>>, IoError>>() }).collect::<::std::result::Result<Vec<Source<Generic<EventedRawFd>>>, InsertError<Generic<EventedRawFd>>>>()
.map_err(|err| { .map_err(|err| {
( (
err, err.into(),
LogindSessionNotifier { LogindSessionNotifier {
internal: internal_for_error, internal: internal_for_error,
}, },

View File

@ -444,7 +444,7 @@ pub fn direct_session_bind<Data: 'static>(
let notifier = Rc::try_unwrap(fail_notifier) let notifier = Rc::try_unwrap(fail_notifier)
.unwrap_or_else(|_| unreachable!()) .unwrap_or_else(|_| unreachable!())
.into_inner(); .into_inner();
(e, notifier) (e.into(), notifier)
})?; })?;
Ok(BoundDirectSession { source, notifier }) Ok(BoundDirectSession { source, notifier })
} }

View File

@ -29,7 +29,8 @@ use udev::{Context, Enumerator, Event, EventType, MonitorBuilder, MonitorSocket,
use wayland_server::calloop::{ use wayland_server::calloop::{
generic::{EventedRawFd, Generic}, generic::{EventedRawFd, Generic},
LoopHandle, Ready, Source, mio::Ready,
LoopHandle, Source,
}; };
/// Udev's `DrmDevice` type based on the underlying session /// Udev's `DrmDevice` type based on the underlying session
@ -280,9 +281,10 @@ where
let handle = udev.handle.clone(); let handle = udev.handle.clone();
let mut source = Generic::from_raw_fd(fd); let mut source = Generic::from_raw_fd(fd);
source.set_interest(Ready::readable()); source.set_interest(Ready::readable());
handle.insert_source(source, move |_, _| { handle
udev.process_events(); .insert_source(source, move |_, _| {
}) udev.process_events();
}).map_err(Into::into)
} }
impl<H, S, T, Data> UdevBackend<H, S, T, Data> impl<H, S, T, Data> UdevBackend<H, S, T, Data>