Remove generic parameter T from EventLoopWindowTarget (#3298)

This commit is contained in:
Mads Marquart 2024-01-13 21:36:53 +01:00 committed by GitHub
parent 169cd39f93
commit 22311802b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 174 additions and 210 deletions

View file

@ -272,9 +272,9 @@ impl EventState {
}
}
pub struct EventLoop<T: 'static> {
pub struct EventLoop<T> {
windows: Vec<(Arc<RedoxSocket>, EventState)>,
window_target: event_loop::EventLoopWindowTarget<T>,
window_target: event_loop::EventLoopWindowTarget,
user_events_sender: mpsc::Sender<T>,
user_events_receiver: mpsc::Receiver<T>,
}
@ -315,7 +315,6 @@ impl<T: 'static> EventLoop<T> {
destroys: Arc::new(Mutex::new(VecDeque::new())),
event_socket,
wake_socket,
p: PhantomData,
},
_marker: PhantomData,
},
@ -467,10 +466,10 @@ impl<T: 'static> EventLoop<T> {
pub fn run<F>(mut self, mut event_handler_inner: F) -> Result<(), EventLoopError>
where
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget<T>),
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget),
{
let mut event_handler =
move |event: event::Event<T>, window_target: &event_loop::EventLoopWindowTarget<T>| {
move |event: event::Event<T>, window_target: &event_loop::EventLoopWindowTarget| {
event_handler_inner(event, window_target);
};
@ -677,7 +676,7 @@ impl<T: 'static> EventLoop<T> {
Ok(())
}
pub fn window_target(&self) -> &event_loop::EventLoopWindowTarget<T> {
pub fn window_target(&self) -> &event_loop::EventLoopWindowTarget {
&self.window_target
}
@ -717,7 +716,7 @@ impl<T> Clone for EventLoopProxy<T> {
impl<T> Unpin for EventLoopProxy<T> {}
pub struct EventLoopWindowTarget<T: 'static> {
pub struct EventLoopWindowTarget {
control_flow: Cell<ControlFlow>,
exit: Cell<bool>,
pub(super) creates: Mutex<VecDeque<Arc<RedoxSocket>>>,
@ -725,10 +724,9 @@ pub struct EventLoopWindowTarget<T: 'static> {
pub(super) destroys: Arc<Mutex<VecDeque<WindowId>>>,
pub(super) event_socket: Arc<RedoxSocket>,
pub(super) wake_socket: Arc<TimeSocket>,
p: PhantomData<T>,
}
impl<T: 'static> EventLoopWindowTarget<T> {
impl EventLoopWindowTarget {
pub fn primary_monitor(&self) -> Option<MonitorHandle> {
Some(MonitorHandle)
}