1
0
Fork 0
forked from wry/wry

autocommit 2022-04-28 15:19:15 CEST

This commit is contained in:
Julian Orth 2022-04-28 15:19:15 +02:00
parent a8ad097f8b
commit 19aef8c58a
49 changed files with 413 additions and 1886 deletions

View file

@ -136,7 +136,7 @@ impl WlSubsurface {
Ok(())
}
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let _req: Destroy = self.surface.client.parse(self, parser)?;
self.surface.unset_ext();
*self.node.borrow_mut() = None;
@ -160,15 +160,15 @@ impl WlSubsurface {
Ok(())
}
fn set_position(&self, parser: MsgParser<'_, '_>) -> Result<(), SetPositionError> {
fn set_position(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let req: SetPosition = self.surface.client.parse(self, parser)?;
self.pending.position.set(Some((req.x, req.y)));
Ok(())
}
fn place(self: &Rc<Self>, sibling: WlSurfaceId, above: bool) -> Result<(), PlacementError> {
fn place(self: &Rc<Self>, sibling: WlSurfaceId, above: bool) -> Result<(), WlSubsurfaceError> {
if sibling == self.surface.id {
return Err(PlacementError::AboveSelf(sibling));
return Err(WlSubsurfaceError::AboveSelf(sibling));
}
let pdata = self.parent.children.borrow();
if let Some(pdata) = &*pdata {
@ -184,7 +184,7 @@ impl WlSubsurface {
} else {
let sibling = match pdata.subsurfaces.get(&sibling) {
Some(s) => s,
_ => return Err(PlacementError::NotASibling(sibling, self.surface.id)),
_ => return Err(WlSubsurfaceError::NotASibling(sibling, self.surface.id)),
};
let node = match sibling.pending.node.borrow().deref() {
Some(n) => n.to_ref(),
@ -203,13 +203,13 @@ impl WlSubsurface {
Ok(())
}
fn place_above(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), PlaceAboveError> {
fn place_above(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let req: PlaceAbove = self.surface.client.parse(self.deref(), parser)?;
self.place(req.sibling, true)?;
Ok(())
}
fn place_below(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), PlaceBelowError> {
fn place_below(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let req: PlaceBelow = self.surface.client.parse(self.deref(), parser)?;
self.place(req.sibling, false)?;
Ok(())
@ -228,13 +228,13 @@ impl WlSubsurface {
}
}
fn set_sync(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSyncError> {
fn set_sync(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let _req: SetSync = self.surface.client.parse(self, parser)?;
self.update_sync(true);
Ok(())
}
fn set_desync(&self, parser: MsgParser<'_, '_>) -> Result<(), SetDesyncError> {
fn set_desync(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
let _req: SetDesync = self.surface.client.parse(self, parser)?;
self.update_sync(false);
Ok(())
@ -242,7 +242,7 @@ impl WlSubsurface {
}
object_base! {
WlSubsurface, WlSubsurfaceError;
WlSubsurface;
DESTROY => destroy,
SET_POSITION => set_position,
@ -303,18 +303,6 @@ impl SurfaceExt for WlSubsurface {
#[derive(Debug, Error)]
pub enum WlSubsurfaceError {
#[error("Could not process `destroy` request")]
DestroyError(#[from] DestroyError),
#[error("Could not process `set_position` request")]
SetPosition(#[from] SetPositionError),
#[error("Could not process `place_above` request")]
PlaceAbove(#[from] PlaceAboveError),
#[error("Could not process `place_below` request")]
PlaceBelow(#[from] PlaceBelowError),
#[error("Could not process `set_sync` request")]
SetSync(#[from] SetSyncError),
#[error("Could not process `set_desync` request")]
SetDesync(#[from] SetDesyncError),
#[error("Surface {0} already has an attached `wl_subsurface`")]
AlreadyAttached(WlSurfaceId),
#[error("Surface {0} cannot be made its own parent")]
@ -325,62 +313,15 @@ pub enum WlSubsurfaceError {
MaxDepthExceeded,
#[error(transparent)]
WlSurfaceError(Box<WlSurfaceError>),
}
efrom!(WlSubsurfaceError, WlSurfaceError);
#[derive(Debug, Error)]
pub enum DestroyError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(DestroyError, ParseFailed, MsgParserError);
efrom!(DestroyError, ClientError);
#[derive(Debug, Error)]
pub enum SetPositionError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
}
efrom!(SetPositionError, ParseFailed, MsgParserError);
#[derive(Debug, Error)]
pub enum PlaceAboveError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
PlacementError(#[from] PlacementError),
}
efrom!(PlaceAboveError, ParseFailed, MsgParserError);
#[derive(Debug, Error)]
pub enum PlacementError {
MsgParserError(#[source] Box<MsgParserError>),
#[error("Cannot place {0} above/below itself")]
AboveSelf(WlSurfaceId),
#[error("{0} is not a sibling of {1}")]
NotASibling(WlSurfaceId, WlSurfaceId),
}
#[derive(Debug, Error)]
pub enum PlaceBelowError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
PlacementError(#[from] PlacementError),
}
efrom!(PlaceBelowError, ParseFailed, MsgParserError);
#[derive(Debug, Error)]
pub enum SetSyncError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
}
efrom!(SetSyncError, ParseFailed, MsgParserError);
#[derive(Debug, Error)]
pub enum SetDesyncError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
}
efrom!(SetDesyncError, ParseFailed, MsgParserError);
efrom!(WlSubsurfaceError, WlSurfaceError);
efrom!(WlSubsurfaceError, MsgParserError);
efrom!(WlSubsurfaceError, ClientError);

View file

@ -181,15 +181,15 @@ impl XdgSurface {
Ok(())
}
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
let _req: Destroy = self.surface.client.parse(self, parser)?;
if self.ext.get().is_some() {
return Err(DestroyError::RoleNotYetDestroyed(self.id));
return Err(XdgSurfaceError::RoleNotYetDestroyed(self.id));
}
{
let children = self.popups.lock();
if !children.is_empty() {
return Err(DestroyError::PopupsNotYetDestroyed);
return Err(XdgSurfaceError::PopupsNotYetDestroyed);
}
}
self.surface.unset_ext();
@ -198,7 +198,7 @@ impl XdgSurface {
Ok(())
}
fn get_toplevel(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetToplevelError> {
fn get_toplevel(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
let req: GetToplevel = self.surface.client.parse(&**self, parser)?;
self.set_role(XdgSurfaceRole::XdgToplevel)?;
if self.ext.get().is_some() {
@ -210,7 +210,7 @@ impl XdgSurface {
self.surface.id
),
);
return Err(GetToplevelError::AlreadyConstructed);
return Err(XdgSurfaceError::AlreadyConstructed);
}
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
track!(self.surface.client, toplevel);
@ -220,7 +220,7 @@ impl XdgSurface {
Ok(())
}
fn get_popup(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetPopupError> {
fn get_popup(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
let req: GetPopup = self.surface.client.parse(&**self, parser)?;
self.set_role(XdgSurfaceRole::XdgPopup)?;
let mut parent = None;
@ -237,7 +237,7 @@ impl XdgSurface {
self.surface.id
),
);
return Err(GetPopupError::AlreadyConstructed);
return Err(XdgSurfaceError::AlreadyConstructed);
}
let popup = Rc::new(XdgPopup::new(req.id, self, parent.as_ref(), &positioner)?);
track!(self.surface.client, popup);
@ -249,17 +249,17 @@ impl XdgSurface {
Ok(())
}
fn set_window_geometry(&self, parser: MsgParser<'_, '_>) -> Result<(), SetWindowGeometryError> {
fn set_window_geometry(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
let req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
if req.height <= 0 || req.width <= 0 {
return Err(SetWindowGeometryError::NonPositiveWidthHeight);
return Err(XdgSurfaceError::NonPositiveWidthHeight);
}
let extents = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
self.pending.geometry.set(Some(extents));
Ok(())
}
fn ack_configure(&self, parser: MsgParser<'_, '_>) -> Result<(), AckConfigureError> {
fn ack_configure(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
let req: AckConfigure = self.surface.client.parse(self, parser)?;
if self.requested_serial.get() == req.serial {
self.acked_serial.set(Some(req.serial));
@ -306,7 +306,7 @@ impl XdgSurface {
}
object_base! {
XdgSurface, XdgSurfaceError;
XdgSurface;
DESTROY => destroy,
GET_TOPLEVEL => get_toplevel,
@ -368,21 +368,9 @@ impl SurfaceExt for XdgSurface {
#[derive(Debug, Error)]
pub enum XdgSurfaceError {
#[error("Could not process `destroy` request")]
DestroyError(#[from] DestroyError),
#[error("Could not process `get_toplevel` request")]
GetToplevelError(#[from] GetToplevelError),
#[error("Could not process `get_popup` request")]
GetPopupError(#[from] GetPopupError),
#[error("Could not process `set_window_geometry` request")]
SetWindowGeometryError(#[from] SetWindowGeometryError),
#[error("Could not process `ack_configure` request")]
AckConfigureError(#[from] AckConfigureError),
#[error("Surface {0} cannot be turned into a xdg_surface because it already has an attached xdg_surface")]
AlreadyAttached(WlSurfaceId),
#[error(transparent)]
WlSurfaceError(Box<WlSurfaceError>),
#[error(transparent)]
XdgPopupError(#[from] XdgPopupError),
#[error("Surface {} cannot be assigned the role {} because it already has the role {}", .id, .new.name(), .old.name())]
IncompatibleRole {
@ -390,80 +378,21 @@ pub enum XdgSurfaceError {
old: XdgSurfaceRole,
new: XdgSurfaceRole,
},
}
efrom!(XdgSurfaceError, WlSurfaceError);
#[derive(Debug, Error)]
pub enum DestroyError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error("Tried no set a non-positive width/height")]
NonPositiveWidthHeight,
#[error("Cannot destroy xdg_surface {0} because it's associated xdg_toplevel/popup is not yet destroyed")]
RoleNotYetDestroyed(XdgSurfaceId),
#[error("The surface still has popups attached")]
PopupsNotYetDestroyed,
}
efrom!(DestroyError, ParseFailed, MsgParserError);
efrom!(DestroyError, ClientError);
#[derive(Debug, Error)]
pub enum GetToplevelError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("The surface already has an assigned xdg_toplevel")]
AlreadyConstructed,
#[error(transparent)]
WlSurfaceError(Box<WlSurfaceError>),
#[error(transparent)]
XdgSurfaceError(Box<XdgSurfaceError>),
}
efrom!(GetToplevelError, ParseFailed, MsgParserError);
efrom!(GetToplevelError, ClientError);
efrom!(GetToplevelError, WlSurfaceError);
efrom!(GetToplevelError, XdgSurfaceError);
#[derive(Debug, Error)]
pub enum GetPopupError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("The surface already has an assigned xdg_popup")]
AlreadyConstructed,
#[error(transparent)]
WlSurfaceError(Box<WlSurfaceError>),
#[error(transparent)]
XdgPopupError(Box<XdgPopupError>),
#[error(transparent)]
XdgSurfaceError(Box<XdgSurfaceError>),
}
efrom!(GetPopupError, ParseFailed, MsgParserError);
efrom!(GetPopupError, ClientError);
efrom!(GetPopupError, XdgPopupError);
efrom!(GetPopupError, WlSurfaceError);
efrom!(GetPopupError, XdgSurfaceError);
#[derive(Debug, Error)]
pub enum SetWindowGeometryError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Tried no set a non-positive width/height")]
NonPositiveWidthHeight,
}
efrom!(SetWindowGeometryError, ParseFailed, MsgParserError);
efrom!(SetWindowGeometryError, ClientError);
#[derive(Debug, Error)]
pub enum AckConfigureError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(AckConfigureError, ParseFailed, MsgParserError);
efrom!(AckConfigureError, ClientError);
efrom!(XdgSurfaceError, WlSurfaceError);
efrom!(XdgSurfaceError, ClientError);
efrom!(XdgSurfaceError, MsgParserError);

View file

@ -201,7 +201,7 @@ impl XdgPopup {
}
}
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPopupError> {
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
self.destroy_node();
{
@ -216,12 +216,12 @@ impl XdgPopup {
Ok(())
}
fn grab(&self, parser: MsgParser<'_, '_>) -> Result<(), GrabError> {
fn grab(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPopupError> {
let _req: Grab = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
fn reposition(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), RepositionError> {
fn reposition(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgPopupError> {
let req: Reposition = self.xdg.surface.client.parse(&**self, parser)?;
*self.pos.borrow_mut() = self.xdg.surface.client.lookup(req.positioner)?.value();
if let Some(parent) = self.parent.get() {
@ -253,7 +253,7 @@ impl XdgPopup {
}
object_base! {
XdgPopup, XdgPopupError;
XdgPopup;
DESTROY => destroy,
GRAB => grab,
@ -386,48 +386,12 @@ impl XdgSurfaceExt for XdgPopup {
#[derive(Debug, Error)]
pub enum XdgPopupError {
#[error("Could not process `destroy` request")]
DestroyError(#[from] DestroyError),
#[error("Could not process `grab` request")]
GrabError(#[from] GrabError),
#[error("Could not process `reposition` request")]
RepositionError(#[from] RepositionError),
#[error("The `xdg_positioner` is incomplete")]
Incomplete,
#[error("The anchor rectangle of the `xdg_positioner` extends outside the parent")]
#[allow(dead_code)]
AnchorRectOutside,
}
#[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 GrabError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(GrabError, ParseFailed, MsgParserError);
efrom!(GrabError, ClientError);
#[derive(Debug, Error)]
pub enum RepositionError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error(transparent)]
XdgPopupError(Box<XdgPopupError>),
}
efrom!(RepositionError, ParseFailed, MsgParserError);
efrom!(RepositionError, ClientError);
efrom!(RepositionError, XdgPopupError);
efrom!(XdgPopupError, MsgParserError);
efrom!(XdgPopupError, ClientError);

View file

@ -165,7 +165,7 @@ impl XdgToplevel {
})
}
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
self.tl_destroy();
self.xdg.ext.set(None);
@ -193,7 +193,7 @@ impl XdgToplevel {
Ok(())
}
fn set_parent(&self, parser: MsgParser<'_, '_>) -> Result<(), SetParentError> {
fn set_parent(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: SetParent = self.xdg.surface.client.parse(self, parser)?;
let mut parent = None;
if req.parent.is_some() {
@ -203,25 +203,25 @@ impl XdgToplevel {
Ok(())
}
fn set_title(&self, parser: MsgParser<'_, '_>) -> Result<(), SetTitleError> {
fn set_title(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: SetTitle = self.xdg.surface.client.parse(self, parser)?;
*self.toplevel_data.title.borrow_mut() = req.title.to_string();
self.tl_title_changed();
Ok(())
}
fn set_app_id(&self, parser: MsgParser<'_, '_>) -> Result<(), SetAppIdError> {
fn set_app_id(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: SetAppId = self.xdg.surface.client.parse(self, parser)?;
self.bugs.set(bugs::get(req.app_id));
Ok(())
}
fn show_window_menu(&self, parser: MsgParser<'_, '_>) -> Result<(), ShowWindowMenuError> {
fn show_window_menu(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: ShowWindowMenu = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
fn move_(&self, parser: MsgParser<'_, '_>) -> Result<(), MoveError> {
fn move_(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: Move = self.xdg.surface.client.parse(self, parser)?;
let seat = self.xdg.surface.client.lookup(req.seat)?;
if let Some(parent) = self.toplevel_data.parent.get() {
@ -232,15 +232,15 @@ impl XdgToplevel {
Ok(())
}
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), ResizeError> {
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: Resize = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
fn set_max_size(&self, parser: MsgParser<'_, '_>) -> Result<(), SetMaxSizeError> {
fn set_max_size(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: SetMaxSize = self.xdg.surface.client.parse(self, parser)?;
if req.height < 0 || req.width < 0 {
return Err(SetMaxSizeError::NonNegative);
return Err(XdgToplevelError::NonNegative);
}
self.max_width.set(if req.width == 0 {
None
@ -255,10 +255,10 @@ impl XdgToplevel {
Ok(())
}
fn set_min_size(&self, parser: MsgParser<'_, '_>) -> Result<(), SetMinSizeError> {
fn set_min_size(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let req: SetMinSize = self.xdg.surface.client.parse(self, parser)?;
if req.height < 0 || req.width < 0 {
return Err(SetMinSizeError::NonNegative);
return Err(XdgToplevelError::NonNegative);
}
self.min_width.set(if req.width == 0 {
None
@ -273,12 +273,12 @@ impl XdgToplevel {
Ok(())
}
fn set_maximized(&self, parser: MsgParser<'_, '_>) -> Result<(), SetMaximizedError> {
fn set_maximized(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: SetMaximized = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
fn unset_maximized(&self, parser: MsgParser<'_, '_>) -> Result<(), UnsetMaximizedError> {
fn unset_maximized(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: UnsetMaximized = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
@ -286,7 +286,7 @@ impl XdgToplevel {
fn set_fullscreen(
self: &Rc<Self>,
parser: MsgParser<'_, '_>,
) -> Result<(), SetFullscreenError> {
) -> Result<(), XdgToplevelError> {
let client = &self.xdg.surface.client;
let req: SetFullscreen = client.parse(self.deref(), parser)?;
self.states.borrow_mut().insert(STATE_FULLSCREEN);
@ -314,7 +314,7 @@ impl XdgToplevel {
fn unset_fullscreen(
self: &Rc<Self>,
parser: MsgParser<'_, '_>,
) -> Result<(), UnsetFullscreenError> {
) -> Result<(), XdgToplevelError> {
let _req: UnsetFullscreen = self.xdg.surface.client.parse(self.deref(), parser)?;
self.states.borrow_mut().remove(&STATE_FULLSCREEN);
self.toplevel_data
@ -323,7 +323,7 @@ impl XdgToplevel {
Ok(())
}
fn set_minimized(&self, parser: MsgParser<'_, '_>) -> Result<(), SetMinimizedError> {
fn set_minimized(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgToplevelError> {
let _req: SetMinimized = self.xdg.surface.client.parse(self, parser)?;
Ok(())
}
@ -347,7 +347,7 @@ impl XdgToplevel {
}
object_base! {
XdgToplevel, XdgToplevelError;
XdgToplevel;
DESTROY => destroy,
SET_PARENT => set_parent,
@ -576,176 +576,12 @@ impl XdgSurfaceExt for XdgToplevel {
#[derive(Debug, Error)]
pub enum XdgToplevelError {
#[error("Could not process `destroy` request")]
DestroyError(#[from] DestroyError),
#[error("Could not process `set_parent` request")]
SetParentError(#[from] SetParentError),
#[error("Could not process `set_title` request")]
SetTitleError(#[from] SetTitleError),
#[error("Could not process `set_app_id` request")]
SetAppIdError(#[from] SetAppIdError),
#[error("Could not process `show_window_menu` request")]
ShowWindowMenuError(#[from] ShowWindowMenuError),
#[error("Could not process `move` request")]
MoveError(#[from] MoveError),
#[error("Could not process `resize` request")]
ResizeError(#[from] ResizeError),
#[error("Could not process `set_max_size` request")]
SetMaxSizeError(#[from] SetMaxSizeError),
#[error("Could not process `set_min_size` request")]
SetMinSizeError(#[from] SetMinSizeError),
#[error("Could not process `set_maximized` request")]
SetMaximizedError(#[from] SetMaximizedError),
#[error("Could not process `unset_maximized` request")]
UnsetMaximizedError(#[from] UnsetMaximizedError),
#[error("Could not process `set_fullscreen` request")]
SetFullscreenError(#[from] SetFullscreenError),
#[error("Could not process `unset_fullscreen` request")]
UnsetFullscreenError(#[from] UnsetFullscreenError),
#[error("Could not process `set_minimized` request")]
SetMinimizedError(#[from] SetMinimizedError),
}
#[derive(Debug, Error)]
pub enum DestroyError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(DestroyError, ParseFailed, MsgParserError);
efrom!(DestroyError, ClientError);
#[derive(Debug, Error)]
pub enum SetParentError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetParentError, ParseFailed, MsgParserError);
efrom!(SetParentError, ClientError);
#[derive(Debug, Error)]
pub enum SetTitleError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetTitleError, ParseFailed, MsgParserError);
efrom!(SetTitleError, ClientError);
#[derive(Debug, Error)]
pub enum SetAppIdError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetAppIdError, ParseFailed, MsgParserError);
efrom!(SetAppIdError, ClientError);
#[derive(Debug, Error)]
pub enum ShowWindowMenuError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(ShowWindowMenuError, ParseFailed, MsgParserError);
efrom!(ShowWindowMenuError, ClientError);
#[derive(Debug, Error)]
pub enum MoveError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(MoveError, ParseFailed, MsgParserError);
efrom!(MoveError, ClientError);
#[derive(Debug, Error)]
pub enum ResizeError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(ResizeError, ParseFailed, MsgParserError);
efrom!(ResizeError, ClientError);
#[derive(Debug, Error)]
pub enum SetMaxSizeError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("width/height must be non-negative")]
NonNegative,
}
efrom!(SetMaxSizeError, ParseFailed, MsgParserError);
efrom!(SetMaxSizeError, ClientError);
#[derive(Debug, Error)]
pub enum SetMinSizeError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("width/height must be non-negative")]
NonNegative,
}
efrom!(SetMinSizeError, ParseFailed, MsgParserError);
efrom!(SetMinSizeError, ClientError);
#[derive(Debug, Error)]
pub enum SetMaximizedError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetMaximizedError, ParseFailed, MsgParserError);
efrom!(SetMaximizedError, ClientError);
#[derive(Debug, Error)]
pub enum UnsetMaximizedError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(UnsetMaximizedError, ParseFailed, MsgParserError);
efrom!(UnsetMaximizedError, ClientError);
#[derive(Debug, Error)]
pub enum SetFullscreenError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetFullscreenError, ParseFailed, MsgParserError);
efrom!(SetFullscreenError, ClientError);
#[derive(Debug, Error)]
pub enum UnsetFullscreenError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(UnsetFullscreenError, ParseFailed, MsgParserError);
efrom!(UnsetFullscreenError, ClientError, ClientError);
#[derive(Debug, Error)]
pub enum SetMinimizedError {
#[error("Parsing failed")]
ParseFailed(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetMinimizedError, ParseFailed, MsgParserError);
efrom!(SetMinimizedError, ClientError, ClientError);
efrom!(XdgToplevelError, MsgParserError);
efrom!(XdgToplevelError, ClientError);

View file

@ -130,10 +130,10 @@ impl ZwlrLayerSurfaceV1 {
self.client.event(Closed { self_id: self.id });
}
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSizeError> {
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetSize = self.client.parse(self, parser)?;
if req.width > u16::MAX as u32 || req.height > u16::MAX as u32 {
return Err(SetSizeError::ExcessiveSize);
return Err(ZwlrLayerSurfaceV1Error::ExcessiveSize);
}
self.pending
.size
@ -142,24 +142,24 @@ impl ZwlrLayerSurfaceV1 {
Ok(())
}
fn set_anchor(&self, parser: MsgParser<'_, '_>) -> Result<(), SetAnchorError> {
fn set_anchor(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetAnchor = self.client.parse(self, parser)?;
if req.anchor & !(LEFT | RIGHT | TOP | BOTTOM) != 0 {
return Err(SetAnchorError::UnknownAnchor(req.anchor));
return Err(ZwlrLayerSurfaceV1Error::UnknownAnchor(req.anchor));
}
self.pending.anchor.set(Some(req.anchor));
self.pending.any.set(true);
Ok(())
}
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), SetExclusiveZoneError> {
fn set_exclusive_zone(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetExclusiveZone = self.client.parse(self, parser)?;
self.pending.exclusive_zone.set(Some(req.zone));
self.pending.any.set(true);
Ok(())
}
fn set_margin(&self, parser: MsgParser<'_, '_>) -> Result<(), SetMarginError> {
fn set_margin(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetMargin = self.client.parse(self, parser)?;
self.pending
.margin
@ -171,10 +171,10 @@ impl ZwlrLayerSurfaceV1 {
fn set_keyboard_interactivity(
&self,
parser: MsgParser<'_, '_>,
) -> Result<(), SetKeyboardInteractivityError> {
) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetKeyboardInteractivity = self.client.parse(self, parser)?;
if req.keyboard_interactivity > KI_ON_DEMAND {
return Err(SetKeyboardInteractivityError::UnknownKi(
return Err(ZwlrLayerSurfaceV1Error::UnknownKi(
req.keyboard_interactivity,
));
}
@ -185,18 +185,18 @@ impl ZwlrLayerSurfaceV1 {
Ok(())
}
fn get_popup(&self, parser: MsgParser<'_, '_>) -> Result<(), GetPopupError> {
fn get_popup(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let _req: GetPopup = self.client.parse(self, parser)?;
Ok(())
}
fn ack_configure(&self, parser: MsgParser<'_, '_>) -> Result<(), AckConfigureError> {
fn ack_configure(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: AckConfigure = self.client.parse(self, parser)?;
self.acked_serial.set(Some(req.serial));
Ok(())
}
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let _req: Destroy = self.client.parse(self, parser)?;
self.destroy_node();
self.client.remove_obj(self)?;
@ -204,10 +204,10 @@ impl ZwlrLayerSurfaceV1 {
Ok(())
}
fn set_layer(&self, parser: MsgParser<'_, '_>) -> Result<(), SetLayerError> {
fn set_layer(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
let req: SetLayer = self.client.parse(self, parser)?;
if req.layer > OVERLAY {
return Err(SetLayerError::UnknownLayer(req.layer));
return Err(ZwlrLayerSurfaceV1Error::UnknownLayer(req.layer));
}
self.pending.layer.set(Some(req.layer));
self.pending.any.set(true);
@ -396,7 +396,7 @@ impl Node for ZwlrLayerSurfaceV1 {
}
object_base! {
ZwlrLayerSurfaceV1, ZwlrLayerSurfaceV1Error;
ZwlrLayerSurfaceV1;
SET_SIZE => set_size,
SET_ANCHOR => set_anchor,
@ -428,24 +428,6 @@ simple_add_obj!(ZwlrLayerSurfaceV1);
#[derive(Debug, Error)]
pub enum ZwlrLayerSurfaceV1Error {
#[error("Could not process `set_size` request")]
SetSizeError(#[from] SetSizeError),
#[error("Could not process `set_anchor` request")]
SetAnchorError(#[from] SetAnchorError),
#[error("Could not process `set_exclusive_zone` request")]
SetExclusiveZoneError(#[from] SetExclusiveZoneError),
#[error("Could not process `set_margin` request")]
SetMarginError(#[from] SetMarginError),
#[error("Could not process `set_keyboard_interactivity` request")]
SetKeyboardInteractivityError(#[from] SetKeyboardInteractivityError),
#[error("Could not process `get_popup` request")]
GetPopupError(#[from] GetPopupError),
#[error("Could not process `ack_configure` request")]
AckConfigureError(#[from] AckConfigureError),
#[error("Could not process `destroy` request")]
DestroyError(#[from] DestroyError),
#[error("Could not process `set_layer` request")]
SetLayerError(#[from] SetLayerError),
#[error("Surface {0} cannot be turned into a zwlr_layer_surface because it already has an attached zwlr_layer_surface")]
AlreadyAttached(WlSurfaceId),
#[error("Width was set to 0 but anchor did not contain LEFT and RIGHT")]
@ -454,103 +436,19 @@ pub enum ZwlrLayerSurfaceV1Error {
HeightZero,
#[error(transparent)]
WlSurfaceError(Box<WlSurfaceError>),
}
efrom!(ZwlrLayerSurfaceV1Error, WlSurfaceError);
#[derive(Debug, Error)]
pub enum SetSizeError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Surface size must not be larger than 65535x65535")]
ExcessiveSize,
}
efrom!(SetSizeError, MsgParserError);
efrom!(SetSizeError, ClientError);
#[derive(Debug, Error)]
pub enum SetAnchorError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Unknown anchor {0}")]
UnknownAnchor(u32),
}
efrom!(SetAnchorError, MsgParserError);
efrom!(SetAnchorError, ClientError);
#[derive(Debug, Error)]
pub enum SetExclusiveZoneError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetExclusiveZoneError, MsgParserError);
efrom!(SetExclusiveZoneError, ClientError);
#[derive(Debug, Error)]
pub enum SetMarginError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(SetMarginError, MsgParserError);
efrom!(SetMarginError, ClientError);
#[derive(Debug, Error)]
pub enum SetKeyboardInteractivityError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Unknown keyboard interactivity {0}")]
UnknownKi(u32),
}
efrom!(SetKeyboardInteractivityError, MsgParserError);
efrom!(SetKeyboardInteractivityError, ClientError);
#[derive(Debug, Error)]
pub enum GetPopupError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(GetPopupError, MsgParserError);
efrom!(GetPopupError, ClientError);
#[derive(Debug, Error)]
pub enum AckConfigureError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(AckConfigureError, MsgParserError);
efrom!(AckConfigureError, ClientError);
#[derive(Debug, Error)]
pub enum DestroyError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(DestroyError, MsgParserError);
efrom!(DestroyError, ClientError);
#[derive(Debug, Error)]
pub enum SetLayerError {
#[error("Parsing failed")]
MsgParserError(#[source] Box<MsgParserError>),
#[error(transparent)]
ClientError(Box<ClientError>),
#[error("Unknown layer {0}")]
UnknownLayer(u32),
#[error("Surface size must not be larger than 65535x65535")]
ExcessiveSize,
#[error("Unknown anchor {0}")]
UnknownAnchor(u32),
#[error("Unknown keyboard interactivity {0}")]
UnknownKi(u32),
}
efrom!(SetLayerError, MsgParserError);
efrom!(SetLayerError, ClientError);
efrom!(ZwlrLayerSurfaceV1Error, WlSurfaceError);
efrom!(ZwlrLayerSurfaceV1Error, MsgParserError);
efrom!(ZwlrLayerSurfaceV1Error, ClientError);

View file

@ -48,7 +48,7 @@ impl ZwpIdleInhibitorV1 {
}
}
object_base2! {
object_base! {
ZwpIdleInhibitorV1;
DESTROY => destroy,