autocommit 2022-01-08 19:02:10 CET
This commit is contained in:
parent
d061a5c313
commit
3336f1ab6a
37 changed files with 243 additions and 136 deletions
|
|
@ -3,6 +3,10 @@ use crate::client::objects::Objects;
|
|||
use crate::ifs::wl_buffer::{WlBuffer, WlBufferError, WlBufferId};
|
||||
use crate::ifs::wl_callback::WlCallback;
|
||||
use crate::ifs::wl_compositor::{WlCompositorError, WlCompositorObj};
|
||||
use crate::ifs::wl_data_device::{WlDataDevice, WlDataDeviceError};
|
||||
use crate::ifs::wl_data_device_manager::{WlDataDeviceManagerError, WlDataDeviceManagerObj};
|
||||
use crate::ifs::wl_data_offer::{WlDataOffer, WlDataOfferError};
|
||||
use crate::ifs::wl_data_source::{WlDataSource, WlDataSourceError};
|
||||
use crate::ifs::wl_display::{WlDisplay, WlDisplayError};
|
||||
use crate::ifs::wl_output::{WlOutputError, WlOutputObj};
|
||||
use crate::ifs::wl_region::{WlRegion, WlRegionError, WlRegionId};
|
||||
|
|
@ -27,8 +31,8 @@ use crate::utils::buffd::{BufFdError, MsgFormatter, MsgParser, MsgParserError};
|
|||
use crate::utils::numcell::NumCell;
|
||||
use crate::utils::oneshot::{oneshot, OneshotTx};
|
||||
use crate::utils::queue::AsyncQueue;
|
||||
use crate::ErrorFmt;
|
||||
use ahash::AHashMap;
|
||||
use anyhow::anyhow;
|
||||
use std::cell::{Cell, RefCell, RefMut};
|
||||
use std::fmt::{Debug, Display, Formatter};
|
||||
use std::future::Future;
|
||||
|
|
@ -36,10 +40,6 @@ use std::mem;
|
|||
use std::rc::Rc;
|
||||
use thiserror::Error;
|
||||
use uapi::{c, OwnedFd};
|
||||
use crate::ifs::wl_data_device::{WlDataDevice, WlDataDeviceError};
|
||||
use crate::ifs::wl_data_device_manager::{WlDataDeviceManagerError, WlDataDeviceManagerObj};
|
||||
use crate::ifs::wl_data_offer::{WlDataOffer, WlDataOfferError};
|
||||
use crate::ifs::wl_data_source::{WlDataSourceError, WlDataSource};
|
||||
|
||||
mod objects;
|
||||
mod tasks;
|
||||
|
|
@ -161,17 +161,18 @@ efrom!(ClientError, WlSeatError, WlSeatError);
|
|||
efrom!(ClientError, WlTouchError, WlTouchError);
|
||||
efrom!(ClientError, WlPointerError, WlPointerError);
|
||||
efrom!(ClientError, WlKeyboardError, WlKeyboardError);
|
||||
efrom!(ClientError, WlDataDeviceManagerError, WlDataDeviceManagerError);
|
||||
efrom!(
|
||||
ClientError,
|
||||
WlDataDeviceManagerError,
|
||||
WlDataDeviceManagerError
|
||||
);
|
||||
efrom!(ClientError, WlDataDeviceError, WlDataDeviceError);
|
||||
efrom!(ClientError, WlDataSourceError, WlDataSourceError);
|
||||
efrom!(ClientError, WlDataOfferError, WlDataOfferError);
|
||||
|
||||
impl ClientError {
|
||||
fn peer_closed(&self) -> bool {
|
||||
match self {
|
||||
ClientError::Io(BufFdError::Closed) => true,
|
||||
_ => false,
|
||||
}
|
||||
matches!(self, ClientError::Io(BufFdError::Closed))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -354,9 +355,9 @@ impl Client {
|
|||
Ok(d) => self.fatal_event(d.invalid_request(obj, request)),
|
||||
Err(e) => {
|
||||
log::error!(
|
||||
"Could not retrieve display of client {}: {:#}",
|
||||
"Could not retrieve display of client {}: {}",
|
||||
self.id,
|
||||
anyhow!(e)
|
||||
ErrorFmt(e),
|
||||
);
|
||||
self.state.clients.kill(self.id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ use crate::object::ObjectId;
|
|||
use crate::utils::buffd::{BufFdIn, BufFdOut, MsgFormatter, MsgParser};
|
||||
use crate::utils::oneshot::OneshotRx;
|
||||
use crate::utils::vec_ext::VecExt;
|
||||
use anyhow::anyhow;
|
||||
use crate::ErrorFmt;
|
||||
use futures::{select, FutureExt};
|
||||
use std::mem;
|
||||
use std::rc::Rc;
|
||||
|
|
@ -28,7 +28,7 @@ pub async fn client(data: Rc<Client>, shutdown: OneshotRx<()>) {
|
|||
log::error!("Could not shut down client {} within 5 seconds", data.id.0);
|
||||
}
|
||||
Err(e) => {
|
||||
log::error!("Could not create a timeout: {:#}", anyhow!(e));
|
||||
log::error!("Could not create a timeout: {}", ErrorFmt(e));
|
||||
}
|
||||
}
|
||||
data.state.clients.kill(data.id);
|
||||
|
|
@ -39,11 +39,11 @@ async fn dispatch_fr(data: Rc<Client>) {
|
|||
let mut fr = data.dispatch_frame_requests.pop().await;
|
||||
loop {
|
||||
if let Err(e) = data.event(fr.done()).await {
|
||||
log::error!("Could not dispatch frame event: {:#}", anyhow!(e));
|
||||
log::error!("Could not dispatch frame event: {}", ErrorFmt(e));
|
||||
return;
|
||||
}
|
||||
if let Err(e) = data.remove_obj(&*fr).await {
|
||||
log::error!("Could not remove frame object: {:#}", anyhow!(e));
|
||||
log::error!("Could not remove frame object: {}", ErrorFmt(e));
|
||||
return;
|
||||
}
|
||||
fr = match data.dispatch_frame_requests.try_pop() {
|
||||
|
|
@ -52,7 +52,7 @@ async fn dispatch_fr(data: Rc<Client>) {
|
|||
};
|
||||
}
|
||||
if let Err(e) = data.event2(WlEvent::Flush).await {
|
||||
log::error!("Could not dispatch frame event: {:#}", anyhow!(e));
|
||||
log::error!("Could not dispatch frame event: {}", ErrorFmt(e));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -109,14 +109,14 @@ async fn receive(data: Rc<Client>) {
|
|||
log::info!("Client {} terminated the connection", data.id.0);
|
||||
data.state.clients.kill(data.id);
|
||||
} else {
|
||||
let e = anyhow!(e);
|
||||
let e = ErrorFmt(e);
|
||||
log::error!(
|
||||
"An error occurred while trying to handle a message from client {}: {:#}",
|
||||
"An error occurred while trying to handle a message from client {}: {}",
|
||||
data.id.0,
|
||||
e
|
||||
);
|
||||
if !data.shutdown_sent.get() {
|
||||
data.fatal_event(display.implementation_error(format!("{:#}", e)));
|
||||
data.fatal_event(display.implementation_error(e.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue