mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-26 03:36:32 +11:00
Remove dead code causing warnings (#278)
This commit is contained in:
parent
3d1c18ded9
commit
5b57b73fe8
7 changed files with 2 additions and 77 deletions
|
@ -13,7 +13,6 @@ categories = ["gui"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
lazy_static = "0.2.2"
|
lazy_static = "0.2.2"
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
shared_library = "0.1.5"
|
|
||||||
|
|
||||||
[target.'cfg(target_os = "android")'.dependencies.android_glue]
|
[target.'cfg(target_os = "android")'.dependencies.android_glue]
|
||||||
version = "0.2"
|
version = "0.2"
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
//! This is temporary so that existing backends can smoothly transition. After all implementations
|
//! This is temporary so that existing backends can smoothly transition. After all implementations
|
||||||
//! have finished transitionning, this module should disappear.
|
//! have finished transitionning, this module should disappear.
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
macro_rules! gen_api_transition {
|
macro_rules! gen_api_transition {
|
||||||
() => {
|
() => {
|
||||||
pub struct EventsLoop {
|
pub struct EventsLoop {
|
||||||
|
|
|
@ -83,9 +83,6 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
#[macro_use]
|
|
||||||
extern crate shared_library;
|
|
||||||
|
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|
|
@ -59,7 +59,6 @@ pub enum DeviceId {
|
||||||
pub enum MonitorId {
|
pub enum MonitorId {
|
||||||
X(x11::MonitorId),
|
X(x11::MonitorId),
|
||||||
Wayland(wayland::MonitorId),
|
Wayland(wayland::MonitorId),
|
||||||
None,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MonitorId {
|
impl MonitorId {
|
||||||
|
@ -68,7 +67,6 @@ impl MonitorId {
|
||||||
match self {
|
match self {
|
||||||
&MonitorId::X(ref m) => m.get_name(),
|
&MonitorId::X(ref m) => m.get_name(),
|
||||||
&MonitorId::Wayland(ref m) => m.get_name(),
|
&MonitorId::Wayland(ref m) => m.get_name(),
|
||||||
&MonitorId::None => None,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +75,6 @@ impl MonitorId {
|
||||||
match self {
|
match self {
|
||||||
&MonitorId::X(ref m) => m.get_native_identifier(),
|
&MonitorId::X(ref m) => m.get_native_identifier(),
|
||||||
&MonitorId::Wayland(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 {
|
match self {
|
||||||
&MonitorId::X(ref m) => m.get_dimensions(),
|
&MonitorId::X(ref m) => m.get_dimensions(),
|
||||||
&MonitorId::Wayland(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 {CreationError, MouseCursor, CursorState, WindowAttributes, FullScreenState};
|
||||||
use platform::MonitorId as PlatformMonitorId;
|
use platform::MonitorId as PlatformMonitorId;
|
||||||
use window::MonitorId as RootMonitorId;
|
use window::MonitorId as RootMonitorId;
|
||||||
use super::context::MonitorId as WaylandMonitorId;
|
|
||||||
|
|
||||||
use super::{WaylandContext, EventsLoop};
|
use super::{WaylandContext, EventsLoop};
|
||||||
use super::wayland_window;
|
use super::wayland_window;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))]
|
#![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::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 use self::xdisplay::{XConnection, XNotSupported, XError};
|
||||||
|
|
||||||
pub mod ffi;
|
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)
|
fn process_event<F>(&self, xev: &mut ffi::XEvent, mut callback: F)
|
||||||
where F: FnMut(Event)
|
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())
|
f(c_str.as_ptr())
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WindowProxyData {
|
|
||||||
display: Arc<XConnection>,
|
|
||||||
window: ffi::Window,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl Send for WindowProxyData {}
|
|
||||||
|
|
||||||
pub struct XWindow {
|
pub struct XWindow {
|
||||||
display: Arc<XConnection>,
|
display: Arc<XConnection>,
|
||||||
window: ffi::Window,
|
window: ffi::Window,
|
||||||
root: ffi::Window,
|
root: ffi::Window,
|
||||||
// screen we're using, original screen mode if we've switched
|
// screen we're using, original screen mode if we've switched
|
||||||
fullscreen: Arc<Mutex<(i32, Option<ffi::XF86VidModeModeInfo>)>>,
|
fullscreen: Arc<Mutex<(i32, Option<ffi::XF86VidModeModeInfo>)>>,
|
||||||
window_proxy_data: Arc<Mutex<Option<WindowProxyData>>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for XWindow {}
|
unsafe impl Send for XWindow {}
|
||||||
|
@ -144,45 +136,11 @@ impl XWindow {
|
||||||
|
|
||||||
impl Drop for XWindow {
|
impl Drop for XWindow {
|
||||||
fn drop(&mut self) {
|
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
|
// Make sure we return the display to the original resolution if we've changed it
|
||||||
self.switch_from_fullscreen_mode();
|
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 struct Window {
|
||||||
pub x: Arc<XWindow>,
|
pub x: Arc<XWindow>,
|
||||||
cursor_state: Mutex<CursorState>,
|
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 {
|
let window = Window {
|
||||||
x: Arc::new(XWindow {
|
x: Arc::new(XWindow {
|
||||||
display: display.clone(),
|
display: display.clone(),
|
||||||
window: window,
|
window: window,
|
||||||
root: root,
|
root: root,
|
||||||
fullscreen: Arc::new(Mutex::new((screen_id, None))),
|
fullscreen: Arc::new(Mutex::new((screen_id, None))),
|
||||||
window_proxy_data: window_proxy_data,
|
|
||||||
}),
|
}),
|
||||||
cursor_state: Mutex::new(CursorState::Normal),
|
cursor_state: Mutex::new(CursorState::Normal),
|
||||||
};
|
};
|
||||||
|
@ -606,13 +556,6 @@ impl Window {
|
||||||
self.x.display.check_errors().expect("Failed to call XResizeWindow");
|
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]
|
#[inline]
|
||||||
pub fn get_xlib_display(&self) -> *mut libc::c_void {
|
pub fn get_xlib_display(&self) -> *mut libc::c_void {
|
||||||
self.x.display.display as *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) {
|
pub fn set_cursor(&self, cursor: MouseCursor) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let load = |name: &str| {
|
let load = |name: &str| {
|
||||||
|
|
Loading…
Add table
Reference in a new issue