autocommit 2022-01-02 20:11:25 CET
This commit is contained in:
parent
c21f231ce7
commit
fc887b339e
29 changed files with 672 additions and 197 deletions
|
|
@ -5,7 +5,7 @@ use crate::globals::{Global, GlobalName};
|
|||
use crate::ifs::wl_region::WlRegion;
|
||||
use crate::ifs::wl_surface::WlSurface;
|
||||
use crate::object::{Interface, Object, ObjectId};
|
||||
use crate::utils::buffd::WlParser;
|
||||
use crate::utils::buffd::MsgParser;
|
||||
use std::rc::Rc;
|
||||
pub use types::*;
|
||||
|
||||
|
|
@ -46,14 +46,14 @@ impl WlCompositorGlobal {
|
|||
}
|
||||
|
||||
impl WlCompositorObj {
|
||||
async fn create_surface(&self, parser: WlParser<'_, '_>) -> Result<(), CreateSurfaceError> {
|
||||
async fn create_surface(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSurfaceError> {
|
||||
let surface: CreateSurface = self.client.parse(self, parser)?;
|
||||
let surface = Rc::new(WlSurface::new(surface.id, &self.client));
|
||||
self.client.add_client_obj(&surface)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn create_region(&self, parser: WlParser<'_, '_>) -> Result<(), CreateRegionError> {
|
||||
async fn create_region(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateRegionError> {
|
||||
let region: CreateRegion = self.client.parse(self, parser)?;
|
||||
let region = Rc::new(WlRegion::new(region.id, &self.client));
|
||||
self.client.add_client_obj(®ion)?;
|
||||
|
|
@ -63,7 +63,7 @@ impl WlCompositorObj {
|
|||
async fn handle_request_(
|
||||
&self,
|
||||
request: u32,
|
||||
parser: WlParser<'_, '_>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), WlCompositorError> {
|
||||
match request {
|
||||
CREATE_SURFACE => self.create_surface(parser).await?,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use crate::client::{ClientError, RequestParser};
|
||||
use crate::object::ObjectId;
|
||||
use crate::utils::buffd::{WlParser, WlParserError};
|
||||
use crate::utils::buffd::{MsgParser, MsgParserError};
|
||||
use std::fmt::{Debug, Formatter};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
@ -21,30 +21,30 @@ efrom!(WlCompositorError, CreateRegionError, CreateRegionError);
|
|||
#[derive(Debug, Error)]
|
||||
pub enum CreateSurfaceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<WlParserError>),
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
|
||||
efrom!(CreateSurfaceError, ParseFailed, WlParserError);
|
||||
efrom!(CreateSurfaceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateSurfaceError, ClientError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateRegionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<WlParserError>),
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
|
||||
efrom!(CreateRegionError, ParseFailed, WlParserError);
|
||||
efrom!(CreateRegionError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateRegionError, ClientError, ClientError);
|
||||
|
||||
pub(super) struct CreateSurface {
|
||||
pub id: ObjectId,
|
||||
}
|
||||
impl RequestParser<'_> for CreateSurface {
|
||||
fn parse(parser: &mut WlParser<'_, '_>) -> Result<Self, WlParserError> {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
id: parser.object()?,
|
||||
})
|
||||
|
|
@ -60,7 +60,7 @@ pub(super) struct CreateRegion {
|
|||
pub id: ObjectId,
|
||||
}
|
||||
impl RequestParser<'_> for CreateRegion {
|
||||
fn parse(parser: &mut WlParser<'_, '_>) -> Result<Self, WlParserError> {
|
||||
fn parse(parser: &mut MsgParser<'_, '_>) -> Result<Self, MsgParserError> {
|
||||
Ok(Self {
|
||||
id: parser.object()?,
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue