Add support for graceful exits in Application
- `Settings` now contains an `exit_on_close_request` field - `Application` has a new `should_exit` method
This commit is contained in:
parent
00de9d0c9b
commit
67db13ff7c
5 changed files with 57 additions and 9 deletions
|
|
@ -184,6 +184,13 @@ pub trait Application: Sized {
|
|||
1.0
|
||||
}
|
||||
|
||||
/// Returns whether the [`Application`] should be terminated.
|
||||
///
|
||||
/// By default, it returns `false`.
|
||||
fn should_exit(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Runs the [`Application`].
|
||||
///
|
||||
/// On native platforms, this method will take control of the current thread
|
||||
|
|
@ -284,6 +291,10 @@ where
|
|||
fn scale_factor(&self) -> f64 {
|
||||
self.0.scale_factor()
|
||||
}
|
||||
|
||||
fn should_exit(&self) -> bool {
|
||||
self.0.should_exit()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue