Introduce slint::run_event_loop_until_quit

Closes #1499
This commit is contained in:
Olivier Goffart 2024-01-11 13:52:02 +01:00 committed by GitHub
parent e1c5f4ff03
commit 9111946a82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 192 additions and 44 deletions

View file

@ -49,8 +49,16 @@ pub unsafe extern "C" fn slint_ensure_backend() {
}
#[no_mangle]
pub unsafe extern "C" fn slint_run_event_loop() {
with_platform(|b| b.run_event_loop()).unwrap();
/// Enters the main event loop.
pub extern "C" fn slint_run_event_loop(quit_on_last_window_closed: bool) {
with_platform(|b| {
if !quit_on_last_window_closed {
#[allow(deprecated)]
b.set_event_loop_quit_on_last_window_closed(false);
}
b.run_event_loop()
})
.unwrap();
}
/// Will execute the given functor in the main thread