mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Add is_current function
This commit is contained in:
parent
41e3328ca7
commit
689ace8b25
|
@ -61,6 +61,11 @@ impl HeadlessContext {
|
|||
unimplemented!()
|
||||
}
|
||||
|
||||
/// See the docs in the crate root file.
|
||||
pub fn is_current(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// See the docs in the crate root file.
|
||||
pub fn get_proc_address(&self, _addr: &str) -> *const () {
|
||||
unimplemented!()
|
||||
|
@ -312,6 +317,10 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_current(&self) -> bool {
|
||||
unsafe { ffi::egl::GetCurrentContext() == self.context }
|
||||
}
|
||||
|
||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||
let addr = CString::from_slice(addr.as_bytes());
|
||||
let addr = addr.as_ptr();
|
||||
|
|
|
@ -76,6 +76,10 @@ impl HeadlessContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_current(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn get_proc_address(&self, _addr: &str) -> *const () {
|
||||
let symbol_name: CFString = _addr.parse().unwrap();
|
||||
let framework_name: CFString = "com.apple.opengl".parse().unwrap();
|
||||
|
|
|
@ -587,6 +587,10 @@ impl Window {
|
|||
self.context.makeCurrentContext();
|
||||
}
|
||||
|
||||
pub fn is_current(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
pub fn get_proc_address(&self, _addr: &str) -> *const () {
|
||||
let symbol_name: CFString = FromStr::from_str(_addr).unwrap();
|
||||
let framework_name: CFString = FromStr::from_str("com.apple.opengl").unwrap();
|
||||
|
|
|
@ -78,6 +78,12 @@ impl HeadlessContext {
|
|||
self.context.make_current()
|
||||
}
|
||||
|
||||
/// Returns true if this context is the current one in this thread.
|
||||
#[inline]
|
||||
pub fn is_current(&self) -> bool {
|
||||
self.context.is_current()
|
||||
}
|
||||
|
||||
/// Returns the address of an OpenGL function.
|
||||
///
|
||||
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -329,6 +329,12 @@ impl Window {
|
|||
self.window.make_current()
|
||||
}
|
||||
|
||||
/// Returns true if this context is the current one in this thread.
|
||||
#[inline]
|
||||
pub fn is_current(&self) -> bool {
|
||||
self.window.is_current()
|
||||
}
|
||||
|
||||
/// Returns the address of an OpenGL function.
|
||||
///
|
||||
/// Contrary to `wglGetProcAddress`, all available OpenGL functions return an address.
|
||||
|
|
|
@ -47,6 +47,10 @@ impl HeadlessContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_current(&self) -> bool {
|
||||
unsafe { ffi::OSMesaGetCurrentContext() == self.context }
|
||||
}
|
||||
|
||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||
unsafe {
|
||||
with_c_str(addr, |s| {
|
||||
|
|
|
@ -701,6 +701,10 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_current(&self) -> bool {
|
||||
unsafe { ffi::glx::GetCurrentContext() == self.x.context }
|
||||
}
|
||||
|
||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||
use std::mem;
|
||||
|
||||
|
|
Loading…
Reference in a new issue