mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 13:31:29 +11:00
Remove dead code causing warnings (#278)
This commit is contained in:
parent
3d1c18ded9
commit
5b57b73fe8
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -83,9 +83,6 @@
|
|||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
#[macro_use]
|
||||
extern crate shared_library;
|
||||
|
||||
extern crate libc;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
|
|
|
@ -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:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<F>(&self, xev: &mut ffi::XEvent, mut callback: F)
|
||||
where F: FnMut(Event)
|
||||
{
|
||||
|
|
|
@ -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 {}
|
||||
|
@ -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>,
|
||||
|
@ -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<fn(u32, u32)>) {
|
||||
}
|
||||
|
||||
pub fn set_cursor(&self, cursor: MouseCursor) {
|
||||
unsafe {
|
||||
let load = |name: &str| {
|
||||
|
|
Loading…
Reference in a new issue