diff --git a/src/platform_impl/orbital/event_loop.rs b/src/platform_impl/orbital/event_loop.rs index 1f39c8ad..06df59c6 100644 --- a/src/platform_impl/orbital/event_loop.rs +++ b/src/platform_impl/orbital/event_loop.rs @@ -1,5 +1,6 @@ use std::{ collections::VecDeque, + marker::PhantomData, mem, slice, sync::{mpsc, Arc, Mutex}, time::Instant, @@ -267,6 +268,8 @@ impl EventState { pub struct EventLoop { windows: Vec<(Arc, EventState)>, window_target: event_loop::EventLoopWindowTarget, + user_events_sender: mpsc::Sender, + user_events_receiver: mpsc::Receiver, } impl EventLoop { @@ -298,16 +301,17 @@ impl EventLoop { windows: Vec::new(), window_target: event_loop::EventLoopWindowTarget { p: EventLoopWindowTarget { - user_events_sender, - user_events_receiver, creates: Mutex::new(VecDeque::new()), redraws: Arc::new(Mutex::new(VecDeque::new())), destroys: Arc::new(Mutex::new(VecDeque::new())), event_socket, wake_socket, + p: PhantomData, }, - _marker: std::marker::PhantomData, + _marker: PhantomData, }, + user_events_sender, + user_events_receiver, }) } @@ -594,7 +598,7 @@ impl EventLoop { i += 1; } - while let Ok(event) = self.window_target.p.user_events_receiver.try_recv() { + while let Ok(event) = self.user_events_receiver.try_recv() { event_handler( event::Event::UserEvent(event), &self.window_target, @@ -707,7 +711,7 @@ impl EventLoop { pub fn create_proxy(&self) -> EventLoopProxy { EventLoopProxy { - user_events_sender: self.window_target.p.user_events_sender.clone(), + user_events_sender: self.user_events_sender.clone(), wake_socket: self.window_target.p.wake_socket.clone(), } } @@ -742,13 +746,12 @@ impl Clone for EventLoopProxy { impl Unpin for EventLoopProxy {} pub struct EventLoopWindowTarget { - pub(super) user_events_sender: mpsc::Sender, - pub(super) user_events_receiver: mpsc::Receiver, pub(super) creates: Mutex>>, pub(super) redraws: Arc>>, pub(super) destroys: Arc>>, pub(super) event_socket: Arc, pub(super) wake_socket: Arc, + p: PhantomData, } impl EventLoopWindowTarget {