mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2025-01-11 21:31:29 +11:00
Fix glXCreateContextAttrib always null
This commit is contained in:
parent
76ebf39bcd
commit
d3e3590b84
|
@ -141,6 +141,13 @@ 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 dummy_context =
|
||||||
|
ffi::glXCreateContext(display, &visual_infos, ptr::null(), 1);
|
||||||
|
ffi::glXMakeCurrent(display, window, dummy_context);
|
||||||
|
|
||||||
|
// getting the pointer
|
||||||
|
let fn_ptr = {
|
||||||
let mut addr = unsafe { ffi::glXGetProcAddress(b"glXCreateContextAttribs".as_ptr()
|
let mut addr = unsafe { ffi::glXGetProcAddress(b"glXCreateContextAttribs".as_ptr()
|
||||||
as *const u8) } as *const ();
|
as *const u8) } as *const ();
|
||||||
|
|
||||||
|
@ -151,11 +158,18 @@ impl Window {
|
||||||
|
|
||||||
addr.to_option().map(|addr| {
|
addr.to_option().map(|addr| {
|
||||||
let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext,
|
let addr: extern "system" fn(*mut ffi::Display, ffi::GLXFBConfig, ffi::GLXContext,
|
||||||
ffi::Bool, *const libc::c_int) -> ffi::GLXContext = unsafe { mem::transmute(addr) };
|
ffi::Bool, *const libc::c_int) -> ffi::GLXContext = mem::transmute(addr);
|
||||||
addr
|
addr
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// cleaning up
|
||||||
|
ffi::glXMakeCurrent(ptr::mut_null(), 0, ptr::null());
|
||||||
|
ffi::glXDestroyContext(display, dummy_context);
|
||||||
|
|
||||||
|
fn_ptr
|
||||||
|
};
|
||||||
|
|
||||||
// creating IM
|
// creating IM
|
||||||
let im = unsafe {
|
let im = unsafe {
|
||||||
let im = ffi::XOpenIM(display, ptr::null(), ptr::mut_null(), ptr::mut_null());
|
let im = ffi::XOpenIM(display, ptr::null(), ptr::mut_null(), ptr::mut_null());
|
||||||
|
|
Loading…
Reference in a new issue