Have EventLoopClosed contain the original event (#1294)

* Fix issue #1292

* Remove "optionally" from changelog entry
This commit is contained in:
zserik 2019-12-07 18:22:03 +01:00 committed by Murarth
parent 1a514dff38
commit 830d47a5f7
10 changed files with 43 additions and 20 deletions

View file

@ -1,4 +1,10 @@
#![cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
#![cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
mod dnd;
mod event_processor;
@ -425,8 +431,14 @@ impl<T> EventLoopWindowTarget<T> {
}
impl<T: 'static> EventLoopProxy<T> {
pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed> {
self.user_sender.send(event).map_err(|_| EventLoopClosed)
pub fn send_event(&self, event: T) -> Result<(), EventLoopClosed<T>> {
self.user_sender.send(event).map_err(|e| {
EventLoopClosed(if let ::calloop::channel::SendError::Disconnected(x) = e {
x
} else {
unreachable!()
})
})
}
}