From 66a12d5332b1466c0c7f1a4cc7e93af24e65ca92 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Fri, 23 Jun 2017 20:20:49 +0200 Subject: [PATCH 1/2] linux: stop exposing wayland_client's types --- src/os/unix.rs | 40 ++++------------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/src/os/unix.rs b/src/os/unix.rs index 9d897a767a..7abac2dee5 100644 --- a/src/os/unix.rs +++ b/src/os/unix.rs @@ -10,9 +10,6 @@ use WindowBuilder; use platform::x11::XConnection; use platform::x11::ffi::XVisualInfo; -use wayland_client::protocol::wl_display::WlDisplay; -use wayland_client::protocol::wl_surface::WlSurface; - pub use platform::x11; // TODO: do not expose XConnection @@ -63,24 +60,6 @@ pub trait WindowExt { /// /// The pointer will become invalid when the glutin `Window` is destroyed. fn get_wayland_display(&self) -> Option<*mut libc::c_void>; - - /// Returns a reference to the `WlSurface` object of wayland that is used by this window. - /// - /// For use with the `wayland-client` crate. - /// - /// **This function is not part of winit's public API.** - /// - /// Returns `None` if the window doesn't use wayland (if it uses xlib for example). - fn get_wayland_client_surface(&self) -> Option<&WlSurface>; - - /// Returns a pointer to the `WlDisplay` object of wayland that is used by this window. - /// - /// For use with the `wayland-client` crate. - /// - /// **This function is not part of winit's public API.** - /// - /// Returns `None` if the window doesn't use wayland (if it uses xlib for example). - fn get_wayland_client_display(&self) -> Option<&WlDisplay>; } impl WindowExt for Window { @@ -124,28 +103,17 @@ impl WindowExt for Window { #[inline] fn get_wayland_surface(&self) -> Option<*mut libc::c_void> { use wayland_client::Proxy; - self.get_wayland_client_surface().map(|p| p.ptr() as *mut _) - } - - - #[inline] - fn get_wayland_display(&self) -> Option<*mut libc::c_void> { - use wayland_client::Proxy; - self.get_wayland_client_display().map(|p| p.ptr() as *mut _) - } - - #[inline] - fn get_wayland_client_surface(&self) -> Option<&WlSurface> { match self.window { - LinuxWindow::Wayland(ref w) => Some(w.get_surface()), + LinuxWindow::Wayland(ref w) => Some(w.get_surface().ptr() as *mut _), _ => None } } #[inline] - fn get_wayland_client_display(&self) -> Option<&WlDisplay> { + fn get_wayland_display(&self) -> Option<*mut libc::c_void> { + use wayland_client::Proxy; match self.window { - LinuxWindow::Wayland(ref w) => Some(w.get_display()), + LinuxWindow::Wayland(ref w) => Some(w.get_display().ptr() as *mut _), _ => None } } From e915454a9d8e4485ea0dfe53d981ac2ff027694c Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Fri, 23 Jun 2017 20:25:06 +0200 Subject: [PATCH 2/2] linux: update wayland dependencies --- Cargo.toml | 6 +++--- src/lib.rs | 2 +- src/platform/linux/wayland/event_loop.rs | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 164f956247..e4de072785 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,8 @@ kernel32-sys = "0.2" dwmapi-sys = "0.1" [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies] -wayland-client = { version = "0.8.6", features = ["dlopen"] } -wayland-kbd = "0.8.0" -wayland-window = "0.5.0" +wayland-client = { version = "0.9.9", features = ["dlopen"] } +wayland-kbd = "0.9.1" +wayland-window = "0.6.1" tempfile = "2.1" x11-dl = "2.8" diff --git a/src/lib.rs b/src/lib.rs index d4b91c40c8..03825e6106 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -114,7 +114,7 @@ extern crate core_graphics; #[cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))] extern crate x11_dl; #[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd"))] -#[macro_use(wayland_env,declare_handler)] +#[macro_use] extern crate wayland_client; pub use events::*; diff --git a/src/platform/linux/wayland/event_loop.rs b/src/platform/linux/wayland/event_loop.rs index 703562b6a8..a3e72edf2a 100644 --- a/src/platform/linux/wayland/event_loop.rs +++ b/src/platform/linux/wayland/event_loop.rs @@ -7,7 +7,7 @@ use std::sync::atomic::{self, AtomicBool}; use super::{DecoratedHandler, WindowId, DeviceId, WaylandContext}; -use wayland_client::{EventQueue, EventQueueHandle, Init, Proxy}; +use wayland_client::{EventQueue, EventQueueHandle, Init, Proxy, Liveness}; use wayland_client::protocol::{wl_seat, wl_surface, wl_pointer, wl_keyboard}; use super::make_wid; @@ -159,13 +159,13 @@ impl EventsLoop { } fn prune_dead_windows(&self) { - self.decorated_ids.lock().unwrap().retain(|&(_, ref w)| w.is_alive()); + self.decorated_ids.lock().unwrap().retain(|&(_, ref w)| w.status() == Liveness::Alive); let mut evq_guard = self.evq.lock().unwrap(); let mut state = evq_guard.state(); let handler = state.get_mut_handler::(self.hid); - handler.windows.retain(|w| w.is_alive()); + handler.windows.retain(|w| w.status() == Liveness::Alive); if let Some(w) = handler.mouse_focus.take() { - if w.is_alive() { + if w.status() == Liveness::Alive { handler.mouse_focus = Some(w) } }