autocommit 2022-04-28 15:19:15 CEST
This commit is contained in:
parent
a8ad097f8b
commit
19aef8c58a
49 changed files with 413 additions and 1886 deletions
|
|
@ -32,26 +32,26 @@ impl WlRegion {
|
|||
self.region.borrow_mut().get()
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegionError> {
|
||||
let _destroy: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn add(&self, parser: MsgParser<'_, '_>) -> Result<(), AddError> {
|
||||
fn add(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegionError> {
|
||||
let add: Add = self.client.parse(self, parser)?;
|
||||
if add.width < 0 || add.height < 0 {
|
||||
return Err(AddError::NegativeExtents);
|
||||
return Err(WlRegionError::NegativeExtents);
|
||||
}
|
||||
let mut region = self.region.borrow_mut();
|
||||
region.add(Rect::new_sized(add.x, add.y, add.width, add.height).unwrap());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn subtract(&self, parser: MsgParser<'_, '_>) -> Result<(), SubtractError> {
|
||||
fn subtract(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegionError> {
|
||||
let req: Subtract = self.client.parse(self, parser)?;
|
||||
if req.width < 0 || req.height < 0 {
|
||||
return Err(SubtractError::NegativeExtents);
|
||||
return Err(WlRegionError::NegativeExtents);
|
||||
}
|
||||
let mut region = self.region.borrow_mut();
|
||||
region.sub(Rect::new_sized(req.x, req.y, req.width, req.height).unwrap());
|
||||
|
|
@ -60,7 +60,7 @@ impl WlRegion {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlRegion, WlRegionError;
|
||||
WlRegion;
|
||||
|
||||
DESTROY => destroy,
|
||||
ADD => add,
|
||||
|
|
@ -77,38 +77,12 @@ dedicated_add_obj!(WlRegion, WlRegionId, regions);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlRegionError {
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `add` request")]
|
||||
AddError(#[from] AddError),
|
||||
#[error("Could not process `subtract` request")]
|
||||
SubtractError(#[from] SubtractError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AddError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error("width and/or height are negative")]
|
||||
NegativeExtents,
|
||||
}
|
||||
efrom!(AddError, ParseFailed, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SubtractError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error("width and/or height are negative")]
|
||||
NegativeExtents,
|
||||
}
|
||||
efrom!(SubtractError, ParseFailed, MsgParserError);
|
||||
efrom!(WlRegionError, MsgParserError);
|
||||
efrom!(WlRegionError, ClientError);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue