1
0
Fork 0
forked from wry/wry

autocommit 2022-03-30 03:00:46 CEST

This commit is contained in:
Julian Orth 2022-03-30 03:00:46 +02:00
parent 9842264fad
commit 28c9b46400
40 changed files with 1212 additions and 175 deletions

View file

@ -30,7 +30,11 @@ pub enum EventLoopError {
pub struct EventLoopId(u64);
pub trait EventLoopDispatcher {
fn dispatch(self: Rc<Self>, events: i32) -> Result<(), Box<dyn std::error::Error>>;
fn dispatch(
self: Rc<Self>,
fd: Option<i32>,
events: i32,
) -> Result<(), Box<dyn std::error::Error>>;
}
#[derive(Clone)]
@ -157,7 +161,7 @@ impl EventLoop {
break 'outer;
}
if let Some(entry) = self.entries.get(&id) {
if let Err(e) = entry.dispatcher.clone().dispatch(0) {
if let Err(e) = entry.dispatcher.clone().dispatch(entry.fd, 0) {
return Err(EventLoopError::DispatcherError(e));
}
}
@ -185,7 +189,11 @@ impl EventLoop {
continue;
}
};
if let Err(e) = entry.dispatcher.clone().dispatch(event.events as i32) {
if let Err(e) = entry
.dispatcher
.clone()
.dispatch(entry.fd, event.events as i32)
{
return Err(EventLoopError::DispatcherError(e));
}
}