Remove generic parameter T from EventLoopWindowTarget (#3298)
This commit is contained in:
parent
169cd39f93
commit
22311802b5
37 changed files with 174 additions and 210 deletions
|
|
@ -46,18 +46,18 @@ pub trait EventHandler: Debug {
|
|||
fn handle_user_events(&mut self);
|
||||
}
|
||||
|
||||
pub(crate) type Callback<T> = RefCell<dyn FnMut(Event<T>, &RootWindowTarget<T>)>;
|
||||
pub(crate) type Callback<T> = RefCell<dyn FnMut(Event<T>, &RootWindowTarget)>;
|
||||
|
||||
struct EventLoopHandler<T: 'static> {
|
||||
callback: Weak<Callback<T>>,
|
||||
window_target: Rc<RootWindowTarget<T>>,
|
||||
window_target: Rc<RootWindowTarget>,
|
||||
receiver: Rc<mpsc::Receiver<T>>,
|
||||
}
|
||||
|
||||
impl<T> EventLoopHandler<T> {
|
||||
fn with_callback<F>(&mut self, f: F)
|
||||
where
|
||||
F: FnOnce(&mut EventLoopHandler<T>, RefMut<'_, dyn FnMut(Event<T>, &RootWindowTarget<T>)>),
|
||||
F: FnOnce(&mut EventLoopHandler<T>, RefMut<'_, dyn FnMut(Event<T>, &RootWindowTarget)>),
|
||||
{
|
||||
// `NSApplication` and our `HANDLER` are global state and so it's possible
|
||||
// that we could get a delegate callback after the application has exit an
|
||||
|
|
@ -375,7 +375,7 @@ impl AppState {
|
|||
/// a call to `clear_callback` before returning to avoid undefined behaviour.
|
||||
pub unsafe fn set_callback<T>(
|
||||
callback: Weak<Callback<T>>,
|
||||
window_target: Rc<RootWindowTarget<T>>,
|
||||
window_target: Rc<RootWindowTarget>,
|
||||
receiver: Rc<mpsc::Receiver<T>>,
|
||||
) {
|
||||
*HANDLER.callback.lock().unwrap() = Some(Box::new(EventLoopHandler {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue