Warning fixes for OS X.

This commit is contained in:
Josh Matthews 2015-09-28 12:19:36 -04:00
parent 3e11e5ef69
commit 77b3743117
10 changed files with 17 additions and 19 deletions

View file

@ -40,14 +40,14 @@ fn main() {
.build() .build()
.unwrap(); .unwrap();
unsafe { window.make_current() }; let _ = unsafe { window.make_current() };
let context = support::load(&window); let context = support::load(&window);
for event in window.wait_events() { for event in window.wait_events() {
context.draw_frame((0.0, 1.0, 0.0, 1.0)); context.draw_frame((0.0, 1.0, 0.0, 1.0));
window.swap_buffers(); let _ = window.swap_buffers();
println!("{:?}", event); println!("{:?}", event);

View file

@ -18,7 +18,7 @@ fn main() { println!("This example requires glutin to be compiled with the `wind
fn main() { fn main() {
let window = glutin::WindowBuilder::new().build().unwrap(); let window = glutin::WindowBuilder::new().build().unwrap();
window.set_title("glutin - Cursor grabbing test"); window.set_title("glutin - Cursor grabbing test");
unsafe { window.make_current() }; let _ = unsafe { window.make_current() };
let context = support::load(&window); let context = support::load(&window);
let mut grabbed = false; let mut grabbed = false;
@ -45,7 +45,7 @@ fn main() {
} }
context.draw_frame((0.0, 1.0, 0.0, 1.0)); context.draw_frame((0.0, 1.0, 0.0, 1.0));
window.swap_buffers(); let _ = window.swap_buffers();
} }
} }

View file

@ -39,13 +39,13 @@ fn main() {
#[cfg(feature = "window")] #[cfg(feature = "window")]
fn run(window: glutin::Window, color: (f32, f32, f32, f32)) { fn run(window: glutin::Window, color: (f32, f32, f32, f32)) {
unsafe { window.make_current() }; let _ = unsafe { window.make_current() };
let context = support::load(&window); let context = support::load(&window);
for event in window.wait_events() { for event in window.wait_events() {
context.draw_frame(color); context.draw_frame(color);
window.swap_buffers(); let _ = window.swap_buffers();
match event { match event {
glutin::Event::Closed => break, glutin::Event::Closed => break,

View file

@ -69,8 +69,6 @@ pub fn load(window: &glutin::Window) -> Context {
impl Context { impl Context {
pub fn draw_frame(&self, color: (f32, f32, f32, f32)) { pub fn draw_frame(&self, color: (f32, f32, f32, f32)) {
use std::mem;
unsafe { unsafe {
self.gl.ClearColor(color.0, color.1, color.2, color.3); self.gl.ClearColor(color.0, color.1, color.2, color.3);
self.gl.Clear(gl::COLOR_BUFFER_BIT); self.gl.Clear(gl::COLOR_BUFFER_BIT);

View file

@ -24,7 +24,7 @@ fn main() {
.build().unwrap(); .build().unwrap();
window.set_title("A fantastic window!"); window.set_title("A fantastic window!");
window.set_window_resize_callback(Some(resize_callback as fn(u32, u32))); 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()); println!("Pixel format of the window: {:?}", window.get_pixel_format());
@ -32,7 +32,7 @@ fn main() {
for event in window.wait_events() { for event in window.wait_events() {
context.draw_frame((0.0, 0.0, 0.0, 0.0)); context.draw_frame((0.0, 0.0, 0.0, 0.0));
window.swap_buffers(); let _ = window.swap_buffers();
println!("{:?}", event); println!("{:?}", event);

View file

@ -22,7 +22,7 @@ fn main() {
let mut window = glutin::WindowBuilder::new().build().unwrap(); let mut window = glutin::WindowBuilder::new().build().unwrap();
window.set_title("A fantastic window!"); window.set_title("A fantastic window!");
window.set_window_resize_callback(Some(resize_callback as fn(u32, u32))); 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()); println!("Pixel format of the window: {:?}", window.get_pixel_format());
@ -30,7 +30,7 @@ fn main() {
for event in window.wait_events() { for event in window.wait_events() {
context.draw_frame((0.0, 1.0, 0.0, 1.0)); context.draw_frame((0.0, 1.0, 0.0, 1.0));
window.swap_buffers(); let _ = window.swap_buffers();
println!("{:?}", event); println!("{:?}", event);

View file

@ -28,8 +28,8 @@ pub struct HeadlessContext {
} }
impl HeadlessContext { impl HeadlessContext {
pub fn new((width, height): (u32, u32), pf_reqs: &PixelFormatRequirements, pub fn new((width, height): (u32, u32), _pf_reqs: &PixelFormatRequirements,
opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError> _opengl: &GlAttributes<&HeadlessContext>) -> Result<HeadlessContext, CreationError>
{ {
let context = unsafe { let context = unsafe {
let attributes = [ let attributes = [

View file

@ -6,7 +6,6 @@ use {CreationError, Event, MouseCursor, CursorState};
use CreationError::OsError; use CreationError::OsError;
use libc; use libc;
use Api;
use ContextError; use ContextError;
use GlAttributes; use GlAttributes;
use GlContext; use GlContext;
@ -21,9 +20,7 @@ use native_monitor::NativeMonitorId;
use objc::runtime::{Class, Object, Sel, BOOL, YES, NO}; use objc::runtime::{Class, Object, Sel, BOOL, YES, NO};
use objc::declare::ClassDecl; use objc::declare::ClassDecl;
use cgl;
use cgl::{CGLEnable, kCGLCECrashOnRemovedFunctions, CGLSetParameter, kCGLCPSurfaceOpacity}; use cgl::{CGLEnable, kCGLCECrashOnRemovedFunctions, CGLSetParameter, kCGLCPSurfaceOpacity};
use cgl::CGLContextObj as CGL_CGLContextObj;
use cocoa::base::{id, nil}; use cocoa::base::{id, nil};
use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize, use cocoa::foundation::{NSAutoreleasePool, NSDate, NSDefaultRunLoopMode, NSPoint, NSRect, NSSize,
@ -758,7 +755,7 @@ impl Window {
} }
#[inline] #[inline]
pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> { pub fn set_cursor_position(&self, _x: i32, _y: i32) -> Result<(), ()> {
unimplemented!(); unimplemented!();
} }
} }
@ -820,6 +817,7 @@ impl IdRef {
IdRef(i) IdRef(i)
} }
#[allow(dead_code)]
fn retain(i: id) -> IdRef { fn retain(i: id) -> IdRef {
if i != nil { if i != nil {
let _: id = unsafe { msg_send![i, retain] }; 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> { unsafe fn NSEventToEvent(window: &Window, nsevent: id) -> Option<Event> {
if nsevent == nil { return None; } if nsevent == nil { return None; }

View file

@ -7,7 +7,6 @@ use GlContext;
use PixelFormat; use PixelFormat;
use PixelFormatRequirements; use PixelFormatRequirements;
use Robustness; use Robustness;
use WindowAttributes;
use gl_common; use gl_common;
use libc; use libc;

View file

@ -68,6 +68,7 @@ pub use window::{AvailableMonitorsIter, MonitorId, get_available_monitors, get_p
pub use native_monitor::NativeMonitorId; pub use native_monitor::NativeMonitorId;
use std::io; use std::io;
#[cfg(not(target_os = "macos"))]
use std::cmp::Ordering; use std::cmp::Ordering;
mod api; mod api;
@ -377,6 +378,7 @@ pub struct PixelFormatRequirements {
} }
impl PixelFormatRequirements { impl PixelFormatRequirements {
#[cfg(not(target_os = "macos"))]
fn choose_pixel_format<T, I>(&self, iter: I) -> Result<(T, PixelFormat), CreationError> fn choose_pixel_format<T, I>(&self, iter: I) -> Result<(T, PixelFormat), CreationError>
where I: IntoIterator<Item=(T, PixelFormat)>, T: Clone where I: IntoIterator<Item=(T, PixelFormat)>, T: Clone
{ {