Create the window adapter lazily in C++

This commit is contained in:
Simon Hausmann 2023-06-12 17:09:05 +02:00 committed by Simon Hausmann
parent d48e7192d8
commit cd9994306e
5 changed files with 29 additions and 19 deletions

View file

@ -29,6 +29,15 @@ pub unsafe extern "C" fn slint_windowrc_init(out: *mut WindowAdapterRcOpaque) {
core::ptr::write(out as *mut Rc<dyn WindowAdapter>, win);
}
#[no_mangle]
pub unsafe extern "C" fn slint_ensure_backend() {
i_slint_backend_selector::with_platform(|_b| {
// Nothing to do, just make sure a backend was created
Ok(())
})
.unwrap()
}
#[no_mangle]
pub unsafe extern "C" fn slint_run_event_loop() {
i_slint_backend_selector::with_platform(|b| b.run_event_loop()).unwrap();