aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--examples/window.rs2
-rw-r--r--src/lib.rs5
-rw-r--r--src/win32/mod.rs4
-rw-r--r--src/x11/mod.rs4
5 files changed, 9 insertions, 8 deletions
diff --git a/README.md b/README.md
index 2e1a9ae..19349cd 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ fn main() {
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);
diff --git a/examples/window.rs b/examples/window.rs
index 4066fed..daa856b 100644
--- a/examples/window.rs
+++ b/examples/window.rs
@@ -7,7 +7,7 @@ fn main() {
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);
diff --git a/src/lib.rs b/src/lib.rs
index d5914aa..f8725b5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -34,7 +34,7 @@ pub struct MonitorID(uint);
///
/// let window = Window::new(None, "Hello world!", &Default::default(), None).unwrap();
///
-/// window.make_current();
+/// unsafe { window.make_current() };
///
/// loop {
/// 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()
}
+ /// Sets the context as the current context.
#[inline]
#[experimental]
- pub fn make_current(&self) {
+ pub unsafe fn make_current(&self) {
self.window.make_current()
}
diff --git a/src/win32/mod.rs b/src/win32/mod.rs
index cfa0992..65374b7 100644
--- a/src/win32/mod.rs
+++ b/src/win32/mod.rs
@@ -310,8 +310,8 @@ impl Window {
}
}
- pub fn make_current(&self) {
- unsafe { ffi::wglMakeCurrent(self.hdc, self.context) }
+ pub unsafe fn make_current(&self) {
+ ffi::wglMakeCurrent(self.hdc, self.context)
}
pub fn get_proc_address(&self, addr: &str) -> *const () {
diff --git a/src/x11/mod.rs b/src/x11/mod.rs
index 4c4d400..cc70a01 100644
--- a/src/x11/mod.rs
+++ b/src/x11/mod.rs
@@ -232,8 +232,8 @@ impl Window {
}
}
- pub fn make_current(&self) {
- let res = unsafe { ffi::glXMakeCurrent(self.display, self.window, self.context) };
+ pub unsafe fn make_current(&self) {
+ let res = ffi::glXMakeCurrent(self.display, self.window, self.context);
if res == 0 {
fail!("glXMakeCurrent failed");
}