mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 13:51:30 +11:00
Take IntoIterator
in send_events()
This commit is contained in:
parent
b4b2389d0a
commit
0786d534f4
|
@ -192,7 +192,7 @@ impl<T: 'static> Shared<T> {
|
|||
// Add a series of events to the event loop runner
|
||||
//
|
||||
// It will determine if the event should be immediately sent to the user or buffered for later
|
||||
pub fn send_events(&self, events: impl Iterator<Item = Event<'static, T>>) {
|
||||
pub fn send_events(&self, events: impl IntoIterator<Item = Event<'static, T>>) {
|
||||
// If the event loop is closed, it should discard any new events
|
||||
if self.is_closed() {
|
||||
return;
|
||||
|
|
|
@ -278,8 +278,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
let runner = self.runner.clone();
|
||||
|
||||
move |pointer_id, position, delta| {
|
||||
runner.send_events(
|
||||
[
|
||||
runner.send_events([
|
||||
Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorMoved {
|
||||
|
@ -293,9 +292,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
delta: (delta.x, delta.y),
|
||||
},
|
||||
},
|
||||
]
|
||||
.into_iter(),
|
||||
);
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -341,8 +338,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
// A chorded button event may come in without any prior CursorMoved events,
|
||||
// therefore we should send a CursorMoved event to make sure that the
|
||||
// user code has the correct cursor position.
|
||||
runner.send_events(
|
||||
[
|
||||
runner.send_events([
|
||||
Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorMoved {
|
||||
|
@ -351,9 +347,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
},
|
||||
},
|
||||
button_event,
|
||||
]
|
||||
.into_iter(),
|
||||
);
|
||||
]);
|
||||
}
|
||||
},
|
||||
prevent_default,
|
||||
|
@ -381,8 +375,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
// A mouse down event may come in without any prior CursorMoved events,
|
||||
// therefore we should send a CursorMoved event to make sure that the
|
||||
// user code has the correct cursor position.
|
||||
runner.send_events(
|
||||
[
|
||||
runner.send_events([
|
||||
Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorMoved {
|
||||
|
@ -398,9 +391,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
button,
|
||||
},
|
||||
},
|
||||
]
|
||||
.into_iter(),
|
||||
);
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -445,8 +436,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
// A mouse up event may come in without any prior CursorMoved events,
|
||||
// therefore we should send a CursorMoved event to make sure that the
|
||||
// user code has the correct cursor position.
|
||||
runner.send_events(
|
||||
[
|
||||
runner.send_events([
|
||||
Event::WindowEvent {
|
||||
window_id: RootWindowId(id),
|
||||
event: WindowEvent::CursorMoved {
|
||||
|
@ -462,9 +452,7 @@ impl<T> EventLoopWindowTarget<T> {
|
|||
button,
|
||||
},
|
||||
},
|
||||
]
|
||||
.into_iter(),
|
||||
);
|
||||
]);
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue