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:
parent
ed26dd58fd
commit
793c535b01
57 changed files with 291 additions and 344 deletions
|
|
@ -12,7 +12,7 @@ use orbclient::{
|
|||
use raw_window_handle::{OrbitalDisplayHandle, RawDisplayHandle};
|
||||
|
||||
use crate::{
|
||||
error::EventLoopError,
|
||||
error::RunLoopError,
|
||||
event::{self, Ime, Modifiers, StartCause},
|
||||
event_loop::{self, ControlFlow},
|
||||
keyboard::{
|
||||
|
|
@ -22,8 +22,8 @@ use crate::{
|
|||
};
|
||||
|
||||
use super::{
|
||||
DeviceId, KeyEventExtra, MonitorHandle, OsError, PlatformSpecificEventLoopAttributes,
|
||||
RedoxSocket, TimeSocket, WindowId, WindowProperties,
|
||||
DeviceId, KeyEventExtra, MonitorHandle, PlatformSpecificEventLoopAttributes, RedoxSocket,
|
||||
TimeSocket, WindowId, WindowProperties,
|
||||
};
|
||||
|
||||
fn convert_scancode(scancode: u8) -> KeyCode {
|
||||
|
|
@ -270,20 +270,12 @@ pub struct EventLoop<T: 'static> {
|
|||
}
|
||||
|
||||
impl<T: 'static> EventLoop<T> {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Result<Self, EventLoopError> {
|
||||
pub(crate) fn new(_: &PlatformSpecificEventLoopAttributes) -> Self {
|
||||
let (user_events_sender, user_events_receiver) = mpsc::channel();
|
||||
|
||||
let event_socket = Arc::new(
|
||||
RedoxSocket::event()
|
||||
.map_err(OsError::new)
|
||||
.map_err(|error| EventLoopError::Os(os_error!(error)))?,
|
||||
);
|
||||
let event_socket = Arc::new(RedoxSocket::event().unwrap());
|
||||
|
||||
let wake_socket = Arc::new(
|
||||
TimeSocket::open()
|
||||
.map_err(OsError::new)
|
||||
.map_err(|error| EventLoopError::Os(os_error!(error)))?,
|
||||
);
|
||||
let wake_socket = Arc::new(TimeSocket::open().unwrap());
|
||||
|
||||
event_socket
|
||||
.write(&syscall::Event {
|
||||
|
|
@ -291,10 +283,9 @@ impl<T: 'static> EventLoop<T> {
|
|||
flags: syscall::EventFlags::EVENT_READ,
|
||||
data: wake_socket.0.fd,
|
||||
})
|
||||
.map_err(OsError::new)
|
||||
.map_err(|error| EventLoopError::Os(os_error!(error)))?;
|
||||
.unwrap();
|
||||
|
||||
Ok(Self {
|
||||
Self {
|
||||
windows: Vec::new(),
|
||||
window_target: event_loop::EventLoopWindowTarget {
|
||||
p: EventLoopWindowTarget {
|
||||
|
|
@ -308,7 +299,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
},
|
||||
_marker: std::marker::PhantomData,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn process_event<F>(
|
||||
|
|
@ -452,7 +443,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn run<F>(mut self, mut event_handler_inner: F) -> Result<(), EventLoopError>
|
||||
pub fn run<F>(mut self, mut event_handler_inner: F) -> Result<(), RunLoopError>
|
||||
where
|
||||
F: FnMut(event::Event<T>, &event_loop::EventLoopWindowTarget<T>, &mut ControlFlow),
|
||||
{
|
||||
|
|
@ -694,7 +685,7 @@ impl<T: 'static> EventLoop<T> {
|
|||
if code == 0 {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(EventLoopError::ExitFailure(code))
|
||||
Err(RunLoopError::ExitFailure(code))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#![cfg(target_os = "redox")]
|
||||
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
use std::str;
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::dpi::{PhysicalPosition, PhysicalSize};
|
||||
|
||||
|
|
@ -178,18 +176,13 @@ impl<'a> fmt::Display for WindowProperties<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct OsError(Arc<syscall::Error>);
|
||||
|
||||
impl OsError {
|
||||
fn new(error: syscall::Error) -> Self {
|
||||
Self(Arc::new(error))
|
||||
}
|
||||
}
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct OsError;
|
||||
|
||||
use std::fmt::{self, Display, Formatter};
|
||||
impl Display for OsError {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
self.0.fmt(fmt)
|
||||
write!(fmt, "Redox OS Error")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue