Revert "Propagate error from EventLoop creation" (#3010)

This reverts commit ed26dd58fd.
The patched was merged with a review by accident.
This commit is contained in:
Kirill Chibisov 2023-08-06 06:07:01 +04:00 committed by GitHub
parent ed26dd58fd
commit 793c535b01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 291 additions and 344 deletions

View file

@ -64,7 +64,7 @@ use self::{
};
use super::{common::xkb_state::KbdState, OsError};
use crate::{
error::{EventLoopError, OsError as RootOsError},
error::{OsError as RootOsError, RunLoopError},
event::{Event, StartCause},
event_loop::{ControlFlow, DeviceEvents, EventLoopClosed, EventLoopWindowTarget as RootELW},
platform::pump_events::PumpStatus,
@ -432,12 +432,12 @@ impl<T: 'static> EventLoop<T> {
&self.target
}
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), EventLoopError>
pub fn run_ondemand<F>(&mut self, mut event_handler: F) -> Result<(), RunLoopError>
where
F: FnMut(Event<T>, &RootELW<T>, &mut ControlFlow),
{
if self.loop_running {
return Err(EventLoopError::AlreadyRunning);
return Err(RunLoopError::AlreadyRunning);
}
let exit = loop {
@ -446,7 +446,7 @@ impl<T: 'static> EventLoop<T> {
break Ok(());
}
PumpStatus::Exit(code) => {
break Err(EventLoopError::ExitFailure(code));
break Err(RunLoopError::ExitFailure(code));
}
_ => {
continue;
@ -460,7 +460,7 @@ impl<T: 'static> EventLoop<T> {
// X Server.
let wt = get_xtarget(&self.target);
wt.x_connection().sync_with_server().map_err(|x_err| {
EventLoopError::Os(os_error!(OsError::XError(Arc::new(X11Error::Xlib(x_err)))))
RunLoopError::Os(os_error!(OsError::XError(Arc::new(X11Error::Xlib(x_err)))))
})?;
exit

View file

@ -485,7 +485,7 @@ impl UnownedWindow {
&mut supported_ptr,
);
if supported_ptr == ffi::False {
return Err(os_error!(OsError::Misc(
return Err(os_error!(OsError::XMisc(
"`XkbSetDetectableAutoRepeat` failed"
)));
}
@ -1488,7 +1488,7 @@ impl UnownedWindow {
}
_ => unreachable!(),
}
.map_err(|err| ExternalError::Os(os_error!(OsError::Misc(err))))
.map_err(|err| ExternalError::Os(os_error!(OsError::XMisc(err))))
}
CursorGrabMode::Locked => {
return Err(ExternalError::NotSupported(NotSupportedError::new()));