1
0
Fork 0
forked from wry/wry

autocommit 2022-01-02 16:30:30 CET

This commit is contained in:
Julian Orth 2022-01-02 16:30:30 +01:00
parent d6172b273f
commit c21f231ce7
34 changed files with 874 additions and 844 deletions

View file

@ -1,10 +1,10 @@
mod types;
use crate::client::{AddObj, Client};
use crate::globals::{Global, GlobalName};
use crate::ifs::wl_shm_pool::WlShmPool;
use crate::objects::{Interface, Object, ObjectId};
use crate::object::{Interface, Object, ObjectId};
use crate::utils::buffd::WlParser;
use crate::wl_client::WlClientData;
use std::rc::Rc;
pub use types::*;
@ -19,7 +19,7 @@ pub struct WlShmGlobal {
pub struct WlShmObj {
global: Rc<WlShmGlobal>,
id: ObjectId,
client: Rc<WlClientData>,
client: Rc<Client>,
}
impl WlShmGlobal {
@ -30,7 +30,7 @@ impl WlShmGlobal {
async fn bind_(
self: Rc<Self>,
id: ObjectId,
client: &Rc<WlClientData>,
client: &Rc<Client>,
_version: u32,
) -> Result<(), WlShmError> {
let obj = Rc::new(WlShmObj {
@ -38,7 +38,7 @@ impl WlShmGlobal {
id,
client: client.clone(),
});
client.attach_client_object(obj.clone())?;
client.add_client_obj(&obj)?;
for &format in Format::formats() {
client
.event(Box::new(FormatE {
@ -63,7 +63,7 @@ impl WlShmObj {
create.fd,
create.size as usize,
)?);
self.client.attach_client_object(pool)?;
self.client.add_client_obj(&pool)?;
Ok(())
}

View file

@ -1,8 +1,8 @@
use crate::client::{ClientError, EventFormatter, RequestParser};
use crate::ifs::wl_shm::{Format, WlShmObj, FORMAT};
use crate::ifs::wl_shm_pool::WlShmPoolError;
use crate::objects::{Object, ObjectError, ObjectId};
use crate::object::{Object, ObjectId};
use crate::utils::buffd::{WlFormatter, WlParser, WlParserError};
use crate::wl_client::{EventFormatter, RequestParser, WlClientError};
use std::fmt::{Debug, Formatter};
use std::rc::Rc;
use thiserror::Error;
@ -11,14 +11,11 @@ use uapi::OwnedFd;
#[derive(Debug, Error)]
pub enum WlShmError {
#[error(transparent)]
ObjectError(Box<ObjectError>),
#[error(transparent)]
ClientError(Box<WlClientError>),
ClientError(Box<ClientError>),
#[error("Could not process a `create_pool` request")]
CreatePoolError(#[from] CreatePoolError),
}
efrom!(WlShmError, ObjectError, ObjectError);
efrom!(WlShmError, ClientError, WlClientError);
efrom!(WlShmError, ClientError, ClientError);
#[derive(Debug, Error)]
pub enum CreatePoolError {
@ -29,11 +26,11 @@ pub enum CreatePoolError {
#[error(transparent)]
WlShmPoolError(Box<WlShmPoolError>),
#[error(transparent)]
ClientError(Box<WlClientError>),
ClientError(Box<ClientError>),
}
efrom!(CreatePoolError, ParseError, WlParserError);
efrom!(CreatePoolError, WlShmPoolError, WlShmPoolError);
efrom!(CreatePoolError, ClientError, WlClientError);
efrom!(CreatePoolError, ClientError, ClientError);
pub(super) struct CreatePool {
pub id: ObjectId,