mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
commit
6c5cca9d6a
|
@ -265,6 +265,10 @@ impl Window {
|
||||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||||
self.display as *mut libc::c_void
|
self.display as *mut libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGlEs
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
24
src/lib.rs
24
src/lib.rs
|
@ -84,6 +84,14 @@ impl std::error::Error for CreationError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// All APIs related to OpenGL that you can possibly get while using glutin.
|
||||||
|
pub enum Api {
|
||||||
|
/// The classical OpenGL. Available on Windows, Linux, OS/X.
|
||||||
|
OpenGl,
|
||||||
|
/// OpenGL embedded system. Available on Linux, Android.
|
||||||
|
OpenGlEs,
|
||||||
|
}
|
||||||
|
|
||||||
/// Object that allows you to build windows.
|
/// Object that allows you to build windows.
|
||||||
#[cfg(feature = "window")]
|
#[cfg(feature = "window")]
|
||||||
pub struct WindowBuilder<'a> {
|
pub struct WindowBuilder<'a> {
|
||||||
|
@ -457,6 +465,15 @@ impl Window {
|
||||||
pub unsafe fn platform_display(&self) -> *mut libc::c_void {
|
pub unsafe fn platform_display(&self) -> *mut libc::c_void {
|
||||||
self.window.platform_display()
|
self.window.platform_display()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the API that is currently provided by this window.
|
||||||
|
///
|
||||||
|
/// - On Windows and OS/X, this always returns `OpenGl`.
|
||||||
|
/// - On Android, this always returns `OpenGlEs`.
|
||||||
|
/// - On Linux, it must be checked at runtime.
|
||||||
|
pub fn get_api(&self) -> Api {
|
||||||
|
self.window.get_api()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "window")]
|
#[cfg(feature = "window")]
|
||||||
|
@ -488,6 +505,13 @@ impl HeadlessContext {
|
||||||
pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
|
pub fn get_proc_address(&self, addr: &str) -> *const libc::c_void {
|
||||||
self.context.get_proc_address(addr) as *const libc::c_void
|
self.context.get_proc_address(addr) as *const libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the API that is currently provided by this window.
|
||||||
|
///
|
||||||
|
/// See `Window::get_api` for more infos.
|
||||||
|
pub fn get_api(&self) -> Api {
|
||||||
|
self.context.get_api()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "headless")]
|
#[cfg(feature = "headless")]
|
||||||
|
|
|
@ -400,4 +400,8 @@ impl Window {
|
||||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,11 @@ impl HeadlessContext {
|
||||||
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
pub fn get_proc_address(&self, addr: &str) -> *const () {
|
||||||
self.0.get_proc_address(addr)
|
self.0.get_proc_address(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// See the docs in the crate root file.
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The Win32 implementation of the main `Window` object.
|
/// The Win32 implementation of the main `Window` object.
|
||||||
|
@ -252,6 +257,11 @@ impl Window {
|
||||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// See the docs in the crate root file.
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
|
|
|
@ -47,6 +47,11 @@ impl HeadlessContext {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// See the docs in the crate root file.
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for HeadlessContext {
|
impl Drop for HeadlessContext {
|
||||||
|
|
|
@ -535,6 +535,11 @@ impl Window {
|
||||||
pub fn platform_display(&self) -> *mut libc::c_void {
|
pub fn platform_display(&self) -> *mut libc::c_void {
|
||||||
self.display as *mut libc::c_void
|
self.display as *mut libc::c_void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// See the docs in the crate root file.
|
||||||
|
pub fn get_api(&self) -> ::Api {
|
||||||
|
::Api::OpenGl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Window {
|
impl Drop for Window {
|
||||||
|
|
Loading…
Reference in a new issue