From 6c545f5124bceb1ef4d564b5824239fb62064884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20C=C3=B4rte-Real?= Date: Sun, 3 Sep 2017 18:35:25 +0100 Subject: [PATCH] Remove dead code causing warnings --- Cargo.toml | 1 - src/api_transition.rs | 1 + src/lib.rs | 3 -- src/platform/linux/mod.rs | 4 -- src/platform/linux/wayland/window.rs | 1 - src/platform/linux/x11/mod.rs | 8 +--- src/platform/linux/x11/window.rs | 61 ---------------------------- 7 files changed, 2 insertions(+), 77 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c7d6fe1cc8..836dbda83e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,6 @@ categories = ["gui"] [dependencies] lazy_static = "0.2.2" libc = "0.2" -shared_library = "0.1.5" [target.'cfg(target_os = "android")'.dependencies.android_glue] version = "0.2" diff --git a/src/api_transition.rs b/src/api_transition.rs index de7414c09b..b051edb3d0 100644 --- a/src/api_transition.rs +++ b/src/api_transition.rs @@ -5,6 +5,7 @@ //! This is temporary so that existing backends can smoothly transition. After all implementations //! have finished transitionning, this module should disappear. +#[cfg(any(target_os = "android", target_os = "ios"))] macro_rules! gen_api_transition { () => { pub struct EventsLoop { diff --git a/src/lib.rs b/src/lib.rs index ae8e518580..d30007385c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -83,9 +83,6 @@ #[macro_use] extern crate lazy_static; -#[macro_use] -extern crate shared_library; - extern crate libc; #[cfg(target_os = "windows")] diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index 110b03f342..6751c486df 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -59,7 +59,6 @@ pub enum DeviceId { pub enum MonitorId { X(x11::MonitorId), Wayland(wayland::MonitorId), - None, } impl MonitorId { @@ -68,7 +67,6 @@ impl MonitorId { match self { &MonitorId::X(ref m) => m.get_name(), &MonitorId::Wayland(ref m) => m.get_name(), - &MonitorId::None => None, } } @@ -77,7 +75,6 @@ impl MonitorId { match self { &MonitorId::X(ref m) => m.get_native_identifier(), &MonitorId::Wayland(ref m) => m.get_native_identifier(), - &MonitorId::None => unimplemented!() // FIXME: } } @@ -86,7 +83,6 @@ impl MonitorId { match self { &MonitorId::X(ref m) => m.get_dimensions(), &MonitorId::Wayland(ref m) => m.get_dimensions(), - &MonitorId::None => (800, 600), // FIXME: } } } diff --git a/src/platform/linux/wayland/window.rs b/src/platform/linux/wayland/window.rs index b8c734be84..dcfe34a9c2 100644 --- a/src/platform/linux/wayland/window.rs +++ b/src/platform/linux/wayland/window.rs @@ -7,7 +7,6 @@ use wayland_client::protocol::{wl_display,wl_surface}; use {CreationError, MouseCursor, CursorState, WindowAttributes, FullScreenState}; use platform::MonitorId as PlatformMonitorId; use window::MonitorId as RootMonitorId; -use super::context::MonitorId as WaylandMonitorId; use super::{WaylandContext, EventsLoop}; use super::wayland_window; diff --git a/src/platform/linux/x11/mod.rs b/src/platform/linux/x11/mod.rs index f3dd609da8..341a1e737d 100644 --- a/src/platform/linux/x11/mod.rs +++ b/src/platform/linux/x11/mod.rs @@ -1,7 +1,7 @@ #![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))] pub use self::monitor::{MonitorId, get_available_monitors, get_primary_monitor}; -pub use self::window::{Window, XWindow, WindowProxy}; +pub use self::window::{Window, XWindow}; pub use self::xdisplay::{XConnection, XNotSupported, XError}; pub mod ffi; @@ -186,12 +186,6 @@ impl EventsLoop { } } - pub fn device_name(&self, device: DeviceId) -> String { - let devices = self.devices.lock().unwrap(); - let device = devices.get(&device).unwrap(); - device.name.clone() - } - fn process_event(&self, xev: &mut ffi::XEvent, mut callback: F) where F: FnMut(Event) { diff --git a/src/platform/linux/x11/window.rs b/src/platform/linux/x11/window.rs index a772e0d375..a70763edde 100644 --- a/src/platform/linux/x11/window.rs +++ b/src/platform/linux/x11/window.rs @@ -29,20 +29,12 @@ fn with_c_str(s: &str, f: F) -> T where F: FnOnce(*const libc::c_char) -> f(c_str.as_ptr()) } -struct WindowProxyData { - display: Arc, - window: ffi::Window, -} - -unsafe impl Send for WindowProxyData {} - pub struct XWindow { display: Arc, window: ffi::Window, root: ffi::Window, // screen we're using, original screen mode if we've switched fullscreen: Arc)>>, - window_proxy_data: Arc>>, } unsafe impl Send for XWindow {} @@ -144,45 +136,11 @@ impl XWindow { impl Drop for XWindow { fn drop(&mut self) { - // Clear out the window proxy data arc, so that any window proxy objects - // are no longer able to send messages to this window. - *self.window_proxy_data.lock().unwrap() = None; - // Make sure we return the display to the original resolution if we've changed it self.switch_from_fullscreen_mode(); } } -#[derive(Clone)] -pub struct WindowProxy { - data: Arc>>, -} - -impl WindowProxy { - pub fn wakeup_event_loop(&self) { - let window_proxy_data = self.data.lock().unwrap(); - - if let Some(ref data) = *window_proxy_data { - let mut xev = ffi::XClientMessageEvent { - type_: ffi::ClientMessage, - window: data.window, - format: 32, - message_type: 0, - serial: 0, - send_event: 0, - display: data.display.display, - data: unsafe { mem::zeroed() }, - }; - - unsafe { - (data.display.xlib.XSendEvent)(data.display.display, data.window, 0, 0, mem::transmute(&mut xev)); - (data.display.xlib.XFlush)(data.display.display); - data.display.check_errors().expect("Failed to call XSendEvent after wakeup"); - } - } - } -} - pub struct Window { pub x: Arc, cursor_state: Mutex, @@ -348,20 +306,12 @@ impl Window { }; } - // creating the window object - let window_proxy_data = WindowProxyData { - display: display.clone(), - window: window, - }; - let window_proxy_data = Arc::new(Mutex::new(Some(window_proxy_data))); - let window = Window { x: Arc::new(XWindow { display: display.clone(), window: window, root: root, fullscreen: Arc::new(Mutex::new((screen_id, None))), - window_proxy_data: window_proxy_data, }), cursor_state: Mutex::new(CursorState::Normal), }; @@ -606,13 +556,6 @@ impl Window { self.x.display.check_errors().expect("Failed to call XResizeWindow"); } - #[inline] - pub fn create_window_proxy(&self) -> WindowProxy { - WindowProxy { - data: self.x.window_proxy_data.clone() - } - } - #[inline] pub fn get_xlib_display(&self) -> *mut libc::c_void { self.x.display.display as *mut libc::c_void @@ -654,10 +597,6 @@ impl Window { } } - #[inline] - pub fn set_window_resize_callback(&mut self, _: Option) { - } - pub fn set_cursor(&self, cursor: MouseCursor) { unsafe { let load = |name: &str| {