mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 05:10:03 -04:00
Remove lifetime from the Event
Lifetimes don't work nicely when dealing with multithreaded environments in the current design of the existing winit's event handling model, so remove it in favor of `InnerSizeWriter` fences passed to client, so they could try to update the size. Fixes #1387.
This commit is contained in:
@@ -308,7 +308,7 @@ impl<T: 'static> EventLoop<T> {
|
||||
event_state: &mut EventState,
|
||||
mut event_handler: F,
|
||||
) where
|
||||
F: FnMut(event::Event<'_, T>),
|
||||
F: FnMut(event::Event<T>),
|
||||
{
|
||||
match event_option {
|
||||
EventOption::Key(KeyEvent {
|
||||
@@ -446,11 +446,11 @@ impl<T: 'static> EventLoop<T> {
|
||||
pub fn run<F>(mut self, mut event_handler_inner: F) -> Result<(), RunLoopError>
|
||||
where
|
||||
F: 'static
|
||||
+ FnMut(event::Event<'_, T>, &event_loop::EventLoopWindowTarget<T>, &mut ControlFlow),
|
||||
+ FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget<T>, &mut ControlFlow),
|
||||
{
|
||||
// Wrapper for event handler function that prevents ExitWithCode from being unset.
|
||||
let mut event_handler =
|
||||
move |event: event::Event<'_, T>,
|
||||
move |event: event::Event<T>,
|
||||
window_target: &event_loop::EventLoopWindowTarget<T>,
|
||||
control_flow: &mut ControlFlow| {
|
||||
if let ControlFlow::ExitWithCode(code) = control_flow {
|
||||
|
||||
Reference in New Issue
Block a user