Remove internal ActiveEventLoop::clear_exit

How to store and clear the internal state should be internal to the
implementation on each backend.
This commit is contained in:
Mads Marquart 2024-07-14 20:51:38 +02:00 committed by GitHub
parent 5b8f5cb54a
commit ee3ab33a7c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 12 additions and 21 deletions

View file

@ -1,8 +1,10 @@
use crate::application::ApplicationHandler;
use crate::error::EventLoopError;
use crate::event_loop::{ActiveEventLoop, EventLoop};
use crate::event_loop::EventLoop;
#[cfg(doc)]
use crate::{platform::pump_events::EventLoopExtPumpEvents, window::Window};
use crate::{
event_loop::ActiveEventLoop, platform::pump_events::EventLoopExtPumpEvents, window::Window,
};
/// Additional methods on [`EventLoop`] to return control flow to the caller.
pub trait EventLoopExtRunOnDemand {
@ -63,18 +65,10 @@ pub trait EventLoopExtRunOnDemand {
impl EventLoopExtRunOnDemand for EventLoop {
fn run_app_on_demand<A: ApplicationHandler>(&mut self, app: A) -> Result<(), EventLoopError> {
self.event_loop.window_target().clear_exit();
self.event_loop.run_app_on_demand(app)
}
}
impl ActiveEventLoop {
/// Clear exit status.
pub(crate) fn clear_exit(&self) {
self.p.clear_exit()
}
}
/// ```compile_fail
/// use winit::event_loop::EventLoop;
/// use winit::platform::run_on_demand::EventLoopExtRunOnDemand;