Skip to content

Commit

Permalink
Remove dead code causing warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrocr committed Sep 3, 2017
1 parent 3d1c18d commit 6c545f5
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 77 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/api_transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
#[macro_use]
extern crate lazy_static;

#[macro_use]
extern crate shared_library;

extern crate libc;

#[cfg(target_os = "windows")]
Expand Down
4 changes: 0 additions & 4 deletions src/platform/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ pub enum DeviceId {
pub enum MonitorId {
X(x11::MonitorId),
Wayland(wayland::MonitorId),
None,
}

impl MonitorId {
Expand All @@ -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,
}
}

Expand All @@ -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:
}
}

Expand All @@ -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:
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/platform/linux/wayland/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 1 addition & 7 deletions src/platform/linux/x11/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<F>(&self, xev: &mut ffi::XEvent, mut callback: F)
where F: FnMut(Event)
{
Expand Down
61 changes: 0 additions & 61 deletions src/platform/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,12 @@ fn with_c_str<F, T>(s: &str, f: F) -> T where F: FnOnce(*const libc::c_char) ->
f(c_str.as_ptr())
}

struct WindowProxyData {
display: Arc<XConnection>,
window: ffi::Window,
}

unsafe impl Send for WindowProxyData {}

pub struct XWindow {
display: Arc<XConnection>,
window: ffi::Window,
root: ffi::Window,
// screen we're using, original screen mode if we've switched
fullscreen: Arc<Mutex<(i32, Option<ffi::XF86VidModeModeInfo>)>>,
window_proxy_data: Arc<Mutex<Option<WindowProxyData>>>,
}

unsafe impl Send for XWindow {}
Expand Down Expand Up @@ -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<Mutex<Option<WindowProxyData>>>,
}

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<XWindow>,
cursor_state: Mutex<CursorState>,
Expand Down Expand Up @@ -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),
};
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -654,10 +597,6 @@ impl Window {
}
}

#[inline]
pub fn set_window_resize_callback(&mut self, _: Option<fn(u32, u32)>) {
}

pub fn set_cursor(&self, cursor: MouseCursor) {
unsafe {
let load = |name: &str| {
Expand Down

0 comments on commit 6c545f5

Please sign in to comment.