diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cocoa/mod.rs | 4 | ||||
-rw-r--r-- | src/cocoa/monitor.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 4 | ||||
-rw-r--r-- | src/win32/callback.rs | 5 | ||||
-rw-r--r-- | src/win32/mod.rs | 8 | ||||
-rw-r--r-- | src/window.rs | 1 | ||||
-rw-r--r-- | src/x11/window/mod.rs | 2 | ||||
-rw-r--r-- | src/x11/window/monitor.rs | 2 |
8 files changed, 18 insertions, 10 deletions
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs index 62eedc6..1da5ce1 100644 --- a/src/cocoa/mod.rs +++ b/src/cocoa/mod.rs @@ -32,7 +32,7 @@ use std::sync::Mutex; use std::ascii::AsciiExt; use std::ops::Deref; -use events::Event::{MouseInput, MouseMoved, ReceivedCharacter, KeyboardInput, MouseWheel}; +use events::Event::{Awakened, MouseInput, MouseMoved, ReceivedCharacter, KeyboardInput, MouseWheel}; use events::ElementState::{Pressed, Released}; use events::MouseButton; use events; @@ -335,6 +335,8 @@ impl<'a> Iterator for WaitEventsIterator<'a> { // calling poll_events() if let Some(ev) = self.window.poll_events().next() { return Some(ev); + } else { + return Some(Awakened); } } } diff --git a/src/cocoa/monitor.rs b/src/cocoa/monitor.rs index bf15665..40c7896 100644 --- a/src/cocoa/monitor.rs +++ b/src/cocoa/monitor.rs @@ -13,7 +13,7 @@ pub fn get_available_monitors() -> VecDeque<MonitorID> { display::CGGetActiveDisplayList(max_displays, &mut active_displays[0], &mut display_count); - for i in range(0, display_count as usize) { + for i in 0..display_count as usize { monitors.push_back(MonitorID(active_displays[i])); } } @@ -213,7 +213,9 @@ pub struct PixelFormat { } /// Attributes -struct BuilderAttribs<'a> { +// FIXME: remove `pub` (https://github.com/rust-lang/rust/issues/23585) +#[doc(hidden)] +pub struct BuilderAttribs<'a> { #[allow(dead_code)] headless: bool, strict: bool, diff --git a/src/win32/callback.rs b/src/win32/callback.rs index 5423fc3..f9ec653 100644 --- a/src/win32/callback.rs +++ b/src/win32/callback.rs @@ -36,8 +36,9 @@ fn send_event(input_window: winapi::HWND, event: Event) { /// This is the callback that is called by `DispatchMessage` in the events loop. /// /// Returning 0 tells the Win32 API that the message has been processed. -pub extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, - wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> winapi::LRESULT +pub unsafe extern "system" fn callback(window: winapi::HWND, msg: winapi::UINT, + wparam: winapi::WPARAM, lparam: winapi::LPARAM) + -> winapi::LRESULT { match msg { winapi::WM_DESTROY => { diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 8ba5ed5..07f76e8 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -49,7 +49,9 @@ unsafe impl Send for Window {} unsafe impl Sync for Window {} /// A simple wrapper that destroys the context when it is destroyed. -struct ContextWrapper(pub winapi::HGLRC); +// FIXME: remove `pub` (https://github.com/rust-lang/rust/issues/23585) +#[doc(hidden)] +pub struct ContextWrapper(pub winapi::HGLRC); impl Drop for ContextWrapper { fn drop(&mut self) { @@ -60,7 +62,9 @@ impl Drop for ContextWrapper { } /// A simple wrapper that destroys the window when it is destroyed. -struct WindowWrapper(pub winapi::HWND, pub winapi::HDC); +// FIXME: remove `pub` (https://github.com/rust-lang/rust/issues/23585) +#[doc(hidden)] +pub struct WindowWrapper(pub winapi::HWND, pub winapi::HDC); impl Drop for WindowWrapper { fn drop(&mut self) { diff --git a/src/window.rs b/src/window.rs index 5cb6e5e..12e8538 100644 --- a/src/window.rs +++ b/src/window.rs @@ -98,7 +98,6 @@ impl<'a> WindowBuilder<'a> { /// /// Will panic if `samples` is not a power of two. pub fn with_multisampling(mut self, samples: u16) -> WindowBuilder<'a> { - use std::num::UnsignedInt; assert!(samples.is_power_of_two()); self.attribs.multisampling = Some(samples); self diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index 7845d07..385a913 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -348,7 +348,7 @@ impl Window { return Err(OsError(format!("Could not query the video modes"))); } - for i in range(0, mode_num) { + for i in 0..mode_num { let mode: ffi::XF86VidModeModeInfo = ptr::read(*modes.offset(i as isize) as *const _); if mode.hdisplay == dimensions.0 as u16 && mode.vdisplay == dimensions.1 as u16 { best_mode = i; diff --git a/src/x11/window/monitor.rs b/src/x11/window/monitor.rs index 44c5e84..46f2062 100644 --- a/src/x11/window/monitor.rs +++ b/src/x11/window/monitor.rs @@ -19,7 +19,7 @@ pub fn get_available_monitors() -> VecDeque<MonitorID> { }; let mut monitors = VecDeque::new(); - monitors.extend(range(0, nb_monitors).map(|i| MonitorID(i as u32))); + monitors.extend((0..nb_monitors).map(|i| MonitorID(i as u32))); monitors } |