mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-30 15:17:25 +00:00
Create the window adapter lazily in C++
This commit is contained in:
parent
d48e7192d8
commit
cd9994306e
5 changed files with 29 additions and 19 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue