mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 21:30:03 -04:00
Add is_current function
This commit is contained in:
@@ -20,6 +20,11 @@ impl HeadlessContext {
|
||||
self.0.make_current()
|
||||
}
|
||||
|
||||
/// 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)
|
||||
|
||||
@@ -208,6 +208,11 @@ impl Window {
|
||||
self.context.0 as *const libc::c_void);
|
||||
}
|
||||
|
||||
/// 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();
|
||||
|
||||
Reference in New Issue
Block a user