diff options
author | tomaka <pierre.krieger1708@gmail.com> | 2015-09-28 22:52:15 +0200 |
---|---|---|
committer | tomaka <pierre.krieger1708@gmail.com> | 2015-09-28 22:52:15 +0200 |
commit | d67248ee2a85b1fd7d2a38a9d94883a25a1be1a6 (patch) | |
tree | 9f7040ca1718d0e77e0810db4873cee369067497 | |
parent | 3e11e5ef69cc714c067dff49834f0e782c8f7fc6 (diff) | |
parent | 77b37431173a7267835f01915f7bc604d9f5a6ff (diff) | |
download | glutin-d67248ee2a85b1fd7d2a38a9d94883a25a1be1a6.tar.gz glutin-d67248ee2a85b1fd7d2a38a9d94883a25a1be1a6.zip |
Merge pull request #622 from jdm/warnings
Warning fixes for OS X.
-rw-r--r-- | examples/fullscreen.rs | 4 | ||||
-rw-r--r-- | examples/grabbing.rs | 4 | ||||
-rw-r--r-- | examples/multiwindow.rs | 4 | ||||
-rw-r--r-- | examples/support/mod.rs | 2 | ||||
-rw-r--r-- | examples/transparent.rs | 4 | ||||
-rw-r--r-- | examples/window.rs | 4 | ||||
-rw-r--r-- | src/api/cocoa/headless.rs | 4 | ||||
-rw-r--r-- | src/api/cocoa/mod.rs | 7 | ||||
-rw-r--r-- | src/headless.rs | 1 | ||||
-rw-r--r-- | src/lib.rs | 2 |
10 files changed, 17 insertions, 19 deletions
diff --git a/examples/fullscreen.rs b/examples/fullscreen.rs index de4c449..305829d 100644 --- a/examples/fullscreen.rs +++ b/examples/fullscreen.rs @@ -40,14 +40,14 @@ fn main() { .build() .unwrap(); - unsafe { window.make_current() }; + let _ = unsafe { window.make_current() }; let context = support::load(&window); for event in window.wait_events() { context.draw_frame((0.0, 1.0, 0.0, 1.0)); - window.swap_buffers(); + let _ = window.swap_buffers(); println!("{:?}", event); diff --git a/examples/grabbing.rs b/examples/grabbing.rs index 0572686..f6cef73 100644 --- a/examples/grabbing.rs +++ b/examples/grabbing.rs @@ -18,7 +18,7 @@ fn main() { println!("This example requires glutin to be compiled with the `wind fn main() { let window = glutin::WindowBuilder::new().build().unwrap(); window.set_title("glutin - Cursor grabbing test"); - unsafe { window.make_current() }; + let _ = unsafe { window.make_current() }; let context = support::load(&window); let mut grabbed = false; @@ -45,7 +45,7 @@ fn main() { } context.draw_frame((0.0, 1.0, 0.0, 1.0)); - window.swap_buffers(); + let _ = window.swap_buffers(); } } diff --git a/examples/multiwindow.rs b/examples/multiwindow.rs index 18299f8..acb2e99 100644 --- a/examples/multiwindow.rs +++ b/examples/multiwindow.rs @@ -39,13 +39,13 @@ fn main() { #[cfg(feature = "window")] fn run(window: glutin::Window, color: (f32, f32, f32, f32)) { - unsafe { window.make_current() }; + let _ = unsafe { window.make_current() }; let context = support::load(&window); for event in window.wait_events() { context.draw_frame(color); - window.swap_buffers(); + let _ = window.swap_buffers(); match event { glutin::Event::Closed => break, diff --git a/examples/support/mod.rs b/examples/support/mod.rs index ab8e2a1..f05e425 100644 --- a/examples/support/mod.rs +++ b/examples/support/mod.rs @@ -69,8 +69,6 @@ pub fn load(window: &glutin::Window) -> Context { impl Context { pub fn draw_frame(&self, color: (f32, f32, f32, f32)) { - use std::mem; - unsafe { self.gl.ClearColor(color.0, color.1, color.2, color.3); self.gl.Clear(gl::COLOR_BUFFER_BIT); diff --git a/examples/transparent.rs b/examples/transparent.rs index 7635b3f..9392d38 100644 --- a/examples/transparent.rs +++ b/examples/transparent.rs @@ -24,7 +24,7 @@ fn main() { .build().unwrap(); window.set_title("A fantastic window!"); window.set_window_resize_callback(Some(resize_callback as fn(u32, u32))); - unsafe { window.make_current() }; + let _ = unsafe { window.make_current() }; println!("Pixel format of the window: {:?}", window.get_pixel_format()); @@ -32,7 +32,7 @@ fn main() { for event in window.wait_events() { context.draw_frame((0.0, 0.0, 0.0, 0.0)); - window.swap_buffers(); + let _ = window.swap_buffers(); println!("{:?}", event); diff --git a/examples/window.rs b/examples/window.rs index 8204b95..8f378f0 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -22,7 +22,7 @@ fn main() { let mut window = glutin::WindowBuilder::new().build().unwrap(); window.set_title("A fantastic window!"); window.set_window_resize_callback(Some(resize_callback as fn(u32, u32))); - unsafe { window.make_current() }; + let _ = unsafe { window.make_current() }; println!("Pixel format of the window: {:?}", window.get_pixel_format()); @@ -30,7 +30,7 @@ fn main() { for event in window.wait_events() { context.draw_frame((0.0, 1.0, 0.0, 1.0)); - window.swap_buffers(); + let _ = window.swap_buffers(); println!("{:?}", event); diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs index eb1a06f..49b8bc3 100644 --- a/src/api/cocoa/headless.rs +++ b/src/api/cocoa/headless.rs @@ -28,8 +28,8 @@ pub struct HeadlessContext { } impl HeadlessContext { - pub fn new((width, height): (u32, u32), pf_reqs: &PixelFormatRequirements, - opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> + pub fn new((width, height): (u32, u32), _pf_reqs: &PixelFormatRequirements, + _opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> { let context = unsafe { let attributes = [ diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs index ecaca69..5a2f004 100644 --- a/src/api/cocoa/mod.rs +++ b/src/api/cocoa/mod.rs @@ -6,7 +6,6 @@ use {CreationError, Event, MouseCursor, CursorState}; use CreationError::OsError; use libc; -use Api; use ContextError; use GlAttributes; use GlContext; @@ -21,9 +20,7 @@ use native_monitor::NativeMonitorId; use objc::runtime::{Class, Object, Sel, BOOL, YES, NO}; use objc::declare::ClassDecl; -use cgl; use cgl::{CGLEnable, kCGLCECrashOnRemovedFunctions, CGLSetParameter, kCGLCPSurfaceOpacity}; -use cgl::CGLContextObj as CGL_CGLContextObj; use cocoa::base::{id, nil}; use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize, @@ -758,7 +755,7 @@ impl Window { } #[inline] - pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> { + pub fn set_cursor_position(&self, _x: i32, _y: i32) -> Result<(), ()> { unimplemented!(); } } @@ -820,6 +817,7 @@ impl IdRef { IdRef(i) } + #[allow(dead_code)] fn retain(i: id) -> IdRef { if i != nil { let _: id = unsafe { msg_send![i, retain] }; @@ -856,6 +854,7 @@ impl Clone for IdRef { } } +#[allow(non_snake_case)] unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> { if nsevent == nil { return None; } diff --git a/src/headless.rs b/src/headless.rs index a0c8c2d..2317794 100644 --- a/src/headless.rs +++ b/src/headless.rs @@ -7,7 +7,6 @@ use GlContext; use PixelFormat; use PixelFormatRequirements; use Robustness; -use WindowAttributes; use gl_common; use libc; @@ -68,6 +68,7 @@ pub use window::{AvailableMonitorsIter, MonitorId, get_available_monitors, get_p pub use native_monitor::NativeMonitorId; use std::io; +#[cfg(not(target_os = "macos"))] use std::cmp::Ordering; mod api; @@ -377,6 +378,7 @@ pub struct PixelFormatRequirements { } impl PixelFormatRequirements { + #[cfg(not(target_os = "macos"))] fn choose_pixel_format<T, I>(&self, iter: I) -> Result<(T, PixelFormat), CreationError> where I: IntoIterator<Item=(T, PixelFormat)>, T: Clone { |