aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Stewart <ryan@binsoftware.com>2015-03-16 14:10:54 -0700
committerRyan Stewart <ryan@binsoftware.com>2015-03-16 14:13:21 -0700
commit9cecb7ee558579f0b4ede97c53e3d7824a9810b6 (patch)
tree2341d9eb5d5577edc47e0c8905d288eaf2e826a1
parent70776fab411a6b8f1b36d1f450b8cf9b56cfbd23 (diff)
downloadglutin-9cecb7ee558579f0b4ede97c53e3d7824a9810b6.tar.gz
glutin-9cecb7ee558579f0b4ede97c53e3d7824a9810b6.zip
implement Window is_current() for cocoa backend
-rw-r--r--src/cocoa/mod.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs
index 825f6f3..22ec4b4 100644
--- a/src/cocoa/mod.rs
+++ b/src/cocoa/mod.rs
@@ -617,7 +617,15 @@ impl Window {
}
pub fn is_current(&self) -> bool {
- unimplemented!()
+ unsafe {
+ let current = NSOpenGLContext::currentContext(nil);
+ if current != nil {
+ let is_equal: bool = msg_send()(current, selector("isEqual:"), *self.context);
+ is_equal
+ } else {
+ false
+ }
+ }
}
pub fn get_proc_address(&self, _addr: &str) -> *const () {