aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/wgl
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-12-01 03:04:00 +0100
committerSimon Sapin <simon.sapin@exyr.org>2015-12-01 03:04:00 +0100
commit24d9a705334e0fc72e4c78023b837d2df9411919 (patch)
tree5af40b209acd8bcc4ee798fffe251b50de55b052 /src/api/wgl
parente4f1c7358d5461415201b9640b475ff3cc1a0065 (diff)
downloadglutin-24d9a705334e0fc72e4c78023b837d2df9411919.tar.gz
glutin-24d9a705334e0fc72e4c78023b837d2df9411919.zip
Try to fix Windows build
Diffstat (limited to 'src/api/wgl')
-rw-r--r--src/api/wgl/mod.rs78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs
index 0f6a944..77e3f83 100644
--- a/src/api/wgl/mod.rs
+++ b/src/api/wgl/mod.rs
@@ -13,8 +13,8 @@ use Api;
use self::make_current_guard::CurrentContextGuard;
-use libc;
use std::ffi::{CStr, CString, OsStr};
+use std::os::raw::{c_void, c_int};
use std::os::windows::ffi::OsStrExt;
use std::{mem, ptr};
use std::io;
@@ -168,7 +168,7 @@ impl GlContext for Context {
#[inline]
fn is_current(&self) -> bool {
- unsafe { gl::wgl::GetCurrentContext() == self.context.0 as *const libc::c_void }
+ unsafe { gl::wgl::GetCurrentContext() == self.context.0 as *const c_void }
}
fn get_proc_address(&self, addr: &str) -> *const () {
@@ -232,32 +232,32 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
match opengl.version {
GlRequest::Latest => {},
GlRequest::Specific(Api::OpenGl, (major, minor)) => {
- attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int);
- attributes.push(major as libc::c_int);
- attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as libc::c_int);
- attributes.push(minor as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as c_int);
+ attributes.push(major as c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as c_int);
+ attributes.push(minor as c_int);
},
GlRequest::Specific(Api::OpenGlEs, (major, minor)) => {
if extensions.split(' ').find(|&i| i == "WGL_EXT_create_context_es2_profile")
.is_some()
{
- attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as libc::c_int);
- attributes.push(gl::wgl_extra::CONTEXT_ES2_PROFILE_BIT_EXT as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_ES2_PROFILE_BIT_EXT as c_int);
} else {
return Err(CreationError::OpenGlVersionNotSupported);
}
- attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int);
- attributes.push(major as libc::c_int);
- attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as libc::c_int);
- attributes.push(minor as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as c_int);
+ attributes.push(major as c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as c_int);
+ attributes.push(minor as c_int);
},
GlRequest::Specific(_, _) => return Err(CreationError::OpenGlVersionNotSupported),
GlRequest::GlThenGles { opengl_version: (major, minor), .. } => {
- attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as libc::c_int);
- attributes.push(major as libc::c_int);
- attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as libc::c_int);
- attributes.push(minor as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MAJOR_VERSION_ARB as c_int);
+ attributes.push(major as c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_MINOR_VERSION_ARB as c_int);
+ attributes.push(minor as c_int);
},
}
@@ -270,8 +270,8 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
GlProfile::Core =>
gl::wgl_extra::CONTEXT_CORE_PROFILE_BIT_ARB,
};
- attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as libc::c_int);
- attributes.push(flag as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_PROFILE_MASK_ARB as c_int);
+ attributes.push(flag as c_int);
} else {
return Err(CreationError::NotSupported);
}
@@ -284,14 +284,14 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
if extensions.split(' ').find(|&i| i == "WGL_ARB_create_context_robustness").is_some() {
match opengl.robustness {
Robustness::RobustNoResetNotification | Robustness::TryRobustNoResetNotification => {
- attributes.push(gl::wgl_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as libc::c_int);
- attributes.push(gl::wgl_extra::NO_RESET_NOTIFICATION_ARB as libc::c_int);
- flags = flags | gl::wgl_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB as libc::c_int;
+ attributes.push(gl::wgl_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as c_int);
+ attributes.push(gl::wgl_extra::NO_RESET_NOTIFICATION_ARB as c_int);
+ flags = flags | gl::wgl_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB as c_int;
},
Robustness::RobustLoseContextOnReset | Robustness::TryRobustLoseContextOnReset => {
- attributes.push(gl::wgl_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as libc::c_int);
- attributes.push(gl::wgl_extra::LOSE_CONTEXT_ON_RESET_ARB as libc::c_int);
- flags = flags | gl::wgl_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB as libc::c_int;
+ attributes.push(gl::wgl_extra::CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB as c_int);
+ attributes.push(gl::wgl_extra::LOSE_CONTEXT_ON_RESET_ARB as c_int);
+ flags = flags | gl::wgl_extra::CONTEXT_ROBUST_ACCESS_BIT_ARB as c_int;
},
Robustness::NotRobust => (),
Robustness::NoError => (),
@@ -306,19 +306,19 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
}
if opengl.debug {
- flags = flags | gl::wgl_extra::CONTEXT_DEBUG_BIT_ARB as libc::c_int;
+ flags = flags | gl::wgl_extra::CONTEXT_DEBUG_BIT_ARB as c_int;
}
flags
};
- attributes.push(gl::wgl_extra::CONTEXT_FLAGS_ARB as libc::c_int);
+ attributes.push(gl::wgl_extra::CONTEXT_FLAGS_ARB as c_int);
attributes.push(flags);
attributes.push(0);
- let ctxt = extra_functions.CreateContextAttribsARB(hdc as *const libc::c_void,
- share as *const libc::c_void,
+ let ctxt = extra_functions.CreateContextAttribsARB(hdc as *const c_void,
+ share as *const c_void,
attributes.as_ptr());
if ctxt.is_null() {
@@ -333,14 +333,14 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
share = ptr::null_mut();
}
- let ctxt = gl::wgl::CreateContext(hdc as *const libc::c_void);
+ let ctxt = gl::wgl::CreateContext(hdc as *const c_void);
if ctxt.is_null() {
return Err(CreationError::OsError(format!("wglCreateContext failed: {}",
format!("{}", io::Error::last_os_error()))));
}
if !share.is_null() {
- if gl::wgl::ShareLists(share as *const libc::c_void, ctxt) == 0 {
+ if gl::wgl::ShareLists(share as *const c_void, ctxt) == 0 {
return Err(CreationError::OsError(format!("wglShareLists failed: {}",
format!("{}", io::Error::last_os_error()))));
}
@@ -352,7 +352,7 @@ unsafe fn create_context(extra: Option<(&gl::wgl_extra::Wgl, &PixelFormatRequire
/// Enumerates the list of pixel formats without using WGL.
///
/// Gives less precise results than `enumerate_arb_pixel_formats`.
-unsafe fn enumerate_native_pixel_formats(hdc: winapi::HDC) -> Vec<(libc::c_int, PixelFormat)> {
+unsafe fn enumerate_native_pixel_formats(hdc: winapi::HDC) -> Vec<(c_int, PixelFormat)> {
let size_of_pxfmtdescr = mem::size_of::<winapi::PIXELFORMATDESCRIPTOR>() as u32;
let num = gdi32::DescribePixelFormat(hdc, 1, size_of_pxfmtdescr, ptr::null_mut());
@@ -397,12 +397,12 @@ unsafe fn enumerate_native_pixel_formats(hdc: winapi::HDC) -> Vec<(libc::c_int,
///
/// Gives more precise results than `enumerate_native_pixel_formats`.
unsafe fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, extensions: &str,
- hdc: winapi::HDC) -> Vec<(libc::c_int, PixelFormat)>
+ hdc: winapi::HDC) -> Vec<(c_int, PixelFormat)>
{
let get_info = |index: u32, attrib: u32| {
let mut value = mem::uninitialized();
- extra.GetPixelFormatAttribivARB(hdc as *const _, index as libc::c_int,
- 0, 1, [attrib as libc::c_int].as_ptr(),
+ extra.GetPixelFormatAttribivARB(hdc as *const _, index as c_int,
+ 0, 1, [attrib as c_int].as_ptr(),
&mut value);
value as u32
};
@@ -429,7 +429,7 @@ unsafe fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, extensions: &s
continue;
}
- result.push((index as libc::c_int, PixelFormat {
+ result.push((index as c_int, PixelFormat {
hardware_accelerated: true,
color_bits: get_info(index, gl::wgl_extra::RED_BITS_ARB) as u8 +
get_info(index, gl::wgl_extra::GREEN_BITS_ARB) as u8 +
@@ -463,7 +463,7 @@ unsafe fn enumerate_arb_pixel_formats(extra: &gl::wgl_extra::Wgl, extensions: &s
}
/// Calls `SetPixelFormat` on a window.
-unsafe fn set_pixel_format(hdc: winapi::HDC, id: libc::c_int) -> Result<(), CreationError> {
+unsafe fn set_pixel_format(hdc: winapi::HDC, id: c_int) -> Result<(), CreationError> {
let mut output: winapi::PIXELFORMATDESCRIPTOR = mem::zeroed();
if gdi32::DescribePixelFormat(hdc, id, mem::size_of::<winapi::PIXELFORMATDESCRIPTOR>()
@@ -564,14 +564,14 @@ unsafe fn load_extra_functions(window: winapi::HWND) -> Result<gl::wgl_extra::Wg
Ok(gl::wgl_extra::Wgl::load_with(|addr| {
let addr = CString::new(addr.as_bytes()).unwrap();
let addr = addr.as_ptr();
- gl::wgl::GetProcAddress(addr) as *const libc::c_void
+ gl::wgl::GetProcAddress(addr) as *const c_void
}))
}
/// Given a list of pixel formats, this function chooses one that is likely to be provided by
/// the main video driver of the system.
-fn choose_dummy_pixel_format<I>(iter: I) -> Result<libc::c_int, CreationError>
- where I: Iterator<Item=(libc::c_int, PixelFormat)>
+fn choose_dummy_pixel_format<I>(iter: I) -> Result<c_int, CreationError>
+ where I: Iterator<Item=(c_int, PixelFormat)>
{
let mut backup_id = None;