Add exit code to control flow and impl on linux

This commit is contained in:
MultisampledNight
2021-12-15 20:14:19 +01:00
parent 438d286fd5
commit ebf669a91f
5 changed files with 29 additions and 23 deletions

View File

@@ -655,7 +655,7 @@ impl<T: 'static> EventLoop<T> {
x11_or_wayland!(match self; EventLoop(evlp) => evlp.create_proxy(); as EventLoopProxy)
}
pub fn run_return<F>(&mut self, callback: F)
pub fn run_return<F>(&mut self, callback: F) -> i32
where
F: FnMut(crate::event::Event<'_, T>, &RootELW<T>, &mut ControlFlow),
{
@@ -743,8 +743,9 @@ fn sticky_exit_callback<T, F>(
{
// make ControlFlow::Exit sticky by providing a dummy
// control flow reference if it is already Exit.
let mut dummy = ControlFlow::Exit;
let cf = if *control_flow == ControlFlow::Exit {
let mut dummy;
let cf = if let ControlFlow::Exit(code) = *control_flow {
dummy = ControlFlow::Exit(code);
&mut dummy
} else {
control_flow