From 630b659ae6308c45178ac08a742337a635af1394 Mon Sep 17 00:00:00 2001 From: Pablo Stebler Date: Sat, 17 Nov 2018 18:01:04 +0100 Subject: [PATCH] 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 --- CHANGELOG.md | 2 +- Cargo.toml | 4 ++-- src/backend/drm/mod.rs | 5 +++-- src/backend/libinput.rs | 5 +++-- src/backend/session/dbus/logind.rs | 7 ++++--- src/backend/session/direct.rs | 2 +- src/backend/udev.rs | 10 ++++++---- 7 files changed, 20 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98c0481..2d5ef95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ ### Backends -- **[Breaking]** WinitBackend: Upgrade to winit 0.17 +- **[Breaking]** WinitBackend: Upgrade to winit 0.18 ### Clients & Protocol diff --git a/Cargo.toml b/Cargo.toml index 3e6d8c7..6407095 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,8 @@ tempfile = "2.1.5" slog = "2.1.1" slog-stdlog = "3.0.2" libloading = "0.4.0" -wayland-client = { version = "0.20.5", optional = true } -winit = { version = "0.17.0", optional = true } +wayland-client = { version = "0.21.1", features = ["egl"], optional = true } +winit = { version = "0.18.0", optional = true } drm = { version = "^0.3.1", optional = true } gbm = { version = "^0.4.0", optional = true, default-features = false, features = ["drm-support"] } glium = { version = "0.19.0", optional = true, default-features = false } diff --git a/src/backend/drm/mod.rs b/src/backend/drm/mod.rs index a3ac9f1..39ec1cc 100644 --- a/src/backend/drm/mod.rs +++ b/src/backend/drm/mod.rs @@ -245,7 +245,8 @@ use std::{ use wayland_server::{ calloop::{ generic::{EventedRawFd, Generic}, - LoopHandle, Ready, Source, + mio::Ready, + LoopHandle, Source, }, Display, }; @@ -558,7 +559,7 @@ where Ok(source) => Ok((source, device)), Err(e) => { let device = Rc::try_unwrap(device).unwrap_or_else(|_| unreachable!()); - Err((e, device.into_inner())) + Err((e.into(), device.into_inner())) } } } diff --git a/src/backend/libinput.rs b/src/backend/libinput.rs index 28a05c3..6a5407e 100644 --- a/src/backend/libinput.rs +++ b/src/backend/libinput.rs @@ -18,7 +18,8 @@ use std::{ use wayland_server::calloop::{ generic::{EventedRawFd, Generic}, - LoopHandle, Ready, Source, + mio::Ready, + LoopHandle, Source, }; // No idea if this is the same across unix platforms @@ -612,6 +613,6 @@ pub fn libinput_bind( let backend = Rc::try_unwrap(fail_backend) .unwrap_or_else(|_| unreachable!()) .into_inner(); - (e, backend) + (e.into(), backend) }) } diff --git a/src/backend/session/dbus/logind.rs b/src/backend/session/dbus/logind.rs index ed10cc2..147abd0 100644 --- a/src/backend/session/dbus/logind.rs +++ b/src/backend/session/dbus/logind.rs @@ -51,7 +51,8 @@ use systemd::login; use wayland_server::calloop::{ generic::{Event, EventedRawFd, Generic}, - LoopHandle, Ready, Source, + mio::Ready, + InsertError, LoopHandle, Source, }; struct LogindSessionImpl { @@ -459,10 +460,10 @@ pub fn logind_session_bind( let mut notifier = notifier.clone(); move |evt, _| notifier.event(evt) }) - }).collect::<::std::result::Result>>, IoError>>() + }).collect::<::std::result::Result>>, InsertError>>>() .map_err(|err| { ( - err, + err.into(), LogindSessionNotifier { internal: internal_for_error, }, diff --git a/src/backend/session/direct.rs b/src/backend/session/direct.rs index fc17c45..f795b44 100644 --- a/src/backend/session/direct.rs +++ b/src/backend/session/direct.rs @@ -444,7 +444,7 @@ pub fn direct_session_bind( let notifier = Rc::try_unwrap(fail_notifier) .unwrap_or_else(|_| unreachable!()) .into_inner(); - (e, notifier) + (e.into(), notifier) })?; Ok(BoundDirectSession { source, notifier }) } diff --git a/src/backend/udev.rs b/src/backend/udev.rs index 1b9890c..4055697 100644 --- a/src/backend/udev.rs +++ b/src/backend/udev.rs @@ -29,7 +29,8 @@ use udev::{Context, Enumerator, Event, EventType, MonitorBuilder, MonitorSocket, use wayland_server::calloop::{ generic::{EventedRawFd, Generic}, - LoopHandle, Ready, Source, + mio::Ready, + LoopHandle, Source, }; /// Udev's `DrmDevice` type based on the underlying session @@ -280,9 +281,10 @@ where let handle = udev.handle.clone(); let mut source = Generic::from_raw_fd(fd); source.set_interest(Ready::readable()); - handle.insert_source(source, move |_, _| { - udev.process_events(); - }) + handle + .insert_source(source, move |_, _| { + udev.process_events(); + }).map_err(Into::into) } impl UdevBackend