mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
make_current() is now unsafe
This commit is contained in:
parent
ec956688cd
commit
270e290af9
|
@ -23,7 +23,7 @@ fn main() {
|
||||||
|
|
||||||
let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
||||||
|
|
||||||
window.make_current();
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void);
|
gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void);
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ fn main() {
|
||||||
|
|
||||||
let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
let window = init::Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
||||||
|
|
||||||
window.make_current();
|
unsafe { window.make_current() };
|
||||||
|
|
||||||
gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void);
|
gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct MonitorID(uint);
|
||||||
///
|
///
|
||||||
/// let window = Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
/// let window = Window::new(None, "Hello world!", &Default::default(), None).unwrap();
|
||||||
///
|
///
|
||||||
/// window.make_current();
|
/// unsafe { window.make_current() };
|
||||||
///
|
///
|
||||||
/// loop {
|
/// loop {
|
||||||
/// for event in window.poll_events().move_iter() { // note: this may change in the future
|
/// for event in window.poll_events().move_iter() { // note: this may change in the future
|
||||||
|
@ -200,9 +200,10 @@ impl Window {
|
||||||
self.window.wait_events()
|
self.window.wait_events()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the context as the current context.
|
||||||
#[inline]
|
#[inline]
|
||||||
#[experimental]
|
#[experimental]
|
||||||
pub fn make_current(&self) {
|
pub unsafe fn make_current(&self) {
|
||||||
self.window.make_current()
|
self.window.make_current()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,8 +310,8 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_current(&self) {
|
pub unsafe fn make_current(&self) {
|
||||||
unsafe { ffi::wglMakeCurrent(self.hdc, self.context) }
|
ffi::wglMakeCurrent(self.hdc, self.context)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||||
|
|
|
@ -232,8 +232,8 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn make_current(&self) {
|
pub unsafe fn make_current(&self) {
|
||||||
let res = unsafe { ffi::glXMakeCurrent(self.display, self.window, self.context) };
|
let res = ffi::glXMakeCurrent(self.display, self.window, self.context);
|
||||||
if res == 0 {
|
if res == 0 {
|
||||||
fail!("glXMakeCurrent failed");
|
fail!("glXMakeCurrent failed");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue