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
|
|
@ -92,7 +92,7 @@ impl WlDataDevice {
|
|||
self.manager.client.event(Drop { self_id: self.id })
|
||||
}
|
||||
|
||||
fn start_drag(&self, parser: MsgParser<'_, '_>) -> Result<(), StartDragError> {
|
||||
fn start_drag(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let req: StartDrag = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to start_drag with an invalid serial");
|
||||
|
|
@ -117,7 +117,7 @@ impl WlDataDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSelectionError> {
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to set_selection with an invalid serial");
|
||||
|
|
@ -140,7 +140,7 @@ impl WlDataDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let _req: Release = self.manager.client.parse(self, parser)?;
|
||||
destroy_device::<Self>(self);
|
||||
self.seat.remove_data_device(self);
|
||||
|
|
@ -229,7 +229,7 @@ impl Vtable for WlDataDevice {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataDevice, WlDataDeviceError;
|
||||
WlDataDevice;
|
||||
|
||||
START_DRAG => start_drag,
|
||||
SET_SELECTION => set_selection,
|
||||
|
|
@ -251,52 +251,16 @@ simple_add_obj!(WlDataDevice);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDataDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `start_drag` request")]
|
||||
StartDragError(#[from] StartDragError),
|
||||
#[error("Could not process `set_selection` request")]
|
||||
SetSelectionError(#[from] SetSelectionError),
|
||||
#[error("Could not process `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
}
|
||||
efrom!(WlDataDeviceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum StartDragError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
#[error(transparent)]
|
||||
WlSurfaceError(Box<WlSurfaceError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(StartDragError, ParseFailed, MsgParserError);
|
||||
efrom!(StartDragError, ClientError);
|
||||
efrom!(StartDragError, WlSeatError);
|
||||
efrom!(StartDragError, WlSurfaceError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetSelectionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(SetSelectionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetSelectionError, ClientError);
|
||||
efrom!(SetSelectionError, WlSeatError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ParseFailed, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError);
|
||||
efrom!(WlDataDeviceError, MsgParserError);
|
||||
efrom!(WlDataDeviceError, ClientError);
|
||||
efrom!(WlDataDeviceError, WlSeatError);
|
||||
efrom!(WlDataDeviceError, WlSurfaceError);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl WlDataDeviceManagerGlobal {
|
|||
}
|
||||
|
||||
impl WlDataDeviceManager {
|
||||
fn create_data_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateDataSourceError> {
|
||||
fn create_data_source(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceManagerError> {
|
||||
let req: CreateDataSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(WlDataSource::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
|
|
@ -67,7 +67,7 @@ impl WlDataDeviceManager {
|
|||
fn get_data_device(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), GetDataDeviceError> {
|
||||
) -> Result<(), WlDataDeviceManagerError> {
|
||||
let req: GetDataDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(WlDataDevice::new(req.id, self, &seat));
|
||||
|
|
@ -97,7 +97,7 @@ impl Global for WlDataDeviceManagerGlobal {
|
|||
simple_add_global!(WlDataDeviceManagerGlobal);
|
||||
|
||||
object_base! {
|
||||
WlDataDeviceManager, WlDataDeviceManagerError;
|
||||
WlDataDeviceManager;
|
||||
|
||||
CREATE_DATA_SOURCE => create_data_source,
|
||||
GET_DATA_DEVICE => get_data_device,
|
||||
|
|
@ -115,29 +115,8 @@ simple_add_obj!(WlDataDeviceManager);
|
|||
pub enum WlDataDeviceManagerError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `create_data_source` request")]
|
||||
CreateDataSourceError(#[from] CreateDataSourceError),
|
||||
#[error("Could not process `get_data_device` request")]
|
||||
GetDataDeviceError(#[from] GetDataDeviceError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(WlDataDeviceManagerError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateDataSourceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateDataSourceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateDataSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetDataDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetDataDeviceError, ParseFailed, MsgParserError);
|
||||
efrom!(GetDataDeviceError, ClientError);
|
||||
efrom!(WlDataDeviceManagerError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ impl WlDataOffer {
|
|||
})
|
||||
}
|
||||
|
||||
fn accept(&self, parser: MsgParser<'_, '_>) -> Result<(), AcceptError> {
|
||||
fn accept(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: Accept = self.client.parse(self, parser)?;
|
||||
let _ = req.serial; // unused
|
||||
let mut state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(AcceptError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if req.mime_type.is_some() {
|
||||
state |= OFFER_STATE_ACCEPTED;
|
||||
|
|
@ -80,36 +80,36 @@ impl WlDataOffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ReceiveError> {
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: Receive = self.client.parse(self, parser)?;
|
||||
if self.data.shared.state.get().contains(OFFER_STATE_FINISHED) {
|
||||
return Err(ReceiveError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
receive::<WlDataDevice>(self, req.mime_type, req.fd);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
destroy_offer::<WlDataDevice>(self);
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), FinishError> {
|
||||
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let _req: Finish = self.client.parse(self, parser)?;
|
||||
if self.data.shared.role.get() != Role::Dnd {
|
||||
return Err(FinishError::NotDnd);
|
||||
return Err(WlDataOfferError::NotDnd);
|
||||
}
|
||||
let mut state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(FinishError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if !state.contains(OFFER_STATE_DROPPED) {
|
||||
return Err(FinishError::StillDragging);
|
||||
return Err(WlDataOfferError::StillDragging);
|
||||
}
|
||||
if !state.contains(OFFER_STATE_ACCEPTED) {
|
||||
return Err(FinishError::NoMimeTypeAccepted);
|
||||
return Err(WlDataOfferError::NoMimeTypeAccepted);
|
||||
}
|
||||
state |= OFFER_STATE_FINISHED;
|
||||
if let Some(src) = self.data.source.get() {
|
||||
|
|
@ -122,17 +122,17 @@ impl WlDataOffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), SetActionsError> {
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: SetActions = self.client.parse(self, parser)?;
|
||||
let state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(SetActionsError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if (req.dnd_actions & !DND_ALL, req.preferred_action & !DND_ALL) != (0, 0) {
|
||||
return Err(SetActionsError::InvalidActions);
|
||||
return Err(WlDataOfferError::InvalidActions);
|
||||
}
|
||||
if req.preferred_action.count_ones() > 1 {
|
||||
return Err(SetActionsError::MultiplePreferred);
|
||||
return Err(WlDataOfferError::MultiplePreferred);
|
||||
}
|
||||
self.data.shared.receiver_actions.set(req.dnd_actions);
|
||||
self.data
|
||||
|
|
@ -147,7 +147,7 @@ impl WlDataOffer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataOffer, WlDataOfferError;
|
||||
WlDataOffer;
|
||||
|
||||
ACCEPT => accept,
|
||||
RECEIVE => receive,
|
||||
|
|
@ -172,59 +172,8 @@ simple_add_obj!(WlDataOffer);
|
|||
pub enum WlDataOfferError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `accept` request")]
|
||||
AcceptError(#[from] AcceptError),
|
||||
#[error("Could not process `receive` request")]
|
||||
ReceiveError(#[from] ReceiveError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `finish` request")]
|
||||
FinishError(#[from] FinishError),
|
||||
#[error("Could not process `set_actions` request")]
|
||||
SetActionsError(#[from] SetActionsError),
|
||||
}
|
||||
efrom!(WlDataOfferError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AcceptError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
}
|
||||
efrom!(AcceptError, ParseFailed, MsgParserError);
|
||||
efrom!(AcceptError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReceiveError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
}
|
||||
efrom!(ReceiveError, ParseFailed, MsgParserError);
|
||||
efrom!(ReceiveError, ClientError);
|
||||
|
||||
#[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 FinishError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
#[error("The drag operation is still ongoing")]
|
||||
|
|
@ -233,22 +182,10 @@ pub enum FinishError {
|
|||
NoMimeTypeAccepted,
|
||||
#[error("This is not a drag-and-drop offer")]
|
||||
NotDnd,
|
||||
}
|
||||
efrom!(FinishError, ParseFailed, MsgParserError);
|
||||
efrom!(FinishError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetActionsError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
#[error("The set of actions is invalid")]
|
||||
InvalidActions,
|
||||
#[error("Multiple preferred actions were specified")]
|
||||
MultiplePreferred,
|
||||
}
|
||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
||||
efrom!(SetActionsError, ClientError);
|
||||
efrom!(WlDataOfferError, ClientError);
|
||||
efrom!(WlDataOfferError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -138,26 +138,26 @@ impl WlDataSource {
|
|||
.event(DndDropPerformed { self_id: self.id })
|
||||
}
|
||||
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), OfferError> {
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let req: Offer = self.data.client.parse(self, parser)?;
|
||||
add_mime_type::<WlDataDevice>(self, req.mime_type);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||
destroy_source::<WlDataDevice>(self);
|
||||
self.data.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), SetActionsError> {
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let req: SetActions = self.data.client.parse(self, parser)?;
|
||||
if self.data.actions.get().is_some() {
|
||||
return Err(SetActionsError::AlreadySet);
|
||||
return Err(WlDataSourceError::AlreadySet);
|
||||
}
|
||||
if req.dnd_actions & !DND_ALL != 0 {
|
||||
return Err(SetActionsError::InvalidActions);
|
||||
return Err(WlDataSourceError::InvalidActions);
|
||||
}
|
||||
self.data.actions.set(Some(req.dnd_actions));
|
||||
Ok(())
|
||||
|
|
@ -165,7 +165,7 @@ impl WlDataSource {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataSource, WlDataSourceError;
|
||||
WlDataSource;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -186,41 +186,8 @@ dedicated_add_obj!(WlDataSource, WlDataSourceId, wl_data_source);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDataSourceError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `offer` request")]
|
||||
OfferError(#[from] OfferError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `set_actions` request")]
|
||||
SetActionsError(#[from] SetActionsError),
|
||||
}
|
||||
efrom!(WlDataSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OfferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(OfferError, ParseFailed, MsgParserError);
|
||||
efrom!(OfferError, ClientError);
|
||||
|
||||
#[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 SetActionsError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("The set of actions is invalid")]
|
||||
|
|
@ -228,5 +195,5 @@ pub enum SetActionsError {
|
|||
#[error("The actions have already been set")]
|
||||
AlreadySet,
|
||||
}
|
||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
||||
efrom!(SetActionsError, ClientError);
|
||||
efrom!(WlDataSourceError, ClientError);
|
||||
efrom!(WlDataSourceError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
}
|
||||
|
||||
impl ZwpPrimarySelectionDeviceManagerV1 {
|
||||
fn create_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSourceError> {
|
||||
fn create_source(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let req: CreateSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(ZwpPrimarySelectionSourceV1::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
|
|
@ -58,7 +58,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_data_device(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetDeviceError> {
|
||||
fn get_data_device(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let req: GetDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(ZwpPrimarySelectionDeviceV1::new(req.id, self, &seat));
|
||||
|
|
@ -68,7 +68,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -94,7 +94,7 @@ impl Global for ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceManagerV1, ZwpPrimarySelectionDeviceManagerV1Error;
|
||||
ZwpPrimarySelectionDeviceManagerV1;
|
||||
|
||||
CREATE_SOURCE => create_source,
|
||||
GET_DEVICE => get_data_device,
|
||||
|
|
@ -111,43 +111,10 @@ simple_add_obj!(ZwpPrimarySelectionDeviceManagerV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPrimarySelectionDeviceManagerV1Error {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `create_source` request")]
|
||||
CreateSourceError(#[from] CreateSourceError),
|
||||
#[error("Could not process `get_device` request")]
|
||||
GetDeviceError(#[from] GetDeviceError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, ClientError);
|
||||
|
||||
#[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 CreateSourceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateSourceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetDeviceError, ParseFailed, MsgParserError);
|
||||
efrom!(GetDeviceError, ClientError);
|
||||
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSelectionError> {
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceV1Error> {
|
||||
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to set_selection with an invalid serial");
|
||||
|
|
@ -86,7 +86,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceV1Error> {
|
||||
let _req: Destroy = self.manager.client.parse(self, parser)?;
|
||||
destroy_device::<Self>(self);
|
||||
self.seat.remove_primary_selection_device(self);
|
||||
|
|
@ -171,7 +171,7 @@ impl Vtable for ZwpPrimarySelectionDeviceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceV1, ZwpPrimarySelectionDeviceV1Error;
|
||||
ZwpPrimarySelectionDeviceV1;
|
||||
|
||||
SET_SELECTION => set_selection,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -194,32 +194,11 @@ simple_add_obj!(ZwpPrimarySelectionDeviceV1);
|
|||
pub enum ZwpPrimarySelectionDeviceV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `set_selection` request")]
|
||||
SetSelectionError(#[from] SetSelectionError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetSelectionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(SetSelectionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetSelectionError, ClientError);
|
||||
efrom!(SetSelectionError, WlSeatError);
|
||||
|
||||
#[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);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, ClientError);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, MsgParserError);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, WlSeatError);
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ impl ZwpPrimarySelectionOfferV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ReceiveError> {
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionOfferV1Error> {
|
||||
let req: Receive = self.client.parse(self, parser)?;
|
||||
receive::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type, req.fd);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionOfferV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
destroy_offer::<ZwpPrimarySelectionDeviceV1>(self);
|
||||
self.client.remove_obj(self)?;
|
||||
|
|
@ -44,7 +44,7 @@ impl ZwpPrimarySelectionOfferV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionOfferV1, ZwpPrimarySelectionOfferV1Error;
|
||||
ZwpPrimarySelectionOfferV1;
|
||||
|
||||
RECEIVE => receive,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -64,31 +64,10 @@ simple_add_obj!(ZwpPrimarySelectionOfferV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPrimarySelectionOfferV1Error {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `receive` request")]
|
||||
ReceiveError(#[from] ReceiveError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionOfferV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReceiveError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReceiveError, ParseFailed, MsgParserError);
|
||||
efrom!(ReceiveError, ClientError);
|
||||
|
||||
#[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);
|
||||
efrom!(ZwpPrimarySelectionOfferV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), OfferError> {
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionSourceV1Error> {
|
||||
let req: Offer = self.data.client.parse(self, parser)?;
|
||||
add_mime_type::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionSourceV1Error> {
|
||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||
destroy_source::<ZwpPrimarySelectionDeviceV1>(self);
|
||||
self.data.client.remove_obj(self)?;
|
||||
|
|
@ -57,7 +57,7 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionSourceV1, ZwpPrimarySelectionSourceV1Error;
|
||||
ZwpPrimarySelectionSourceV1;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -83,29 +83,8 @@ dedicated_add_obj!(
|
|||
pub enum ZwpPrimarySelectionSourceV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `offer` request")]
|
||||
OfferError(#[from] OfferError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionSourceV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OfferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(OfferError, ParseFailed, MsgParserError);
|
||||
efrom!(OfferError, ClientError);
|
||||
|
||||
#[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);
|
||||
efrom!(ZwpPrimarySelectionSourceV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ impl JayCompositor {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
JayCompositor;
|
||||
|
||||
DESTROY => destroy,
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ impl JayIdle {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
JayIdle;
|
||||
|
||||
GET_STATUS => get_status,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ impl JayLogFile {
|
|||
}
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), JayLogFileError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -41,7 +41,7 @@ impl JayLogFile {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
JayLogFile, JayLogFileError;
|
||||
JayLogFile;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
|
@ -56,16 +56,10 @@ simple_add_obj!(JayLogFile);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum JayLogFileError {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, MsgParserError);
|
||||
efrom!(JayLogFileError, ClientError);
|
||||
efrom!(JayLogFileError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl JayScreenshot {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
JayScreenshot;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,16 +40,16 @@ impl OrgKdeKwinServerDecoration {
|
|||
})
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), OrgKdeKwinServerDecorationError> {
|
||||
let _req: Release = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn request_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), RequestModeError> {
|
||||
fn request_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), OrgKdeKwinServerDecorationError> {
|
||||
let req: RequestMode = self.client.parse(&**self, parser)?;
|
||||
if req.mode > SERVER {
|
||||
return Err(RequestModeError::InvalidMode(req.mode));
|
||||
return Err(OrgKdeKwinServerDecorationError::InvalidMode(req.mode));
|
||||
}
|
||||
let mode = if self.requested.replace(true) {
|
||||
req.mode
|
||||
|
|
@ -62,7 +62,7 @@ impl OrgKdeKwinServerDecoration {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
OrgKdeKwinServerDecoration, OrgKdeKwinServerDecorationError;
|
||||
OrgKdeKwinServerDecoration;
|
||||
|
||||
RELEASE => release,
|
||||
REQUEST_MODE => request_mode,
|
||||
|
|
@ -78,33 +78,12 @@ simple_add_obj!(OrgKdeKwinServerDecoration);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OrgKdeKwinServerDecorationError {
|
||||
#[error("Could not process a `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
#[error("Could not process a `request_mode` request")]
|
||||
RequestModeError(#[from] RequestModeError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(OrgKdeKwinServerDecorationError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ReleaseError, ClientError);
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum RequestModeError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Mode {0} does not exist")]
|
||||
InvalidMode(u32),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(RequestModeError, ClientError);
|
||||
efrom!(RequestModeError, ParseError, MsgParserError);
|
||||
efrom!(OrgKdeKwinServerDecorationError, ClientError);
|
||||
efrom!(OrgKdeKwinServerDecorationError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use {
|
|||
std::rc::Rc,
|
||||
thiserror::Error,
|
||||
};
|
||||
use crate::ifs::org_kde_kwin_server_decoration::OrgKdeKwinServerDecorationError;
|
||||
|
||||
#[allow(dead_code)]
|
||||
const NONE: u32 = 0;
|
||||
|
|
@ -78,7 +79,7 @@ impl OrgKdeKwinServerDecorationManager {
|
|||
})
|
||||
}
|
||||
|
||||
fn create(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateError> {
|
||||
fn create(&self, parser: MsgParser<'_, '_>) -> Result<(), OrgKdeKwinServerDecorationError> {
|
||||
let req: Create = self.client.parse(self, parser)?;
|
||||
let _ = self.client.lookup(req.surface)?;
|
||||
let obj = Rc::new(OrgKdeKwinServerDecoration::new(req.id, &self.client));
|
||||
|
|
@ -90,7 +91,7 @@ impl OrgKdeKwinServerDecorationManager {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
OrgKdeKwinServerDecorationManager, OrgKdeKwinServerDecorationManagerError;
|
||||
OrgKdeKwinServerDecorationManager;
|
||||
|
||||
CREATE => create,
|
||||
}
|
||||
|
|
@ -105,23 +106,10 @@ simple_add_obj!(OrgKdeKwinServerDecorationManager);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OrgKdeKwinServerDecorationManagerError {
|
||||
#[error("Could not process a `create` request")]
|
||||
CreateError(#[from] CreateError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(
|
||||
OrgKdeKwinServerDecorationManagerError,
|
||||
ClientError,
|
||||
ClientError
|
||||
);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(CreateError, ClientError);
|
||||
efrom!(CreateError, ParseError, MsgParserError);
|
||||
efrom!(OrgKdeKwinServerDecorationManagerError, ClientError);
|
||||
efrom!(OrgKdeKwinServerDecorationManagerError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ impl WlBuffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlBufferError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
self.destroyed.set(true);
|
||||
|
|
@ -131,7 +131,7 @@ impl WlBuffer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlBuffer, WlBufferError;
|
||||
WlBuffer;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
|
@ -150,22 +150,16 @@ pub enum WlBufferError {
|
|||
OutOfBounds,
|
||||
#[error("The stride does not fit all pixels in a row")]
|
||||
StrideTooSmall,
|
||||
#[error("Could not handle a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not access the client memory")]
|
||||
ClientMemError(#[source] Box<ClientMemError>),
|
||||
#[error("GLES could not import the client image")]
|
||||
GlesError(#[source] Box<RenderError>),
|
||||
}
|
||||
efrom!(WlBufferError, ClientMemError);
|
||||
efrom!(WlBufferError, GlesError, RenderError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
RenderError(#[source] Box<RenderError>),
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(WlBufferError, ClientMemError);
|
||||
efrom!(WlBufferError, RenderError);
|
||||
efrom!(WlBufferError, MsgParserError);
|
||||
efrom!(WlBufferError, ClientError);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl WlCallback {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlCallback, WlCallbackError;
|
||||
WlCallback;
|
||||
}
|
||||
|
||||
impl Object for WlCallback {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl WlCompositorGlobal {
|
|||
}
|
||||
|
||||
impl WlCompositor {
|
||||
fn create_surface(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSurfaceError> {
|
||||
fn create_surface(&self, parser: MsgParser<'_, '_>) -> Result<(), WlCompositorError> {
|
||||
let surface: CreateSurface = self.client.parse(self, parser)?;
|
||||
let surface = Rc::new(WlSurface::new(surface.id, &self.client));
|
||||
track!(self.client, surface);
|
||||
|
|
@ -63,7 +63,7 @@ impl WlCompositor {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn create_region(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateRegionError> {
|
||||
fn create_region(&self, parser: MsgParser<'_, '_>) -> Result<(), WlCompositorError> {
|
||||
let region: CreateRegion = self.client.parse(self, parser)?;
|
||||
let region = Rc::new(WlRegion::new(region.id, &self.client));
|
||||
track!(self.client, region);
|
||||
|
|
@ -87,7 +87,7 @@ impl Global for WlCompositorGlobal {
|
|||
simple_add_global!(WlCompositorGlobal);
|
||||
|
||||
object_base! {
|
||||
WlCompositor, WlCompositorError;
|
||||
WlCompositor;
|
||||
|
||||
CREATE_SURFACE => create_surface,
|
||||
CREATE_REGION => create_region,
|
||||
|
|
@ -105,34 +105,9 @@ simple_add_obj!(WlCompositor);
|
|||
pub enum WlCompositorError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `create_surface` request")]
|
||||
CreateSurfaceError(#[source] Box<CreateSurfaceError>),
|
||||
#[error("Could not process `create_region` request")]
|
||||
CreateRegionError(#[source] Box<CreateRegionError>),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
|
||||
efrom!(WlCompositorError, ClientError);
|
||||
efrom!(WlCompositorError, CreateSurfaceError);
|
||||
efrom!(WlCompositorError, CreateRegionError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateSurfaceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
|
||||
efrom!(CreateSurfaceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateSurfaceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateRegionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
|
||||
efrom!(CreateRegionError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateRegionError, ClientError, ClientError);
|
||||
efrom!(WlCompositorError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientError},
|
||||
globals::GlobalsError,
|
||||
ifs::{wl_callback::WlCallback, wl_registry::WlRegistry},
|
||||
leaks::Tracker,
|
||||
object::{Object, ObjectId, WL_DISPLAY_ID},
|
||||
|
|
@ -33,7 +32,7 @@ impl WlDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
fn sync(&self, parser: MsgParser<'_, '_>) -> Result<(), SyncError> {
|
||||
fn sync(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDisplayError> {
|
||||
let sync: Sync = self.client.parse(self, parser)?;
|
||||
let cb = Rc::new(WlCallback::new(sync.callback, &self.client));
|
||||
track!(self.client, cb);
|
||||
|
|
@ -43,7 +42,7 @@ impl WlDisplay {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_registry(&self, parser: MsgParser<'_, '_>) -> Result<(), GetRegistryError> {
|
||||
fn get_registry(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDisplayError> {
|
||||
let gr: GetRegistry = self.client.parse(self, parser)?;
|
||||
let registry = Rc::new(WlRegistry::new(gr.registry, &self.client));
|
||||
track!(self.client, registry);
|
||||
|
|
@ -90,7 +89,7 @@ impl WlDisplay {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDisplay, WlDisplayError;
|
||||
WlDisplay;
|
||||
|
||||
SYNC => sync,
|
||||
GET_REGISTRY => get_registry,
|
||||
|
|
@ -104,36 +103,10 @@ impl Object for WlDisplay {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDisplayError {
|
||||
#[error("Could not process a get_registry request")]
|
||||
GetRegistryError(#[source] Box<GetRegistryError>),
|
||||
#[error("A client error occurred")]
|
||||
SyncError(#[source] Box<SyncError>),
|
||||
}
|
||||
|
||||
efrom!(WlDisplayError, GetRegistryError);
|
||||
efrom!(WlDisplayError, SyncError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetRegistryError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("An error occurred while processing globals")]
|
||||
GlobalsError(#[source] Box<GlobalsError>),
|
||||
}
|
||||
|
||||
efrom!(GetRegistryError, ParseFailed, MsgParserError);
|
||||
efrom!(GetRegistryError, GlobalsError);
|
||||
efrom!(GetRegistryError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SyncError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
|
||||
efrom!(SyncError, ParseFailed, MsgParserError);
|
||||
efrom!(SyncError, ClientError);
|
||||
efrom!(WlDisplayError, MsgParserError);
|
||||
efrom!(WlDisplayError, ClientError);
|
||||
|
|
|
|||
|
|
@ -91,38 +91,38 @@ impl WlDrm {
|
|||
})
|
||||
}
|
||||
|
||||
fn authenticate(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), AuthenticateError> {
|
||||
fn authenticate(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlDrmError> {
|
||||
let _req: Authenticate = self.client.parse(&**self, parser)?;
|
||||
self.send_authenticated();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_buffer(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CreateBufferError> {
|
||||
fn create_buffer(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlDrmError> {
|
||||
let _req: CreateBuffer = self.client.parse(&**self, parser)?;
|
||||
Err(CreateBufferError::Unsupported)
|
||||
Err(WlDrmError::Unsupported)
|
||||
}
|
||||
|
||||
fn create_planar_buffer(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), CreatePlanarBufferError> {
|
||||
) -> Result<(), WlDrmError> {
|
||||
let _req: CreatePlanarBuffer = self.client.parse(&**self, parser)?;
|
||||
Err(CreatePlanarBufferError::Unsupported)
|
||||
Err(WlDrmError::Unsupported)
|
||||
}
|
||||
|
||||
fn create_prime_buffer(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), CreatePrimeBufferError> {
|
||||
) -> Result<(), WlDrmError> {
|
||||
let req: CreatePrimeBuffer = self.client.parse(&**self, parser)?;
|
||||
let ctx = match self.client.state.render_ctx.get() {
|
||||
Some(ctx) => ctx,
|
||||
None => return Err(CreatePrimeBufferError::NoRenderContext),
|
||||
None => return Err(WlDrmError::NoRenderContext),
|
||||
};
|
||||
let formats = ctx.formats();
|
||||
let format = match formats.get(&req.format) {
|
||||
Some(f) => f.format,
|
||||
None => return Err(CreatePrimeBufferError::InvalidFormat(req.format)),
|
||||
None => return Err(WlDrmError::InvalidFormat(req.format)),
|
||||
};
|
||||
let mut dmabuf = DmaBuf {
|
||||
width: req.width,
|
||||
|
|
@ -161,7 +161,7 @@ impl WlDrm {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDrm, WlDrmError;
|
||||
WlDrm;
|
||||
|
||||
AUTHENTICATE => authenticate,
|
||||
CREATE_BUFFER => create_buffer,
|
||||
|
|
@ -179,56 +179,18 @@ simple_add_obj!(WlDrm);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDrmError {
|
||||
#[error("Could not process a `authenticate` request")]
|
||||
AuthenticateError(#[from] AuthenticateError),
|
||||
#[error("Could not process a `create_buffer` request")]
|
||||
CreateBufferError(#[from] CreateBufferError),
|
||||
#[error("Could not process a `create_planar_buffer` request")]
|
||||
CreatePlanarBufferError(#[from] CreatePlanarBufferError),
|
||||
#[error("Could not process a `create_prime_buffer` request")]
|
||||
CreatePrimeBufferError(#[from] CreatePrimeBufferError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(WlDrmError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AuthenticateError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(AuthenticateError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateBufferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("This api is not supported")]
|
||||
Unsupported,
|
||||
}
|
||||
efrom!(CreateBufferError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreatePlanarBufferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("This api is not supported")]
|
||||
Unsupported,
|
||||
}
|
||||
efrom!(CreatePlanarBufferError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreatePrimeBufferError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("This api is not supported")]
|
||||
Unsupported,
|
||||
#[error("The compositor has no render context attached")]
|
||||
NoRenderContext,
|
||||
#[error("The format {0} is not supported")]
|
||||
InvalidFormat(u32),
|
||||
#[error("Could not import the buffer")]
|
||||
ImportError(#[from] RenderError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreatePrimeBufferError, MsgParserError);
|
||||
efrom!(CreatePrimeBufferError, ClientError);
|
||||
efrom!(WlDrmError, ClientError);
|
||||
efrom!(WlDrmError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ impl WlOutput {
|
|||
}
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlOutputError> {
|
||||
let _req: Release = self.client.parse(self, parser)?;
|
||||
self.xdg_outputs.clear();
|
||||
self.remove_binding();
|
||||
|
|
@ -240,7 +240,7 @@ impl WlOutput {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlOutput, WlOutputError;
|
||||
WlOutput;
|
||||
|
||||
RELEASE => release,
|
||||
}
|
||||
|
|
@ -264,19 +264,10 @@ dedicated_add_obj!(WlOutput, WlOutputId, outputs);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlOutputError {
|
||||
#[error("Could not handle `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(WlOutputError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ClientError);
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(WlOutputError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl WlRegistry {
|
|||
})
|
||||
}
|
||||
|
||||
fn bind(&self, parser: MsgParser<'_, '_>) -> Result<(), BindError> {
|
||||
fn bind(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegistryError> {
|
||||
let bind: Bind = self.client.parse(self, parser)?;
|
||||
let global = self
|
||||
.client
|
||||
|
|
@ -50,14 +50,14 @@ impl WlRegistry {
|
|||
.globals
|
||||
.get(GlobalName::from_raw(bind.name))?;
|
||||
if global.interface().name() != bind.interface {
|
||||
return Err(BindError::InvalidInterface(InterfaceError {
|
||||
return Err(WlRegistryError::InvalidInterface(InterfaceError {
|
||||
name: global.name(),
|
||||
interface: global.interface(),
|
||||
actual: bind.interface.to_string(),
|
||||
}));
|
||||
}
|
||||
if bind.version > global.version() {
|
||||
return Err(BindError::InvalidVersion(VersionError {
|
||||
return Err(WlRegistryError::InvalidVersion(VersionError {
|
||||
name: global.name(),
|
||||
interface: global.interface(),
|
||||
version: global.version(),
|
||||
|
|
@ -70,7 +70,7 @@ impl WlRegistry {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlRegistry, WlRegistryError;
|
||||
WlRegistry;
|
||||
|
||||
BIND => bind,
|
||||
}
|
||||
|
|
@ -85,16 +85,8 @@ simple_add_obj!(WlRegistry);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlRegistryError {
|
||||
#[error("Could not process bind request")]
|
||||
BindError(#[source] Box<BindError>),
|
||||
}
|
||||
|
||||
efrom!(WlRegistryError, BindError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum BindError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
GlobalsError(Box<GlobalsError>),
|
||||
#[error("Tried to bind to global {} of type {} using interface {}", .0.name, .0.interface.name(), .0.actual)]
|
||||
|
|
@ -102,8 +94,8 @@ pub enum BindError {
|
|||
#[error("Tried to bind to global {} of type {} and version {} using version {}", .0.name, .0.interface.name(), .0.version, .0.actual)]
|
||||
InvalidVersion(VersionError),
|
||||
}
|
||||
efrom!(BindError, ParseError, MsgParserError);
|
||||
efrom!(BindError, GlobalsError);
|
||||
efrom!(WlRegistryError, MsgParserError);
|
||||
efrom!(WlRegistryError, GlobalsError);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct InterfaceError {
|
||||
|
|
|
|||
|
|
@ -711,7 +711,7 @@ impl WlSeat {
|
|||
self.global.move_(node);
|
||||
}
|
||||
|
||||
fn get_pointer(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetPointerError> {
|
||||
fn get_pointer(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSeatError> {
|
||||
let req: GetPointer = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlPointer::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
|
|
@ -720,7 +720,7 @@ impl WlSeat {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_keyboard(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetKeyboardError> {
|
||||
fn get_keyboard(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSeatError> {
|
||||
let req: GetKeyboard = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlKeyboard::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
|
|
@ -760,7 +760,7 @@ impl WlSeat {
|
|||
Ok(Rc::new(fd))
|
||||
}
|
||||
|
||||
fn get_touch(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetTouchError> {
|
||||
fn get_touch(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSeatError> {
|
||||
let req: GetTouch = self.client.parse(&**self, parser)?;
|
||||
let p = Rc::new(WlTouch::new(req.id, self));
|
||||
track!(self.client, p);
|
||||
|
|
@ -768,7 +768,7 @@ impl WlSeat {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSeatError> {
|
||||
let _req: Release = self.client.parse(self, parser)?;
|
||||
{
|
||||
let mut bindings = self.global.bindings.borrow_mut();
|
||||
|
|
@ -785,7 +785,7 @@ impl WlSeat {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlSeat, WlSeatError;
|
||||
WlSeat;
|
||||
|
||||
GET_POINTER => get_pointer,
|
||||
GET_KEYBOARD => get_keyboard,
|
||||
|
|
@ -821,63 +821,18 @@ dedicated_add_obj!(WlSeat, WlSeatId, seats);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlSeatError {
|
||||
#[error("Could not handle `get_pointer` request")]
|
||||
GetPointerError(#[from] GetPointerError),
|
||||
#[error("Could not handle `get_keyboard` request")]
|
||||
GetKeyboardError(#[from] GetKeyboardError),
|
||||
#[error("Could not handle `get_touch` request")]
|
||||
GetTouchError(#[from] GetTouchError),
|
||||
#[error("Could not handle `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
IpcError(#[from] IpcError),
|
||||
}
|
||||
efrom!(WlSeatError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetPointerError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetPointerError, ClientError);
|
||||
efrom!(GetPointerError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetKeyboardError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlKeyboardError(Box<WlKeyboardError>),
|
||||
}
|
||||
efrom!(GetKeyboardError, ClientError);
|
||||
efrom!(GetKeyboardError, ParseError, MsgParserError);
|
||||
efrom!(GetKeyboardError, WlKeyboardError, WlKeyboardError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetTouchError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetTouchError, ClientError, ClientError);
|
||||
efrom!(GetTouchError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(WlSeatError, ClientError);
|
||||
efrom!(WlSeatError, MsgParserError);
|
||||
efrom!(WlSeatError, WlKeyboardError);
|
||||
|
||||
pub fn collect_kb_foci2(node: Rc<dyn Node>, seats: &mut SmallVec<[Rc<WlSeatGlobal>; 3]>) {
|
||||
node.node_visit(&mut generic_node_visitor(|node| {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use {
|
|||
thiserror::Error,
|
||||
uapi::OwnedFd,
|
||||
};
|
||||
use crate::utils::oserror::OsError;
|
||||
|
||||
pub const REPEAT_INFO_SINCE: u32 = 4;
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ impl WlKeyboard {
|
|||
})
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlKeyboardError> {
|
||||
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||
self.seat.keyboards.remove(&self.id);
|
||||
self.seat.client.remove_obj(self)?;
|
||||
|
|
@ -107,7 +108,7 @@ impl WlKeyboard {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlKeyboard, WlKeyboardError;
|
||||
WlKeyboard;
|
||||
|
||||
RELEASE => release,
|
||||
}
|
||||
|
|
@ -124,21 +125,12 @@ simple_add_obj!(WlKeyboard);
|
|||
pub enum WlKeyboardError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
#[error("Could not create a keymap memfd")]
|
||||
KeymapMemfd(#[source] crate::utils::oserror::OsError),
|
||||
KeymapMemfd(#[source] OsError),
|
||||
#[error("Could not copy the keymap")]
|
||||
KeymapCopy(#[source] crate::utils::oserror::OsError),
|
||||
}
|
||||
efrom!(WlKeyboardError, ClientError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
KeymapCopy(#[source] OsError),
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
efrom!(WlKeyboardError, ClientError);
|
||||
efrom!(WlKeyboardError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ impl WlPointer {
|
|||
})
|
||||
}
|
||||
|
||||
fn set_cursor(&self, parser: MsgParser<'_, '_>) -> Result<(), SetCursorError> {
|
||||
fn set_cursor(&self, parser: MsgParser<'_, '_>) -> Result<(), WlPointerError> {
|
||||
let req: SetCursor = self.seat.client.parse(self, parser)?;
|
||||
if !self.seat.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to set_cursor with an invalid serial");
|
||||
|
|
@ -184,7 +184,7 @@ impl WlPointer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlPointerError> {
|
||||
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||
self.seat.pointers.remove(&self.id);
|
||||
self.seat.client.remove_obj(self)?;
|
||||
|
|
@ -193,7 +193,7 @@ impl WlPointer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlPointer, WlPointerError;
|
||||
WlPointer;
|
||||
|
||||
SET_CURSOR => set_cursor,
|
||||
RELEASE => release,
|
||||
|
|
@ -211,32 +211,11 @@ simple_add_obj!(WlPointer);
|
|||
pub enum WlPointerError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `set_cursor` request")]
|
||||
SetCursorError(#[from] SetCursorError),
|
||||
#[error("Could not process a `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
}
|
||||
efrom!(WlPointerError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetCursorError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSurfaceError(Box<WlSurfaceError>),
|
||||
}
|
||||
efrom!(SetCursorError, ParseError, MsgParserError);
|
||||
efrom!(SetCursorError, ClientError);
|
||||
efrom!(SetCursorError, WlSurfaceError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError, ClientError);
|
||||
efrom!(WlPointerError, ClientError);
|
||||
efrom!(WlPointerError, MsgParserError);
|
||||
efrom!(WlPointerError, WlSurfaceError);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl WlTouch {
|
|||
}
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlTouchError> {
|
||||
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||
self.seat.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -49,7 +49,7 @@ impl WlTouch {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlTouch, WlTouchError;
|
||||
WlTouch;
|
||||
|
||||
RELEASE => release,
|
||||
}
|
||||
|
|
@ -66,17 +66,8 @@ simple_add_obj!(WlTouch);
|
|||
pub enum WlTouchError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(WlTouchError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError);
|
||||
efrom!(WlTouchError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -54,10 +54,10 @@ impl WlShmGlobal {
|
|||
}
|
||||
|
||||
impl WlShm {
|
||||
fn create_pool(&self, parser: MsgParser<'_, '_>) -> Result<(), CreatePoolError> {
|
||||
fn create_pool(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmError> {
|
||||
let create: CreatePool = self.client.parse(self, parser)?;
|
||||
if create.size < 0 {
|
||||
return Err(CreatePoolError::NegativeSize);
|
||||
return Err(WlShmError::NegativeSize);
|
||||
}
|
||||
let pool = Rc::new(WlShmPool::new(
|
||||
create.id,
|
||||
|
|
@ -86,7 +86,7 @@ impl Global for WlShmGlobal {
|
|||
simple_add_global!(WlShmGlobal);
|
||||
|
||||
object_base! {
|
||||
WlShm, WlShmError;
|
||||
WlShm;
|
||||
|
||||
CREATE_POOL => create_pool,
|
||||
}
|
||||
|
|
@ -103,22 +103,13 @@ simple_add_obj!(WlShm);
|
|||
pub enum WlShmError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `create_pool` request")]
|
||||
CreatePoolError(#[from] CreatePoolError),
|
||||
}
|
||||
efrom!(WlShmError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreatePoolError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("The passed size is negative")]
|
||||
NegativeSize,
|
||||
#[error(transparent)]
|
||||
WlShmPoolError(Box<WlShmPoolError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreatePoolError, ParseError, MsgParserError);
|
||||
efrom!(CreatePoolError, WlShmPoolError);
|
||||
efrom!(CreatePoolError, ClientError);
|
||||
efrom!(WlShmError, ClientError);
|
||||
efrom!(WlShmError, MsgParserError);
|
||||
efrom!(WlShmError, WlShmPoolError);
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@ impl WlShmPool {
|
|||
})
|
||||
}
|
||||
|
||||
fn create_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateBufferError> {
|
||||
fn create_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmPoolError> {
|
||||
let req: CreateBuffer = self.client.parse(self, parser)?;
|
||||
let drm_format = map_wayland_format_id(req.format);
|
||||
let format = match formats().get(&drm_format) {
|
||||
Some(f) => *f,
|
||||
_ => return Err(CreateBufferError::InvalidFormat(req.format)),
|
||||
_ => return Err(WlShmPoolError::InvalidFormat(req.format)),
|
||||
};
|
||||
if req.height < 0 || req.width < 0 || req.stride < 0 || req.offset < 0 {
|
||||
return Err(CreateBufferError::NegativeParameters);
|
||||
return Err(WlShmPoolError::NegativeParameters);
|
||||
}
|
||||
let buffer = Rc::new(WlBuffer::new_shm(
|
||||
req.id,
|
||||
|
|
@ -66,19 +66,19 @@ impl WlShmPool {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmPoolError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), ResizeError> {
|
||||
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmPoolError> {
|
||||
let req: Resize = self.client.parse(self, parser)?;
|
||||
if req.size < 0 {
|
||||
return Err(ResizeError::NegativeSize);
|
||||
return Err(WlShmPoolError::NegativeSize);
|
||||
}
|
||||
if (req.size as usize) < self.mem.get().len() {
|
||||
return Err(ResizeError::CannotShrink);
|
||||
return Err(WlShmPoolError::CannotShrink);
|
||||
}
|
||||
self.mem
|
||||
.set(Rc::new(ClientMem::new(self.fd.raw(), req.size as usize)?));
|
||||
|
|
@ -87,7 +87,7 @@ impl WlShmPool {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlShmPool, WlShmPoolError;
|
||||
WlShmPool;
|
||||
|
||||
CREATE_BUFFER => create_buffer,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -106,24 +106,14 @@ simple_add_obj!(WlShmPool);
|
|||
pub enum WlShmPoolError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `create_buffer` request")]
|
||||
CreateBufferError(#[from] CreateBufferError),
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `resize` request")]
|
||||
ResizeError(#[from] ResizeError),
|
||||
#[error(transparent)]
|
||||
ClientMemError(Box<ClientMemError>),
|
||||
}
|
||||
efrom!(WlShmPoolError, ClientError);
|
||||
efrom!(WlShmPoolError, ClientMemError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateBufferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("Tried to shrink the pool")]
|
||||
CannotShrink,
|
||||
#[error("Requested size is negative")]
|
||||
NegativeSize,
|
||||
#[error("Format {0} is not supported")]
|
||||
InvalidFormat(u32),
|
||||
#[error("All parameters in a create_buffer request must be non-negative")]
|
||||
|
|
@ -131,30 +121,7 @@ pub enum CreateBufferError {
|
|||
#[error(transparent)]
|
||||
WlBufferError(Box<WlBufferError>),
|
||||
}
|
||||
efrom!(CreateBufferError, ParseError, MsgParserError);
|
||||
efrom!(CreateBufferError, ClientError);
|
||||
efrom!(CreateBufferError, WlBufferError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ResizeError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Tried to shrink the pool")]
|
||||
CannotShrink,
|
||||
#[error("Requested size is negative")]
|
||||
NegativeSize,
|
||||
#[error(transparent)]
|
||||
ClientMemError(Box<ClientMemError>),
|
||||
}
|
||||
efrom!(ResizeError, ParseError, MsgParserError);
|
||||
efrom!(ResizeError, ClientMemError);
|
||||
efrom!(WlShmPoolError, ClientError);
|
||||
efrom!(WlShmPoolError, ClientMemError);
|
||||
efrom!(WlShmPoolError, WlBufferError);
|
||||
efrom!(WlShmPoolError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -48,13 +48,13 @@ impl WlSubcompositorGlobal {
|
|||
}
|
||||
|
||||
impl WlSubcompositor {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubcompositorError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_subsurface(&self, parser: MsgParser<'_, '_>) -> Result<(), GetSubsurfaceError> {
|
||||
fn get_subsurface(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubcompositorError> {
|
||||
let req: GetSubsurface = self.client.parse(self, parser)?;
|
||||
let surface = self.client.lookup(req.surface)?;
|
||||
let parent = self.client.lookup(req.parent)?;
|
||||
|
|
@ -81,7 +81,7 @@ impl Global for WlSubcompositorGlobal {
|
|||
simple_add_global!(WlSubcompositorGlobal);
|
||||
|
||||
object_base! {
|
||||
WlSubcompositor, WlSubcompositorError;
|
||||
WlSubcompositor;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_SUBSURFACE => get_subsurface,
|
||||
|
|
@ -99,32 +99,11 @@ simple_add_obj!(WlSubcompositor);
|
|||
pub enum WlSubcompositorError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `get_subsurface` request")]
|
||||
GetSubsurfaceError(#[from] GetSubsurfaceError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSubsurfaceError(Box<WlSubsurfaceError>),
|
||||
}
|
||||
efrom!(WlSubcompositorError, ClientError);
|
||||
|
||||
#[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 GetSubsurfaceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
SubsurfaceError(Box<WlSubsurfaceError>),
|
||||
}
|
||||
efrom!(GetSubsurfaceError, ParseFailed, MsgParserError);
|
||||
efrom!(GetSubsurfaceError, ClientError);
|
||||
efrom!(GetSubsurfaceError, SubsurfaceError, WlSubsurfaceError);
|
||||
efrom!(WlSubcompositorError, MsgParserError);
|
||||
efrom!(WlSubcompositorError, WlSubsurfaceError);
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ impl WlSurface {
|
|||
}
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let _req: Destroy = self.parse(parser)?;
|
||||
self.unset_dnd_icons();
|
||||
self.unset_cursors();
|
||||
|
|
@ -402,7 +402,7 @@ impl WlSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn attach(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), AttachError> {
|
||||
fn attach(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let req: Attach = self.parse(parser)?;
|
||||
let buf = if req.buffer.is_some() {
|
||||
Some((req.x, req.y, self.client.lookup(req.buffer)?))
|
||||
|
|
@ -413,13 +413,13 @@ impl WlSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn damage(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageError> {
|
||||
fn damage(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let _req: Damage = self.parse(parser)?;
|
||||
self.pending.damage.set(true);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn frame(&self, parser: MsgParser<'_, '_>) -> Result<(), FrameError> {
|
||||
fn frame(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let req: Frame = self.parse(parser)?;
|
||||
let cb = Rc::new(WlCallback::new(req.callback, &self.client));
|
||||
track!(self.client, cb);
|
||||
|
|
@ -428,7 +428,7 @@ impl WlSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_opaque_region(&self, parser: MsgParser<'_, '_>) -> Result<(), SetOpaqueRegionError> {
|
||||
fn set_opaque_region(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let region: SetOpaqueRegion = self.parse(parser)?;
|
||||
let region = if region.region.is_some() {
|
||||
Some(self.client.lookup(region.region)?.region())
|
||||
|
|
@ -439,7 +439,7 @@ impl WlSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_input_region(&self, parser: MsgParser<'_, '_>) -> Result<(), SetInputRegionError> {
|
||||
fn set_input_region(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let req: SetInputRegion = self.parse(parser)?;
|
||||
let region = if req.region.is_some() {
|
||||
Some(self.client.lookup(req.region)?.region())
|
||||
|
|
@ -533,7 +533,7 @@ impl WlSurface {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn commit(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CommitError> {
|
||||
fn commit(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let _req: Commit = self.parse(parser)?;
|
||||
self.do_commit(CommitContext::RootCommit)?;
|
||||
Ok(())
|
||||
|
|
@ -542,17 +542,17 @@ impl WlSurface {
|
|||
fn set_buffer_transform(
|
||||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), SetBufferTransformError> {
|
||||
) -> Result<(), WlSurfaceError> {
|
||||
let _req: SetBufferTransform = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_buffer_scale(&self, parser: MsgParser<'_, '_>) -> Result<(), SetBufferScaleError> {
|
||||
fn set_buffer_scale(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let _req: SetBufferScale = self.parse(parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn damage_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageBufferError> {
|
||||
fn damage_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||
let _req: DamageBuffer = self.parse(parser)?;
|
||||
self.pending.damage.set(true);
|
||||
Ok(())
|
||||
|
|
@ -670,7 +670,7 @@ impl WlSurface {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlSurface, WlSurfaceError;
|
||||
WlSurface;
|
||||
|
||||
DESTROY => destroy,
|
||||
ATTACH => attach,
|
||||
|
|
@ -832,26 +832,6 @@ pub enum WlSurfaceError {
|
|||
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
||||
#[error(transparent)]
|
||||
XdgSurfaceError(Box<XdgSurfaceError>),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[source] Box<DestroyError>),
|
||||
#[error("Could not process `attach` request")]
|
||||
AttachError(#[source] Box<AttachError>),
|
||||
#[error("Could not process `damage` request")]
|
||||
DamageError(#[source] Box<DamageError>),
|
||||
#[error("Could not process `frame` request")]
|
||||
FrameError(#[source] Box<FrameError>),
|
||||
#[error("Could not process `set_opaque_region` request")]
|
||||
SetOpaqueRegionError(#[source] Box<SetOpaqueRegionError>),
|
||||
#[error("Could not process `set_input_region` request")]
|
||||
SetInputRegionError(#[source] Box<SetInputRegionError>),
|
||||
#[error("Could not process `commit` request")]
|
||||
CommitError(#[source] Box<CommitError>),
|
||||
#[error("Could not process `set_buffer_transform` request")]
|
||||
SetBufferTransformError(#[source] Box<SetBufferTransformError>),
|
||||
#[error("Could not process `set_buffer_scale_error` request")]
|
||||
SetBufferScaleError(#[source] Box<SetBufferScaleError>),
|
||||
#[error("Could not process `damage_buffer` request")]
|
||||
DamageBufferError(#[source] Box<DamageBufferError>),
|
||||
#[error("Surface {} cannot be assigned the role {} because it already has the role {}", .id, .new.name(), .old.name())]
|
||||
IncompatibleRole {
|
||||
id: WlSurfaceId,
|
||||
|
|
@ -860,111 +840,10 @@ pub enum WlSurfaceError {
|
|||
},
|
||||
#[error("Cannot destroy a `wl_surface` before its role object")]
|
||||
ReloObjectStillExists,
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(WlSurfaceError, ClientError);
|
||||
efrom!(WlSurfaceError, XdgSurfaceError);
|
||||
efrom!(WlSurfaceError, DestroyError);
|
||||
efrom!(WlSurfaceError, AttachError);
|
||||
efrom!(WlSurfaceError, DamageError);
|
||||
efrom!(WlSurfaceError, FrameError);
|
||||
efrom!(WlSurfaceError, SetOpaqueRegionError);
|
||||
efrom!(WlSurfaceError, SetInputRegionError);
|
||||
efrom!(WlSurfaceError, CommitError);
|
||||
efrom!(WlSurfaceError, SetBufferTransformError);
|
||||
efrom!(WlSurfaceError, SetBufferScaleError);
|
||||
efrom!(WlSurfaceError, DamageBufferError);
|
||||
efrom!(WlSurfaceError, ZwlrLayerSurfaceV1Error);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
WlSurfaceError(Box<WlSurfaceError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, WlSurfaceError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AttachError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(AttachError, ParseFailed, MsgParserError);
|
||||
efrom!(AttachError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DamageError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(DamageError, ParseFailed, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum FrameError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(FrameError, ParseFailed, MsgParserError);
|
||||
efrom!(FrameError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetOpaqueRegionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(SetOpaqueRegionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetOpaqueRegionError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetInputRegionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(SetInputRegionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetInputRegionError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CommitError {
|
||||
#[error(transparent)]
|
||||
WlSurfaceError(Box<WlSurfaceError>),
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CommitError, WlSurfaceError);
|
||||
efrom!(CommitError, ParseFailed, MsgParserError);
|
||||
efrom!(CommitError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetBufferTransformError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetBufferTransformError, ParseFailed, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetBufferScaleError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetBufferScaleError, ParseFailed, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DamageBufferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(DamageBufferError, ParseFailed, MsgParserError);
|
||||
efrom!(WlSurfaceError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ impl ZwpIdleInhibitorV1 {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
ZwpIdleInhibitorV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ impl WpPresentation {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
WpPresentation;
|
||||
|
||||
DESTROY => destroy,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl WpPresentationFeedback {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
WpPresentationFeedback;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -157,13 +157,13 @@ impl XdgPositioner {
|
|||
*self.position.borrow()
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSizeError> {
|
||||
fn set_size(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetSize = self.client.parse(self, parser)?;
|
||||
if req.width <= 0 || req.height <= 0 {
|
||||
self.client.protocol_error(
|
||||
|
|
@ -171,7 +171,7 @@ impl XdgPositioner {
|
|||
INVALID_INPUT,
|
||||
&format!("Cannot set a non-positive size"),
|
||||
);
|
||||
return Err(SetSizeError::NonPositiveSize);
|
||||
return Err(XdgPositionerError::NonPositiveSize);
|
||||
}
|
||||
let mut position = self.position.borrow_mut();
|
||||
position.size_width = req.width;
|
||||
|
|
@ -179,7 +179,7 @@ impl XdgPositioner {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_anchor_rect(&self, parser: MsgParser<'_, '_>) -> Result<(), SetAnchorRectError> {
|
||||
fn set_anchor_rect(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetAnchorRect = self.client.parse(self, parser)?;
|
||||
if req.width < 0 || req.height < 0 {
|
||||
self.client.protocol_error(
|
||||
|
|
@ -187,28 +187,28 @@ impl XdgPositioner {
|
|||
INVALID_INPUT,
|
||||
&format!("Cannot set an anchor rect with negative size"),
|
||||
);
|
||||
return Err(SetAnchorRectError::NegativeAnchorRect);
|
||||
return Err(XdgPositionerError::NegativeAnchorRect);
|
||||
}
|
||||
let mut position = self.position.borrow_mut();
|
||||
position.ar = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_anchor(&self, parser: MsgParser<'_, '_>) -> Result<(), SetAnchorError> {
|
||||
fn set_anchor(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetAnchor = self.client.parse(self, parser)?;
|
||||
let anchor = match Edge::from_enum(req.anchor) {
|
||||
Some(a) => a,
|
||||
_ => return Err(SetAnchorError::UnknownAnchor(req.anchor)),
|
||||
_ => return Err(XdgPositionerError::UnknownAnchor(req.anchor)),
|
||||
};
|
||||
self.position.borrow_mut().anchor = anchor;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_gravity(&self, parser: MsgParser<'_, '_>) -> Result<(), SetGravityError> {
|
||||
fn set_gravity(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetGravity = self.client.parse(self, parser)?;
|
||||
let gravity = match Edge::from_enum(req.gravity) {
|
||||
Some(a) => a,
|
||||
_ => return Err(SetGravityError::UnknownGravity(req.gravity)),
|
||||
_ => return Err(XdgPositionerError::UnknownGravity(req.gravity)),
|
||||
};
|
||||
self.position.borrow_mut().gravity = gravity;
|
||||
Ok(())
|
||||
|
|
@ -217,12 +217,12 @@ impl XdgPositioner {
|
|||
fn set_constraint_adjustment(
|
||||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), SetConstraintAdjustmentError> {
|
||||
) -> Result<(), XdgPositionerError> {
|
||||
let req: SetConstraintAdjustment = self.client.parse(self, parser)?;
|
||||
let ca = match CA::from_bits(req.constraint_adjustment) {
|
||||
Some(c) => c,
|
||||
_ => {
|
||||
return Err(SetConstraintAdjustmentError::UnknownCa(
|
||||
return Err(XdgPositionerError::UnknownCa(
|
||||
req.constraint_adjustment,
|
||||
))
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ impl XdgPositioner {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_offset(&self, parser: MsgParser<'_, '_>) -> Result<(), SetOffsetError> {
|
||||
fn set_offset(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetOffset = self.client.parse(self, parser)?;
|
||||
let mut position = self.position.borrow_mut();
|
||||
position.off_x = req.x;
|
||||
|
|
@ -239,13 +239,13 @@ impl XdgPositioner {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_reactive(&self, parser: MsgParser<'_, '_>) -> Result<(), SetReactiveError> {
|
||||
fn set_reactive(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let _req: SetReactive = self.client.parse(self, parser)?;
|
||||
self.position.borrow_mut().reactive = true;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_parent_size(&self, parser: MsgParser<'_, '_>) -> Result<(), SetParentSizeError> {
|
||||
fn set_parent_size(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgPositionerError> {
|
||||
let req: SetParentSize = self.client.parse(self, parser)?;
|
||||
if req.parent_width < 0 || req.parent_height < 0 {
|
||||
self.client.protocol_error(
|
||||
|
|
@ -253,7 +253,7 @@ impl XdgPositioner {
|
|||
INVALID_INPUT,
|
||||
&format!("Cannot set a negative parent size"),
|
||||
);
|
||||
return Err(SetParentSizeError::NegativeParentSize);
|
||||
return Err(XdgPositionerError::NegativeParentSize);
|
||||
}
|
||||
let mut position = self.position.borrow_mut();
|
||||
position.parent_width = req.parent_width;
|
||||
|
|
@ -264,7 +264,7 @@ impl XdgPositioner {
|
|||
fn set_parent_configure(
|
||||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), SetParentConfigureError> {
|
||||
) -> Result<(), XdgPositionerError> {
|
||||
let req: SetParentConfigure = self.client.parse(self, parser)?;
|
||||
self.position.borrow_mut().parent_serial = req.serial;
|
||||
Ok(())
|
||||
|
|
@ -272,7 +272,7 @@ impl XdgPositioner {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
XdgPositioner, XdgPositionerError;
|
||||
XdgPositioner;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_SIZE => set_size,
|
||||
|
|
@ -300,109 +300,22 @@ dedicated_add_obj!(XdgPositioner, XdgPositionerId, xdg_positioners);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum XdgPositionerError {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `set_size` request")]
|
||||
SetSizeError(#[from] SetSizeError),
|
||||
#[error("Could not process a `set_anchor_rect` request")]
|
||||
SetAnchorRectError(#[from] SetAnchorRectError),
|
||||
#[error("Could not process a `set_anchor` request")]
|
||||
SetAnchorError(#[from] SetAnchorError),
|
||||
#[error("Could not process a `set_gravity` request")]
|
||||
SetGravityError(#[from] SetGravityError),
|
||||
#[error("Could not process a `set_constraint_adjustment` request")]
|
||||
SetConstraintAdjustmentError(#[from] SetConstraintAdjustmentError),
|
||||
#[error("Could not process a `set_offset` request")]
|
||||
SetOffsetError(#[from] SetOffsetError),
|
||||
#[error("Could not process a `set_reactive` request")]
|
||||
SetReactiveError(#[from] SetReactiveError),
|
||||
#[error("Could not process a `set_parent_size` request")]
|
||||
SetParentSizeError(#[from] SetParentSizeError),
|
||||
#[error("Could not process a `set_parent_configure` request")]
|
||||
SetParentConfigureError(#[from] SetParentConfigureError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Cannot set a non-positive size")]
|
||||
NonPositiveSize,
|
||||
#[error("Cannot set an anchor rect with a negative size")]
|
||||
NegativeAnchorRect,
|
||||
#[error("Unknown anchor {0}")]
|
||||
UnknownAnchor(u32),
|
||||
#[error("Unknown gravity {0}")]
|
||||
UnknownGravity(u32),
|
||||
#[error("Unknown constraint adjustment {0}")]
|
||||
UnknownCa(u32),
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("Cannot set a negative parent size")]
|
||||
NegativeParentSize,
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetSizeError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Cannot set a non-positive size")]
|
||||
NonPositiveSize,
|
||||
}
|
||||
efrom!(SetSizeError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetAnchorRectError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Cannot set an anchor rect with a negative size")]
|
||||
NegativeAnchorRect,
|
||||
}
|
||||
efrom!(SetAnchorRectError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetAnchorError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Unknown anchor {0}")]
|
||||
UnknownAnchor(u32),
|
||||
}
|
||||
efrom!(SetAnchorError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetGravityError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Unknown gravity {0}")]
|
||||
UnknownGravity(u32),
|
||||
}
|
||||
efrom!(SetGravityError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetConstraintAdjustmentError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Unknown constraint adjustment {0}")]
|
||||
UnknownCa(u32),
|
||||
}
|
||||
efrom!(SetConstraintAdjustmentError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetOffsetError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetOffsetError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetReactiveError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetReactiveError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetParentSizeError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error("Cannot set a negative parent size")]
|
||||
NegativeParentSize,
|
||||
}
|
||||
efrom!(SetParentSizeError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetParentConfigureError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetParentConfigureError, ParseError, MsgParserError);
|
||||
efrom!(XdgPositionerError, MsgParserError);
|
||||
efrom!(XdgPositionerError, ClientError);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ impl XdgWmBaseGlobal {
|
|||
}
|
||||
|
||||
impl XdgWmBase {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgWmBaseError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
if !self.surfaces.is_empty() {
|
||||
self.client.protocol_error(
|
||||
|
|
@ -78,7 +78,7 @@ impl XdgWmBase {
|
|||
self.id
|
||||
),
|
||||
);
|
||||
return Err(DestroyError::DefunctSurfaces);
|
||||
return Err(XdgWmBaseError::DefunctSurfaces);
|
||||
}
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -87,7 +87,7 @@ impl XdgWmBase {
|
|||
fn create_positioner(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), CreatePositionerError> {
|
||||
) -> Result<(), XdgWmBaseError> {
|
||||
let req: CreatePositioner = self.client.parse(&**self, parser)?;
|
||||
let pos = Rc::new(XdgPositioner::new(self, req.id, &self.client));
|
||||
track!(self.client, pos);
|
||||
|
|
@ -98,7 +98,7 @@ impl XdgWmBase {
|
|||
fn get_xdg_surface(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), GetXdgSurfaceError> {
|
||||
) -> Result<(), XdgWmBaseError> {
|
||||
let req: GetXdgSurface = self.client.parse(&**self, parser)?;
|
||||
let surface = self.client.lookup(req.surface)?;
|
||||
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface));
|
||||
|
|
@ -109,7 +109,7 @@ impl XdgWmBase {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn pong(&self, parser: MsgParser<'_, '_>) -> Result<(), PongError> {
|
||||
fn pong(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgWmBaseError> {
|
||||
let _req: Pong = self.client.parse(self, parser)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ impl Global for XdgWmBaseGlobal {
|
|||
simple_add_global!(XdgWmBaseGlobal);
|
||||
|
||||
object_base! {
|
||||
XdgWmBase, XdgWmBaseError;
|
||||
XdgWmBase;
|
||||
|
||||
DESTROY => destroy,
|
||||
CREATE_POSITIONER => create_positioner,
|
||||
|
|
@ -154,55 +154,13 @@ impl Object for XdgWmBase {
|
|||
pub enum XdgWmBaseError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `create_positioner` request")]
|
||||
CreatePositionerError(#[from] CreatePositionerError),
|
||||
#[error("Could not process a `get_xdg_surface` request")]
|
||||
GetXdgSurfaceError(#[from] GetXdgSurfaceError),
|
||||
#[error("Could not process a `pong` request")]
|
||||
PongError(#[from] PongError),
|
||||
}
|
||||
efrom!(XdgWmBaseError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("Tried to destroy xdg_wm_base object before destroying its surfaces")]
|
||||
DefunctSurfaces,
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreatePositionerError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreatePositionerError, ParseError, MsgParserError);
|
||||
efrom!(CreatePositionerError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetXdgSurfaceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
XdgSurfaceError(Box<XdgSurfaceError>),
|
||||
}
|
||||
efrom!(GetXdgSurfaceError, ParseError, MsgParserError);
|
||||
efrom!(GetXdgSurfaceError, ClientError);
|
||||
efrom!(GetXdgSurfaceError, XdgSurfaceError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum PongError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(PongError, ParseError, MsgParserError);
|
||||
efrom!(XdgWmBaseError, ClientError);
|
||||
efrom!(XdgWmBaseError, MsgParserError);
|
||||
efrom!(XdgWmBaseError, XdgSurfaceError);
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ impl ZwlrLayerShellV1Global {
|
|||
}
|
||||
|
||||
impl ZwlrLayerShellV1 {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -63,7 +63,7 @@ impl ZwlrLayerShellV1 {
|
|||
fn get_layer_surface(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), GetLayerSurfaceError> {
|
||||
) -> Result<(), ZwlrLayerShellV1Error> {
|
||||
let req: GetLayerSurface = self.client.parse(&**self, parser)?;
|
||||
let surface = self.client.lookup(req.surface)?;
|
||||
let output = 'get_output: {
|
||||
|
|
@ -80,11 +80,11 @@ impl ZwlrLayerShellV1 {
|
|||
if let Some(output) = outputs.values().next() {
|
||||
break 'get_output output.node.clone();
|
||||
}
|
||||
return Err(GetLayerSurfaceError::NoOutputs);
|
||||
return Err(ZwlrLayerShellV1Error::NoOutputs);
|
||||
}
|
||||
};
|
||||
if req.layer > OVERLAY {
|
||||
return Err(GetLayerSurfaceError::UnknownLayer(req.layer));
|
||||
return Err(ZwlrLayerShellV1Error::UnknownLayer(req.layer));
|
||||
}
|
||||
let surface = Rc::new(ZwlrLayerSurfaceV1::new(
|
||||
req.id,
|
||||
|
|
@ -120,7 +120,7 @@ impl Global for ZwlrLayerShellV1Global {
|
|||
simple_add_global!(ZwlrLayerShellV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwlrLayerShellV1, ZwlrLayerShellV1Error;
|
||||
ZwlrLayerShellV1;
|
||||
|
||||
GET_LAYER_SURFACE => get_layer_surface,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -141,29 +141,8 @@ impl Object for ZwlrLayerShellV1 {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwlrLayerShellV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `get_layer_surface` request")]
|
||||
GetLayerSurfaceError(#[from] GetLayerSurfaceError),
|
||||
}
|
||||
efrom!(ZwlrLayerShellV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetLayerSurfaceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Unknown layer {0}")]
|
||||
|
|
@ -173,6 +152,6 @@ pub enum GetLayerSurfaceError {
|
|||
#[error(transparent)]
|
||||
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
||||
}
|
||||
efrom!(GetLayerSurfaceError, ParseError, MsgParserError);
|
||||
efrom!(GetLayerSurfaceError, ClientError);
|
||||
efrom!(GetLayerSurfaceError, ZwlrLayerSurfaceV1Error);
|
||||
efrom!(ZwlrLayerShellV1Error, ClientError);
|
||||
efrom!(ZwlrLayerShellV1Error, MsgParserError);
|
||||
efrom!(ZwlrLayerShellV1Error, ZwlrLayerSurfaceV1Error);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ impl ZwpIdleInhibitManagerV1 {
|
|||
}
|
||||
}
|
||||
|
||||
object_base2! {
|
||||
object_base! {
|
||||
ZwpIdleInhibitManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
|
|
|
|||
|
|
@ -61,25 +61,25 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
self.parent.client.event(Failed { self_id: self.id })
|
||||
}
|
||||
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpLinuxBufferParamsV1Error> {
|
||||
let _req: Destroy = self.parent.client.parse(&**self, parser)?;
|
||||
self.parent.client.remove_obj(&**self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn add(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), AddError> {
|
||||
fn add(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpLinuxBufferParamsV1Error> {
|
||||
let req: Add = self.parent.client.parse(&**self, parser)?;
|
||||
let modifier = ((req.modifier_hi as u64) << 32) | req.modifier_lo as u64;
|
||||
match self.modifier.get() {
|
||||
Some(m) if m != modifier => return Err(AddError::MixedModifiers(modifier, m)),
|
||||
Some(m) if m != modifier => return Err(ZwpLinuxBufferParamsV1Error::MixedModifiers(modifier, m)),
|
||||
_ => self.modifier.set(Some(modifier)),
|
||||
}
|
||||
let plane = req.plane_idx;
|
||||
if plane > MAX_PLANE {
|
||||
return Err(AddError::MaxPlane);
|
||||
return Err(ZwpLinuxBufferParamsV1Error::MaxPlane);
|
||||
}
|
||||
if self.planes.borrow_mut().insert(plane, req).is_some() {
|
||||
return Err(AddError::AlreadySet(plane));
|
||||
return Err(ZwpLinuxBufferParamsV1Error::AlreadySet(plane));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -91,22 +91,22 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
height: i32,
|
||||
format: u32,
|
||||
_flags: u32,
|
||||
) -> Result<WlBufferId, DoCreateError> {
|
||||
) -> Result<WlBufferId, ZwpLinuxBufferParamsV1Error> {
|
||||
let ctx = match self.parent.client.state.render_ctx.get() {
|
||||
Some(ctx) => ctx,
|
||||
None => return Err(DoCreateError::NoRenderContext),
|
||||
None => return Err(ZwpLinuxBufferParamsV1Error::NoRenderContext),
|
||||
};
|
||||
let formats = ctx.formats();
|
||||
let format = match formats.get(&format) {
|
||||
Some(f) => f,
|
||||
None => return Err(DoCreateError::InvalidFormat(format)),
|
||||
None => return Err(ZwpLinuxBufferParamsV1Error::InvalidFormat(format)),
|
||||
};
|
||||
let modifier = match self.modifier.get() {
|
||||
Some(m) => m,
|
||||
_ => return Err(DoCreateError::NoPlanes),
|
||||
_ => return Err(ZwpLinuxBufferParamsV1Error::NoPlanes),
|
||||
};
|
||||
if !format.modifiers.contains_key(&modifier) {
|
||||
return Err(DoCreateError::InvalidModifier(modifier));
|
||||
return Err(ZwpLinuxBufferParamsV1Error::InvalidModifier(modifier));
|
||||
}
|
||||
let mut dmabuf = DmaBuf {
|
||||
width,
|
||||
|
|
@ -119,7 +119,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
planes.sort_by_key(|a| a.plane_idx);
|
||||
for (i, p) in planes.into_iter().enumerate() {
|
||||
if p.plane_idx as usize != i {
|
||||
return Err(DoCreateError::MissingPlane(i));
|
||||
return Err(ZwpLinuxBufferParamsV1Error::MissingPlane(i));
|
||||
}
|
||||
dmabuf.planes.push(DmaBufPlane {
|
||||
offset: p.offset,
|
||||
|
|
@ -147,27 +147,27 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
Ok(buffer_id)
|
||||
}
|
||||
|
||||
fn create(self: &Rc<Self>, parser: MsgParser) -> Result<(), CreateError> {
|
||||
fn create(self: &Rc<Self>, parser: MsgParser) -> Result<(), ZwpLinuxBufferParamsV1Error> {
|
||||
let req: Create = self.parent.client.parse(&**self, parser)?;
|
||||
if self.used.replace(true) {
|
||||
return Err(CreateError::AlreadyUsed);
|
||||
return Err(ZwpLinuxBufferParamsV1Error::AlreadyUsed);
|
||||
}
|
||||
match self.do_create(None, req.width, req.height, req.format, req.flags) {
|
||||
Ok(id) => {
|
||||
self.send_created(id);
|
||||
}
|
||||
Err(e) => {
|
||||
log::debug!("Could not create a dmabuf buffer: {}", ErrorFmt(e));
|
||||
log::warn!("Could not create a dmabuf buffer: {}", ErrorFmt(e));
|
||||
self.send_failed();
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_immed(self: &Rc<Self>, parser: MsgParser) -> Result<(), CreateImmedError> {
|
||||
fn create_immed(self: &Rc<Self>, parser: MsgParser) -> Result<(), ZwpLinuxBufferParamsV1Error> {
|
||||
let req: CreateImmed = self.parent.client.parse(&**self, parser)?;
|
||||
if self.used.replace(true) {
|
||||
return Err(CreateImmedError::AlreadyUsed);
|
||||
return Err(ZwpLinuxBufferParamsV1Error::AlreadyUsed);
|
||||
}
|
||||
self.do_create(
|
||||
Some(req.buffer_id),
|
||||
|
|
@ -181,7 +181,7 @@ impl ZwpLinuxBufferParamsV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpLinuxBufferParamsV1, ZwpLinuxBufferParamsV1Error;
|
||||
ZwpLinuxBufferParamsV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
ADD => add,
|
||||
|
|
@ -199,49 +199,18 @@ simple_add_obj!(ZwpLinuxBufferParamsV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpLinuxBufferParamsV1Error {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `add` request")]
|
||||
AddError(#[from] AddError),
|
||||
#[error("Could not process a `create` request")]
|
||||
Create(#[from] CreateError),
|
||||
#[error("Could not process a `create_immed` request")]
|
||||
CreateImmed(#[from] CreateImmedError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ZwpLinuxBufferParamsV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("The params object has already been used")]
|
||||
AlreadyUsed,
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AddError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("A buffer can contain at most 4 planes")]
|
||||
MaxPlane,
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Tried to add a plane with modifier {0} that differs from a previous modifier {1}")]
|
||||
MixedModifiers(u64, u64),
|
||||
#[error("The plane {0} was already set")]
|
||||
AlreadySet(u32),
|
||||
}
|
||||
efrom!(AddError, ClientError);
|
||||
efrom!(AddError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DoCreateError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("The compositor has no render context attached")]
|
||||
NoRenderContext,
|
||||
#[error("The format {0} is not supported")]
|
||||
|
|
@ -255,30 +224,5 @@ pub enum DoCreateError {
|
|||
#[error("Could not import the buffer")]
|
||||
ImportError(#[from] RenderError),
|
||||
}
|
||||
efrom!(DoCreateError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateError {
|
||||
#[error("The params object has already been used")]
|
||||
AlreadyUsed,
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateError, ClientError, ClientError);
|
||||
efrom!(CreateError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateImmedError {
|
||||
#[error("The params object has already been used")]
|
||||
AlreadyUsed,
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
DoCreateError(#[from] DoCreateError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateImmedError, ClientError, ClientError);
|
||||
efrom!(CreateImmedError, ParseError, MsgParserError);
|
||||
efrom!(ZwpLinuxBufferParamsV1Error, ClientError);
|
||||
efrom!(ZwpLinuxBufferParamsV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -94,13 +94,13 @@ impl ZwpLinuxDmabufV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpLinuxDmabufV1Error> {
|
||||
let _req: Destroy = self.client.parse(&**self, parser)?;
|
||||
self.client.remove_obj(&**self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn create_params(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), CreateParamsError> {
|
||||
fn create_params(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpLinuxDmabufV1Error> {
|
||||
let req: CreateParams = self.client.parse(&**self, parser)?;
|
||||
let params = Rc::new(ZwpLinuxBufferParamsV1::new(req.params_id, self));
|
||||
track!(self.client, params);
|
||||
|
|
@ -110,7 +110,7 @@ impl ZwpLinuxDmabufV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpLinuxDmabufV1, ZwpLinuxDmabufV1Error;
|
||||
ZwpLinuxDmabufV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
CREATE_PARAMS => create_params,
|
||||
|
|
@ -126,31 +126,10 @@ simple_add_obj!(ZwpLinuxDmabufV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpLinuxDmabufV1Error {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `create_params` request")]
|
||||
CreateParamsError(#[from] CreateParamsError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ZwpLinuxDmabufV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateParamsError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateParamsError, ClientError);
|
||||
efrom!(CreateParamsError, ParseError, MsgParserError);
|
||||
efrom!(ZwpLinuxDmabufV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ pub struct ZxdgDecorationManagerV1 {
|
|||
}
|
||||
|
||||
impl ZxdgDecorationManagerV1 {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZxdgDecorationManagerV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -74,7 +74,7 @@ impl ZxdgDecorationManagerV1 {
|
|||
fn get_toplevel_decoration(
|
||||
&self,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), GetToplevelDecorationError> {
|
||||
) -> Result<(), ZxdgDecorationManagerV1Error> {
|
||||
let req: GetToplevelDecoration = self.client.parse(self, parser)?;
|
||||
let tl = self.client.lookup(req.toplevel)?;
|
||||
let obj = Rc::new(ZxdgToplevelDecorationV1::new(req.id, &self.client, &tl));
|
||||
|
|
@ -86,7 +86,7 @@ impl ZxdgDecorationManagerV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgDecorationManagerV1, ZxdgDecorationManagerV1Error;
|
||||
ZxdgDecorationManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_TOPLEVEL_DECORATION => get_toplevel_decoration,
|
||||
|
|
@ -102,31 +102,10 @@ simple_add_obj!(ZxdgDecorationManagerV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZxdgDecorationManagerV1Error {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `get_toplevel_decoration` request")]
|
||||
GetToplevelDecorationError(#[from] GetToplevelDecorationError),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ZxdgDecorationManagerV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetToplevelDecorationError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetToplevelDecorationError, ClientError);
|
||||
efrom!(GetToplevelDecorationError, MsgParserError);
|
||||
efrom!(ZxdgDecorationManagerV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ impl ZxdgOutputManagerV1Global {
|
|||
}
|
||||
|
||||
impl ZxdgOutputManagerV1 {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZxdgOutputManagerV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_xdg_output(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetXdgOutputError> {
|
||||
fn get_xdg_output(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZxdgOutputManagerV1Error> {
|
||||
let req: GetXdgOutput = self.client.parse(&**self, parser)?;
|
||||
let output = self.client.lookup(req.output)?;
|
||||
let xdg_output = Rc::new(ZxdgOutputV1 {
|
||||
|
|
@ -90,7 +90,7 @@ impl Global for ZxdgOutputManagerV1Global {
|
|||
simple_add_global!(ZxdgOutputManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ZxdgOutputManagerV1, ZxdgOutputManagerV1Error;
|
||||
ZxdgOutputManagerV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
GET_XDG_OUTPUT => get_xdg_output,
|
||||
|
|
@ -108,29 +108,8 @@ impl Object for ZxdgOutputManagerV1 {
|
|||
pub enum ZxdgOutputManagerV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process a `get_xdg_output` request")]
|
||||
GetXdgOutputError(#[from] GetXdgOutputError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ZxdgOutputManagerV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetXdgOutputError {
|
||||
#[error("Parsing failed")]
|
||||
ParseError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetXdgOutputError, ParseError, MsgParserError);
|
||||
efrom!(GetXdgOutputError, ClientError);
|
||||
efrom!(ZxdgOutputManagerV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ impl ZxdgOutputV1 {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn destroy(&self, msg: MsgParser) -> Result<(), DestroyError> {
|
||||
pub fn destroy(&self, msg: MsgParser) -> Result<(), ZxdgOutputV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, msg)?;
|
||||
self.output.xdg_outputs.remove(&self.id);
|
||||
self.client.remove_obj(self)?;
|
||||
|
|
@ -83,7 +83,7 @@ impl ZxdgOutputV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgOutputV1, ZxdgOutputV1Error;
|
||||
ZxdgOutputV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
}
|
||||
|
|
@ -98,16 +98,10 @@ simple_add_obj!(ZxdgOutputV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZxdgOutputV1Error {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(ZxdgOutputV1Error, MsgParserError);
|
||||
efrom!(ZxdgOutputV1Error, ClientError);
|
||||
|
|
|
|||
|
|
@ -51,19 +51,19 @@ impl ZxdgToplevelDecorationV1 {
|
|||
self.toplevel.xdg.do_send_configure();
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZxdgToplevelDecorationV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), SetModeError> {
|
||||
fn set_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZxdgToplevelDecorationV1Error> {
|
||||
let _req: SetMode = self.client.parse(&**self, parser)?;
|
||||
self.do_send_configure();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn unset_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), UnsetModeError> {
|
||||
fn unset_mode(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZxdgToplevelDecorationV1Error> {
|
||||
let _req: UnsetMode = self.client.parse(&**self, parser)?;
|
||||
self.do_send_configure();
|
||||
Ok(())
|
||||
|
|
@ -71,7 +71,7 @@ impl ZxdgToplevelDecorationV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZxdgToplevelDecorationV1, ZxdgToplevelDecorationV1Error;
|
||||
ZxdgToplevelDecorationV1;
|
||||
|
||||
DESTROY => destroy,
|
||||
SET_MODE => set_mode,
|
||||
|
|
@ -88,34 +88,10 @@ simple_add_obj!(ZxdgToplevelDecorationV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZxdgToplevelDecorationV1Error {
|
||||
#[error("Could not process a `destroy` request")]
|
||||
DestoryError(#[from] DestroyError),
|
||||
#[error("Could not process a `set_mode` request")]
|
||||
SetModeError(#[from] SetModeError),
|
||||
#[error("Could not process a `unset_mode` request")]
|
||||
UnsetModeError(#[from] UnsetModeError),
|
||||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(DestroyError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetModeError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(SetModeError, MsgParserError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum UnsetModeError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(UnsetModeError, MsgParserError);
|
||||
efrom!(ZxdgToplevelDecorationV1Error, ClientError);
|
||||
efrom!(ZxdgToplevelDecorationV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ macro_rules! efrom {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! object_base2 {
|
||||
macro_rules! object_base {
|
||||
($oname:ident; $($code:ident => $f:ident,)*) => {
|
||||
impl crate::object::ObjectBase for $oname {
|
||||
fn id(&self) -> crate::object::ObjectId {
|
||||
|
|
@ -49,54 +49,6 @@ macro_rules! object_base2 {
|
|||
};
|
||||
}
|
||||
|
||||
macro_rules! object_base {
|
||||
($oname:ident, $ename:ty; $($code:ident => $f:ident,)*) => {
|
||||
impl crate::object::ObjectBase for $oname {
|
||||
fn id(&self) -> crate::object::ObjectId {
|
||||
self.id.into()
|
||||
}
|
||||
|
||||
#[allow(unused_variables, unreachable_code)]
|
||||
fn handle_request(
|
||||
self: std::rc::Rc<Self>,
|
||||
request: u32,
|
||||
parser: crate::utils::buffd::MsgParser<'_, '_>,
|
||||
) -> Result<(), crate::client::ClientError> {
|
||||
fn handle_request(
|
||||
slf: std::rc::Rc<$oname>,
|
||||
request: u32,
|
||||
parser: crate::utils::buffd::MsgParser<'_, '_>,
|
||||
) -> Result<(), $ename> {
|
||||
match request {
|
||||
$(
|
||||
$code => $oname::$f(&slf, parser)?,
|
||||
)*
|
||||
_ => unreachable!(),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
if let Err(e) = handle_request(self, request, parser) {
|
||||
return Err(crate::client::ClientError::ObjectError(e.into()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn interface(&self) -> crate::object::Interface {
|
||||
crate::wire::$oname
|
||||
}
|
||||
}
|
||||
|
||||
impl From<$ename> for crate::client::ObjectError {
|
||||
fn from(v: $ename) -> Self {
|
||||
Self {
|
||||
interface: crate::wire::$oname,
|
||||
error: Box::new(v),
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! global_base {
|
||||
($oname:ty, $ifname:ident, $ename:ty) => {
|
||||
impl crate::globals::GlobalBase for $oname {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue