mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Fix libsimpleservo build
This commit is contained in:
parent
208473cdbc
commit
728fdff721
2 changed files with 20 additions and 7 deletions
|
@ -587,8 +587,8 @@ struct ServoWindowCallbacks {
|
|||
host_callbacks: Box<dyn HostTrait>,
|
||||
coordinates: RefCell<Coordinates>,
|
||||
density: f32,
|
||||
gl_context_pointer: Option<*const libc::c_void>,
|
||||
native_display_pointer: Option<*const libc::c_void>,
|
||||
gl_context_pointer: Option<*const c_void>,
|
||||
native_display_pointer: Option<*const c_void>,
|
||||
}
|
||||
|
||||
impl EmbedderMethods for ServoEmbedderCallbacks {
|
||||
|
|
|
@ -93,16 +93,18 @@ fn init_logger() {
|
|||
crate::env_logger::init();
|
||||
}
|
||||
|
||||
fn init(
|
||||
unsafe fn init(
|
||||
opts: CInitOptions,
|
||||
gl: gl_glue::ServoGl,
|
||||
gl_context: Option<*const c_void>,
|
||||
display: Option<*const c_void>,
|
||||
wakeup: extern "C" fn(),
|
||||
callbacks: CHostCallbacks,
|
||||
) {
|
||||
init_logger();
|
||||
|
||||
let args = if !opts.args.is_null() {
|
||||
let args = unsafe { CStr::from_ptr(opts.args) };
|
||||
let args = CStr::from_ptr(opts.args);
|
||||
args.to_str()
|
||||
.unwrap_or("")
|
||||
.split(' ')
|
||||
|
@ -112,7 +114,7 @@ fn init(
|
|||
vec![]
|
||||
};
|
||||
|
||||
let url = unsafe { CStr::from_ptr(opts.url) };
|
||||
let url = CStr::from_ptr(opts.url);
|
||||
let url = url.to_str().map(|s| s.to_string()).ok();
|
||||
|
||||
let coordinates = Coordinates::new(0, 0, opts.width, opts.height, opts.width, opts.height);
|
||||
|
@ -128,6 +130,8 @@ fn init(
|
|||
VRInitOptions::VRExternal(opts.vr_pointer)
|
||||
},
|
||||
enable_subpixel_text_antialiasing: opts.enable_subpixel_text_antialiasing,
|
||||
gl_context_pointer: gl_context,
|
||||
native_display_pointer: display,
|
||||
};
|
||||
|
||||
let wakeup = Box::new(WakeupCallback::new(wakeup));
|
||||
|
@ -145,7 +149,16 @@ pub extern "C" fn init_with_egl(
|
|||
) {
|
||||
init_logger();
|
||||
let gl = gl_glue::egl::init().unwrap();
|
||||
init(opts, gl, wakeup, callbacks)
|
||||
unsafe {
|
||||
init(
|
||||
opts,
|
||||
gl.gl_wrapper,
|
||||
Some(gl.gl_context),
|
||||
Some(gl.display),
|
||||
wakeup,
|
||||
callbacks,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
|
||||
|
@ -157,7 +170,7 @@ pub extern "C" fn init_with_gl(
|
|||
) {
|
||||
init_logger();
|
||||
let gl = gl_glue::gl::init().unwrap();
|
||||
init(opts, gl, wakeup, callbacks)
|
||||
unsafe { init(opts, gl, None, None, wakeup, callbacks) }
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue