diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-03-04 07:38:55 +0100 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2015-03-04 07:43:55 +0100 |
commit | 689ace8b251ceb2446fc460aad3dd19a1692f3f8 (patch) | |
tree | 2035d5b289c4838e477cbea653c6e9e4b05a0afa /src/win32 | |
parent | 41e3328ca7d271b1291996dec9e59830d917ee2c (diff) | |
download | glutin-689ace8b251ceb2446fc460aad3dd19a1692f3f8.tar.gz glutin-689ace8b251ceb2446fc460aad3dd19a1692f3f8.zip |
Add is_current function
Diffstat (limited to 'src/win32')
-rw-r--r-- | src/win32/headless.rs | 5 | ||||
-rw-r--r-- | src/win32/mod.rs | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/win32/headless.rs b/src/win32/headless.rs index 1da8b02..6189360 100644 --- a/src/win32/headless.rs +++ b/src/win32/headless.rs @@ -21,6 +21,11 @@ impl HeadlessContext { } /// See the docs in the crate root file. + pub fn is_current(&self) -> bool { + self.0.is_current() + } + + /// See the docs in the crate root file. pub fn get_proc_address(&self, addr: &str) -> *const () { self.0.get_proc_address(addr) } diff --git a/src/win32/mod.rs b/src/win32/mod.rs index 327b71d..8cb6d39 100644 --- a/src/win32/mod.rs +++ b/src/win32/mod.rs @@ -209,6 +209,11 @@ impl Window { } /// See the docs in the crate root file. + pub fn is_current(&self) -> bool { + unsafe { gl::wgl::GetCurrentContext() == self.context.0 as *const libc::c_void } + } + + /// See the docs in the crate root file. pub fn get_proc_address(&self, addr: &str) -> *const () { let addr = CString::new(addr.as_bytes()).unwrap(); let addr = addr.as_ptr(); |