From 9cecb7ee558579f0b4ede97c53e3d7824a9810b6 Mon Sep 17 00:00:00 2001 From: Ryan Stewart Date: Mon, 16 Mar 2015 14:10:54 -0700 Subject: [PATCH] implement Window is_current() for cocoa backend --- src/cocoa/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cocoa/mod.rs b/src/cocoa/mod.rs index 825f6f37..22ec4b46 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 () {