mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Remove dummy context creation for X11
This commit is contained in:
parent
f452999b8c
commit
53b9d6398c
|
@ -141,39 +141,19 @@ impl Window {
|
||||||
|
|
||||||
// getting the pointer to glXCreateContextAttribs
|
// getting the pointer to glXCreateContextAttribs
|
||||||
let create_context_attribs = unsafe {
|
let create_context_attribs = unsafe {
|
||||||
// creating the dummy context
|
let mut addr = ffi::glXGetProcAddress(b"glXCreateContextAttribs".as_ptr()
|
||||||
let dummy_context =
|
as *const u8) as *const ();
|
||||||
ffi::glXCreateContext(display, &visual_infos, ptr::null(), 1);
|
|
||||||
if dummy_context.is_null() {
|
|
||||||
return Err(format!("glXCreateContext failed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ffi::glXMakeCurrent(display, window, dummy_context) == 0 {
|
if addr.is_null() {
|
||||||
return Err(format!("glXMakeCurrent with dummy context failed"));
|
addr = ffi::glXGetProcAddress(b"glXCreateContextAttribsARB".as_ptr()
|
||||||
}
|
|
||||||
|
|
||||||
// getting the pointer
|
|
||||||
let fn_ptr = {
|
|
||||||
let mut addr = ffi::glXGetProcAddress(b"glXCreateContextAttribs".as_ptr()
|
|
||||||
as *const u8) as *const ();
|
as *const u8) as *const ();
|
||||||
|
}
|
||||||
|
|
||||||
if addr.is_null() {
|
addr.to_option().map(|addr| {
|
||||||
addr = ffi::glXGetProcAddress(b"glXCreateContextAttribsARB".as_ptr()
|
let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext,
|
||||||
as *const u8) as *const ();
|
ffi::Bool, *const libc::c_int) -> ffi::GLXContext = mem::transmute(addr);
|
||||||
}
|
addr
|
||||||
|
})
|
||||||
addr.to_option().map(|addr| {
|
|
||||||
let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext,
|
|
||||||
ffi::Bool, *const libc::c_int) -> ffi::GLXContext = mem::transmute(addr);
|
|
||||||
addr
|
|
||||||
})
|
|
||||||
};
|
|
||||||
|
|
||||||
// cleaning up
|
|
||||||
ffi::glXMakeCurrent(ptr::mut_null(), 0, ptr::null());
|
|
||||||
ffi::glXDestroyContext(display, dummy_context);
|
|
||||||
|
|
||||||
fn_ptr
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// creating IM
|
// creating IM
|
||||||
|
|
Loading…
Reference in a new issue