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 })
|
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)?;
|
let req: StartDrag = self.manager.client.parse(self, parser)?;
|
||||||
if !self.manager.client.valid_serial(req.serial) {
|
if !self.manager.client.valid_serial(req.serial) {
|
||||||
log::warn!("Client tried to start_drag with an invalid serial");
|
log::warn!("Client tried to start_drag with an invalid serial");
|
||||||
|
|
@ -117,7 +117,7 @@ impl WlDataDevice {
|
||||||
Ok(())
|
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)?;
|
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||||
if !self.manager.client.valid_serial(req.serial) {
|
if !self.manager.client.valid_serial(req.serial) {
|
||||||
log::warn!("Client tried to set_selection with an invalid serial");
|
log::warn!("Client tried to set_selection with an invalid serial");
|
||||||
|
|
@ -140,7 +140,7 @@ impl WlDataDevice {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||||
let _req: Release = self.manager.client.parse(self, parser)?;
|
let _req: Release = self.manager.client.parse(self, parser)?;
|
||||||
destroy_device::<Self>(self);
|
destroy_device::<Self>(self);
|
||||||
self.seat.remove_data_device(self);
|
self.seat.remove_data_device(self);
|
||||||
|
|
@ -229,7 +229,7 @@ impl Vtable for WlDataDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDataDevice, WlDataDeviceError;
|
WlDataDevice;
|
||||||
|
|
||||||
START_DRAG => start_drag,
|
START_DRAG => start_drag,
|
||||||
SET_SELECTION => set_selection,
|
SET_SELECTION => set_selection,
|
||||||
|
|
@ -251,52 +251,16 @@ simple_add_obj!(WlDataDevice);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlDataDeviceError {
|
pub enum WlDataDeviceError {
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `start_drag` request")]
|
#[error(transparent)]
|
||||||
StartDragError(#[from] StartDragError),
|
WlSeatError(Box<WlSeatError>),
|
||||||
#[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)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
WlSurfaceError(Box<WlSurfaceError>),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
#[error(transparent)]
|
|
||||||
WlSeatError(Box<WlSeatError>),
|
|
||||||
}
|
}
|
||||||
efrom!(StartDragError, ParseFailed, MsgParserError);
|
efrom!(WlDataDeviceError, MsgParserError);
|
||||||
efrom!(StartDragError, ClientError);
|
efrom!(WlDataDeviceError, ClientError);
|
||||||
efrom!(StartDragError, WlSeatError);
|
efrom!(WlDataDeviceError, WlSeatError);
|
||||||
efrom!(StartDragError, WlSurfaceError);
|
efrom!(WlDataDeviceError, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ impl WlDataDeviceManagerGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WlDataDeviceManager {
|
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 req: CreateDataSource = self.client.parse(self, parser)?;
|
||||||
let res = Rc::new(WlDataSource::new(req.id, &self.client));
|
let res = Rc::new(WlDataSource::new(req.id, &self.client));
|
||||||
track!(self.client, res);
|
track!(self.client, res);
|
||||||
|
|
@ -67,7 +67,7 @@ impl WlDataDeviceManager {
|
||||||
fn get_data_device(
|
fn get_data_device(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), GetDataDeviceError> {
|
) -> Result<(), WlDataDeviceManagerError> {
|
||||||
let req: GetDataDevice = self.client.parse(&**self, parser)?;
|
let req: GetDataDevice = self.client.parse(&**self, parser)?;
|
||||||
let seat = self.client.lookup(req.seat)?;
|
let seat = self.client.lookup(req.seat)?;
|
||||||
let dev = Rc::new(WlDataDevice::new(req.id, self, &seat));
|
let dev = Rc::new(WlDataDevice::new(req.id, self, &seat));
|
||||||
|
|
@ -97,7 +97,7 @@ impl Global for WlDataDeviceManagerGlobal {
|
||||||
simple_add_global!(WlDataDeviceManagerGlobal);
|
simple_add_global!(WlDataDeviceManagerGlobal);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDataDeviceManager, WlDataDeviceManagerError;
|
WlDataDeviceManager;
|
||||||
|
|
||||||
CREATE_DATA_SOURCE => create_data_source,
|
CREATE_DATA_SOURCE => create_data_source,
|
||||||
GET_DATA_DEVICE => get_data_device,
|
GET_DATA_DEVICE => get_data_device,
|
||||||
|
|
@ -115,29 +115,8 @@ simple_add_obj!(WlDataDeviceManager);
|
||||||
pub enum WlDataDeviceManagerError {
|
pub enum WlDataDeviceManagerError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `create_data_source` request")]
|
#[error("Parsing failed")]
|
||||||
CreateDataSourceError(#[from] CreateDataSourceError),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Could not process `get_data_device` request")]
|
|
||||||
GetDataDeviceError(#[from] GetDataDeviceError),
|
|
||||||
}
|
}
|
||||||
efrom!(WlDataDeviceManagerError, ClientError);
|
efrom!(WlDataDeviceManagerError, ClientError);
|
||||||
|
efrom!(WlDataDeviceManagerError, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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: Accept = self.client.parse(self, parser)?;
|
||||||
let _ = req.serial; // unused
|
let _ = req.serial; // unused
|
||||||
let mut state = self.data.shared.state.get();
|
let mut state = self.data.shared.state.get();
|
||||||
if state.contains(OFFER_STATE_FINISHED) {
|
if state.contains(OFFER_STATE_FINISHED) {
|
||||||
return Err(AcceptError::AlreadyFinished);
|
return Err(WlDataOfferError::AlreadyFinished);
|
||||||
}
|
}
|
||||||
if req.mime_type.is_some() {
|
if req.mime_type.is_some() {
|
||||||
state |= OFFER_STATE_ACCEPTED;
|
state |= OFFER_STATE_ACCEPTED;
|
||||||
|
|
@ -80,36 +80,36 @@ impl WlDataOffer {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ReceiveError> {
|
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||||
let req: Receive = self.client.parse(self, parser)?;
|
let req: Receive = self.client.parse(self, parser)?;
|
||||||
if self.data.shared.state.get().contains(OFFER_STATE_FINISHED) {
|
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);
|
receive::<WlDataDevice>(self, req.mime_type, req.fd);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
destroy_offer::<WlDataDevice>(self);
|
destroy_offer::<WlDataDevice>(self);
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), FinishError> {
|
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||||
let _req: Finish = self.client.parse(self, parser)?;
|
let _req: Finish = self.client.parse(self, parser)?;
|
||||||
if self.data.shared.role.get() != Role::Dnd {
|
if self.data.shared.role.get() != Role::Dnd {
|
||||||
return Err(FinishError::NotDnd);
|
return Err(WlDataOfferError::NotDnd);
|
||||||
}
|
}
|
||||||
let mut state = self.data.shared.state.get();
|
let mut state = self.data.shared.state.get();
|
||||||
if state.contains(OFFER_STATE_FINISHED) {
|
if state.contains(OFFER_STATE_FINISHED) {
|
||||||
return Err(FinishError::AlreadyFinished);
|
return Err(WlDataOfferError::AlreadyFinished);
|
||||||
}
|
}
|
||||||
if !state.contains(OFFER_STATE_DROPPED) {
|
if !state.contains(OFFER_STATE_DROPPED) {
|
||||||
return Err(FinishError::StillDragging);
|
return Err(WlDataOfferError::StillDragging);
|
||||||
}
|
}
|
||||||
if !state.contains(OFFER_STATE_ACCEPTED) {
|
if !state.contains(OFFER_STATE_ACCEPTED) {
|
||||||
return Err(FinishError::NoMimeTypeAccepted);
|
return Err(WlDataOfferError::NoMimeTypeAccepted);
|
||||||
}
|
}
|
||||||
state |= OFFER_STATE_FINISHED;
|
state |= OFFER_STATE_FINISHED;
|
||||||
if let Some(src) = self.data.source.get() {
|
if let Some(src) = self.data.source.get() {
|
||||||
|
|
@ -122,17 +122,17 @@ impl WlDataOffer {
|
||||||
Ok(())
|
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 req: SetActions = self.client.parse(self, parser)?;
|
||||||
let state = self.data.shared.state.get();
|
let state = self.data.shared.state.get();
|
||||||
if state.contains(OFFER_STATE_FINISHED) {
|
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) {
|
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 {
|
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.shared.receiver_actions.set(req.dnd_actions);
|
||||||
self.data
|
self.data
|
||||||
|
|
@ -147,7 +147,7 @@ impl WlDataOffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDataOffer, WlDataOfferError;
|
WlDataOffer;
|
||||||
|
|
||||||
ACCEPT => accept,
|
ACCEPT => accept,
|
||||||
RECEIVE => receive,
|
RECEIVE => receive,
|
||||||
|
|
@ -172,59 +172,8 @@ simple_add_obj!(WlDataOffer);
|
||||||
pub enum WlDataOfferError {
|
pub enum WlDataOfferError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error("`finish` was already called")]
|
#[error("`finish` was already called")]
|
||||||
AlreadyFinished,
|
AlreadyFinished,
|
||||||
#[error("The drag operation is still ongoing")]
|
#[error("The drag operation is still ongoing")]
|
||||||
|
|
@ -233,22 +182,10 @@ pub enum FinishError {
|
||||||
NoMimeTypeAccepted,
|
NoMimeTypeAccepted,
|
||||||
#[error("This is not a drag-and-drop offer")]
|
#[error("This is not a drag-and-drop offer")]
|
||||||
NotDnd,
|
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")]
|
#[error("The set of actions is invalid")]
|
||||||
InvalidActions,
|
InvalidActions,
|
||||||
#[error("Multiple preferred actions were specified")]
|
#[error("Multiple preferred actions were specified")]
|
||||||
MultiplePreferred,
|
MultiplePreferred,
|
||||||
}
|
}
|
||||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
efrom!(WlDataOfferError, ClientError);
|
||||||
efrom!(SetActionsError, ClientError);
|
efrom!(WlDataOfferError, MsgParserError);
|
||||||
|
|
|
||||||
|
|
@ -138,26 +138,26 @@ impl WlDataSource {
|
||||||
.event(DndDropPerformed { self_id: self.id })
|
.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)?;
|
let req: Offer = self.data.client.parse(self, parser)?;
|
||||||
add_mime_type::<WlDataDevice>(self, req.mime_type);
|
add_mime_type::<WlDataDevice>(self, req.mime_type);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||||
destroy_source::<WlDataDevice>(self);
|
destroy_source::<WlDataDevice>(self);
|
||||||
self.data.client.remove_obj(self)?;
|
self.data.client.remove_obj(self)?;
|
||||||
Ok(())
|
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)?;
|
let req: SetActions = self.data.client.parse(self, parser)?;
|
||||||
if self.data.actions.get().is_some() {
|
if self.data.actions.get().is_some() {
|
||||||
return Err(SetActionsError::AlreadySet);
|
return Err(WlDataSourceError::AlreadySet);
|
||||||
}
|
}
|
||||||
if req.dnd_actions & !DND_ALL != 0 {
|
if req.dnd_actions & !DND_ALL != 0 {
|
||||||
return Err(SetActionsError::InvalidActions);
|
return Err(WlDataSourceError::InvalidActions);
|
||||||
}
|
}
|
||||||
self.data.actions.set(Some(req.dnd_actions));
|
self.data.actions.set(Some(req.dnd_actions));
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -165,7 +165,7 @@ impl WlDataSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDataSource, WlDataSourceError;
|
WlDataSource;
|
||||||
|
|
||||||
OFFER => offer,
|
OFFER => offer,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -186,41 +186,8 @@ dedicated_add_obj!(WlDataSource, WlDataSourceId, wl_data_source);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlDataSourceError {
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("The set of actions is invalid")]
|
#[error("The set of actions is invalid")]
|
||||||
|
|
@ -228,5 +195,5 @@ pub enum SetActionsError {
|
||||||
#[error("The actions have already been set")]
|
#[error("The actions have already been set")]
|
||||||
AlreadySet,
|
AlreadySet,
|
||||||
}
|
}
|
||||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
efrom!(WlDataSourceError, ClientError);
|
||||||
efrom!(SetActionsError, ClientError);
|
efrom!(WlDataSourceError, MsgParserError);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ impl ZwpPrimarySelectionDeviceManagerV1Global {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZwpPrimarySelectionDeviceManagerV1 {
|
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 req: CreateSource = self.client.parse(self, parser)?;
|
||||||
let res = Rc::new(ZwpPrimarySelectionSourceV1::new(req.id, &self.client));
|
let res = Rc::new(ZwpPrimarySelectionSourceV1::new(req.id, &self.client));
|
||||||
track!(self.client, res);
|
track!(self.client, res);
|
||||||
|
|
@ -58,7 +58,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
||||||
Ok(())
|
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 req: GetDevice = self.client.parse(&**self, parser)?;
|
||||||
let seat = self.client.lookup(req.seat)?;
|
let seat = self.client.lookup(req.seat)?;
|
||||||
let dev = Rc::new(ZwpPrimarySelectionDeviceV1::new(req.id, self, &seat));
|
let dev = Rc::new(ZwpPrimarySelectionDeviceV1::new(req.id, self, &seat));
|
||||||
|
|
@ -68,7 +68,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -94,7 +94,7 @@ impl Global for ZwpPrimarySelectionDeviceManagerV1Global {
|
||||||
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);
|
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpPrimarySelectionDeviceManagerV1, ZwpPrimarySelectionDeviceManagerV1Error;
|
ZwpPrimarySelectionDeviceManagerV1;
|
||||||
|
|
||||||
CREATE_SOURCE => create_source,
|
CREATE_SOURCE => create_source,
|
||||||
GET_DEVICE => get_data_device,
|
GET_DEVICE => get_data_device,
|
||||||
|
|
@ -111,43 +111,10 @@ simple_add_obj!(ZwpPrimarySelectionDeviceManagerV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwpPrimarySelectionDeviceManagerV1Error {
|
pub enum ZwpPrimarySelectionDeviceManagerV1Error {
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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);
|
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, ClientError);
|
||||||
|
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||||
if !self.manager.client.valid_serial(req.serial) {
|
if !self.manager.client.valid_serial(req.serial) {
|
||||||
log::warn!("Client tried to set_selection with an invalid serial");
|
log::warn!("Client tried to set_selection with an invalid serial");
|
||||||
|
|
@ -86,7 +86,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceV1Error> {
|
||||||
let _req: Destroy = self.manager.client.parse(self, parser)?;
|
let _req: Destroy = self.manager.client.parse(self, parser)?;
|
||||||
destroy_device::<Self>(self);
|
destroy_device::<Self>(self);
|
||||||
self.seat.remove_primary_selection_device(self);
|
self.seat.remove_primary_selection_device(self);
|
||||||
|
|
@ -171,7 +171,7 @@ impl Vtable for ZwpPrimarySelectionDeviceV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpPrimarySelectionDeviceV1, ZwpPrimarySelectionDeviceV1Error;
|
ZwpPrimarySelectionDeviceV1;
|
||||||
|
|
||||||
SET_SELECTION => set_selection,
|
SET_SELECTION => set_selection,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -194,32 +194,11 @@ simple_add_obj!(ZwpPrimarySelectionDeviceV1);
|
||||||
pub enum ZwpPrimarySelectionDeviceV1Error {
|
pub enum ZwpPrimarySelectionDeviceV1Error {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSeatError(Box<WlSeatError>),
|
WlSeatError(Box<WlSeatError>),
|
||||||
}
|
}
|
||||||
efrom!(SetSelectionError, ParseFailed, MsgParserError);
|
efrom!(ZwpPrimarySelectionDeviceV1Error, ClientError);
|
||||||
efrom!(SetSelectionError, ClientError);
|
efrom!(ZwpPrimarySelectionDeviceV1Error, MsgParserError);
|
||||||
efrom!(SetSelectionError, WlSeatError);
|
efrom!(ZwpPrimarySelectionDeviceV1Error, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let req: Receive = self.client.parse(self, parser)?;
|
||||||
receive::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type, req.fd);
|
receive::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type, req.fd);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionOfferV1Error> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
destroy_offer::<ZwpPrimarySelectionDeviceV1>(self);
|
destroy_offer::<ZwpPrimarySelectionDeviceV1>(self);
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
|
|
@ -44,7 +44,7 @@ impl ZwpPrimarySelectionOfferV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpPrimarySelectionOfferV1, ZwpPrimarySelectionOfferV1Error;
|
ZwpPrimarySelectionOfferV1;
|
||||||
|
|
||||||
RECEIVE => receive,
|
RECEIVE => receive,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -64,31 +64,10 @@ simple_add_obj!(ZwpPrimarySelectionOfferV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwpPrimarySelectionOfferV1Error {
|
pub enum ZwpPrimarySelectionOfferV1Error {
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `receive` request")]
|
|
||||||
ReceiveError(#[from] ReceiveError),
|
|
||||||
#[error("Could not process `destroy` request")]
|
|
||||||
DestroyError(#[from] DestroyError),
|
|
||||||
}
|
}
|
||||||
efrom!(ZwpPrimarySelectionOfferV1Error, ClientError);
|
efrom!(ZwpPrimarySelectionOfferV1Error, ClientError);
|
||||||
|
efrom!(ZwpPrimarySelectionOfferV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let req: Offer = self.data.client.parse(self, parser)?;
|
||||||
add_mime_type::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type);
|
add_mime_type::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionSourceV1Error> {
|
||||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||||
destroy_source::<ZwpPrimarySelectionDeviceV1>(self);
|
destroy_source::<ZwpPrimarySelectionDeviceV1>(self);
|
||||||
self.data.client.remove_obj(self)?;
|
self.data.client.remove_obj(self)?;
|
||||||
|
|
@ -57,7 +57,7 @@ impl ZwpPrimarySelectionSourceV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpPrimarySelectionSourceV1, ZwpPrimarySelectionSourceV1Error;
|
ZwpPrimarySelectionSourceV1;
|
||||||
|
|
||||||
OFFER => offer,
|
OFFER => offer,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -83,29 +83,8 @@ dedicated_add_obj!(
|
||||||
pub enum ZwpPrimarySelectionSourceV1Error {
|
pub enum ZwpPrimarySelectionSourceV1Error {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `offer` request")]
|
#[error("Parsing failed")]
|
||||||
OfferError(#[from] OfferError),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Could not process `destroy` request")]
|
|
||||||
DestroyError(#[from] DestroyError),
|
|
||||||
}
|
}
|
||||||
efrom!(ZwpPrimarySelectionSourceV1Error, ClientError);
|
efrom!(ZwpPrimarySelectionSourceV1Error, ClientError);
|
||||||
|
efrom!(ZwpPrimarySelectionSourceV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ impl JayCompositor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
JayCompositor;
|
JayCompositor;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ impl JayIdle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
JayIdle;
|
JayIdle;
|
||||||
|
|
||||||
GET_STATUS => get_status,
|
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)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -41,7 +41,7 @@ impl JayLogFile {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
JayLogFile, JayLogFileError;
|
JayLogFile;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
}
|
}
|
||||||
|
|
@ -56,16 +56,10 @@ simple_add_obj!(JayLogFile);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum JayLogFileError {
|
pub enum JayLogFileError {
|
||||||
#[error("Could not process a `destroy` request")]
|
|
||||||
DestroyError(#[from] DestroyError),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
MsgParserError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(JayLogFileError, ClientError);
|
||||||
efrom!(DestroyError, MsgParserError);
|
efrom!(JayLogFileError, MsgParserError);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ impl JayScreenshot {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
JayScreenshot;
|
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)?;
|
let _req: Release = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
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)?;
|
let req: RequestMode = self.client.parse(&**self, parser)?;
|
||||||
if req.mode > SERVER {
|
if req.mode > SERVER {
|
||||||
return Err(RequestModeError::InvalidMode(req.mode));
|
return Err(OrgKdeKwinServerDecorationError::InvalidMode(req.mode));
|
||||||
}
|
}
|
||||||
let mode = if self.requested.replace(true) {
|
let mode = if self.requested.replace(true) {
|
||||||
req.mode
|
req.mode
|
||||||
|
|
@ -62,7 +62,7 @@ impl OrgKdeKwinServerDecoration {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
OrgKdeKwinServerDecoration, OrgKdeKwinServerDecorationError;
|
OrgKdeKwinServerDecoration;
|
||||||
|
|
||||||
RELEASE => release,
|
RELEASE => release,
|
||||||
REQUEST_MODE => request_mode,
|
REQUEST_MODE => request_mode,
|
||||||
|
|
@ -78,33 +78,12 @@ simple_add_obj!(OrgKdeKwinServerDecoration);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum OrgKdeKwinServerDecorationError {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Mode {0} does not exist")]
|
||||||
InvalidMode(u32),
|
InvalidMode(u32),
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(RequestModeError, ClientError);
|
efrom!(OrgKdeKwinServerDecorationError, ClientError);
|
||||||
efrom!(RequestModeError, ParseError, MsgParserError);
|
efrom!(OrgKdeKwinServerDecorationError, MsgParserError);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use {
|
||||||
std::rc::Rc,
|
std::rc::Rc,
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
};
|
};
|
||||||
|
use crate::ifs::org_kde_kwin_server_decoration::OrgKdeKwinServerDecorationError;
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
const NONE: u32 = 0;
|
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 req: Create = self.client.parse(self, parser)?;
|
||||||
let _ = self.client.lookup(req.surface)?;
|
let _ = self.client.lookup(req.surface)?;
|
||||||
let obj = Rc::new(OrgKdeKwinServerDecoration::new(req.id, &self.client));
|
let obj = Rc::new(OrgKdeKwinServerDecoration::new(req.id, &self.client));
|
||||||
|
|
@ -90,7 +91,7 @@ impl OrgKdeKwinServerDecorationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
OrgKdeKwinServerDecorationManager, OrgKdeKwinServerDecorationManagerError;
|
OrgKdeKwinServerDecorationManager;
|
||||||
|
|
||||||
CREATE => create,
|
CREATE => create,
|
||||||
}
|
}
|
||||||
|
|
@ -105,23 +106,10 @@ simple_add_obj!(OrgKdeKwinServerDecorationManager);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum OrgKdeKwinServerDecorationManagerError {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(CreateError, ClientError);
|
efrom!(OrgKdeKwinServerDecorationManagerError, ClientError);
|
||||||
efrom!(CreateError, ParseError, MsgParserError);
|
efrom!(OrgKdeKwinServerDecorationManagerError, MsgParserError);
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ impl WlBuffer {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlBufferError> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
self.destroyed.set(true);
|
self.destroyed.set(true);
|
||||||
|
|
@ -131,7 +131,7 @@ impl WlBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlBuffer, WlBufferError;
|
WlBuffer;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
}
|
}
|
||||||
|
|
@ -150,22 +150,16 @@ pub enum WlBufferError {
|
||||||
OutOfBounds,
|
OutOfBounds,
|
||||||
#[error("The stride does not fit all pixels in a row")]
|
#[error("The stride does not fit all pixels in a row")]
|
||||||
StrideTooSmall,
|
StrideTooSmall,
|
||||||
#[error("Could not handle a `destroy` request")]
|
|
||||||
DestroyError(#[from] DestroyError),
|
|
||||||
#[error("Could not access the client memory")]
|
#[error("Could not access the client memory")]
|
||||||
ClientMemError(#[source] Box<ClientMemError>),
|
ClientMemError(#[source] Box<ClientMemError>),
|
||||||
#[error("GLES could not import the client image")]
|
#[error("GLES could not import the client image")]
|
||||||
GlesError(#[source] Box<RenderError>),
|
RenderError(#[source] Box<RenderError>),
|
||||||
}
|
|
||||||
efrom!(WlBufferError, ClientMemError);
|
|
||||||
efrom!(WlBufferError, GlesError, RenderError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
efrom!(WlBufferError, ClientMemError);
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(WlBufferError, RenderError);
|
||||||
|
efrom!(WlBufferError, MsgParserError);
|
||||||
|
efrom!(WlBufferError, ClientError);
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ impl WlCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlCallback, WlCallbackError;
|
WlCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Object for WlCallback {
|
impl Object for WlCallback {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ impl WlCompositorGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WlCompositor {
|
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: CreateSurface = self.client.parse(self, parser)?;
|
||||||
let surface = Rc::new(WlSurface::new(surface.id, &self.client));
|
let surface = Rc::new(WlSurface::new(surface.id, &self.client));
|
||||||
track!(self.client, surface);
|
track!(self.client, surface);
|
||||||
|
|
@ -63,7 +63,7 @@ impl WlCompositor {
|
||||||
Ok(())
|
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: CreateRegion = self.client.parse(self, parser)?;
|
||||||
let region = Rc::new(WlRegion::new(region.id, &self.client));
|
let region = Rc::new(WlRegion::new(region.id, &self.client));
|
||||||
track!(self.client, region);
|
track!(self.client, region);
|
||||||
|
|
@ -87,7 +87,7 @@ impl Global for WlCompositorGlobal {
|
||||||
simple_add_global!(WlCompositorGlobal);
|
simple_add_global!(WlCompositorGlobal);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlCompositor, WlCompositorError;
|
WlCompositor;
|
||||||
|
|
||||||
CREATE_SURFACE => create_surface,
|
CREATE_SURFACE => create_surface,
|
||||||
CREATE_REGION => create_region,
|
CREATE_REGION => create_region,
|
||||||
|
|
@ -105,34 +105,9 @@ simple_add_obj!(WlCompositor);
|
||||||
pub enum WlCompositorError {
|
pub enum WlCompositorError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `create_surface` request")]
|
#[error("Parsing failed")]
|
||||||
CreateSurfaceError(#[source] Box<CreateSurfaceError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Could not process `create_region` request")]
|
|
||||||
CreateRegionError(#[source] Box<CreateRegionError>),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
efrom!(WlCompositorError, ClientError);
|
efrom!(WlCompositorError, ClientError);
|
||||||
efrom!(WlCompositorError, CreateSurfaceError);
|
efrom!(WlCompositorError, MsgParserError);
|
||||||
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);
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
globals::GlobalsError,
|
|
||||||
ifs::{wl_callback::WlCallback, wl_registry::WlRegistry},
|
ifs::{wl_callback::WlCallback, wl_registry::WlRegistry},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::{Object, ObjectId, WL_DISPLAY_ID},
|
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 sync: Sync = self.client.parse(self, parser)?;
|
||||||
let cb = Rc::new(WlCallback::new(sync.callback, &self.client));
|
let cb = Rc::new(WlCallback::new(sync.callback, &self.client));
|
||||||
track!(self.client, cb);
|
track!(self.client, cb);
|
||||||
|
|
@ -43,7 +42,7 @@ impl WlDisplay {
|
||||||
Ok(())
|
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 gr: GetRegistry = self.client.parse(self, parser)?;
|
||||||
let registry = Rc::new(WlRegistry::new(gr.registry, &self.client));
|
let registry = Rc::new(WlRegistry::new(gr.registry, &self.client));
|
||||||
track!(self.client, registry);
|
track!(self.client, registry);
|
||||||
|
|
@ -90,7 +89,7 @@ impl WlDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDisplay, WlDisplayError;
|
WlDisplay;
|
||||||
|
|
||||||
SYNC => sync,
|
SYNC => sync,
|
||||||
GET_REGISTRY => get_registry,
|
GET_REGISTRY => get_registry,
|
||||||
|
|
@ -104,36 +103,10 @@ impl Object for WlDisplay {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlDisplayError {
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
|
efrom!(WlDisplayError, MsgParserError);
|
||||||
efrom!(SyncError, ParseFailed, MsgParserError);
|
efrom!(WlDisplayError, ClientError);
|
||||||
efrom!(SyncError, 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)?;
|
let _req: Authenticate = self.client.parse(&**self, parser)?;
|
||||||
self.send_authenticated();
|
self.send_authenticated();
|
||||||
Ok(())
|
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)?;
|
let _req: CreateBuffer = self.client.parse(&**self, parser)?;
|
||||||
Err(CreateBufferError::Unsupported)
|
Err(WlDrmError::Unsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_planar_buffer(
|
fn create_planar_buffer(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), CreatePlanarBufferError> {
|
) -> Result<(), WlDrmError> {
|
||||||
let _req: CreatePlanarBuffer = self.client.parse(&**self, parser)?;
|
let _req: CreatePlanarBuffer = self.client.parse(&**self, parser)?;
|
||||||
Err(CreatePlanarBufferError::Unsupported)
|
Err(WlDrmError::Unsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_prime_buffer(
|
fn create_prime_buffer(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), CreatePrimeBufferError> {
|
) -> Result<(), WlDrmError> {
|
||||||
let req: CreatePrimeBuffer = self.client.parse(&**self, parser)?;
|
let req: CreatePrimeBuffer = self.client.parse(&**self, parser)?;
|
||||||
let ctx = match self.client.state.render_ctx.get() {
|
let ctx = match self.client.state.render_ctx.get() {
|
||||||
Some(ctx) => ctx,
|
Some(ctx) => ctx,
|
||||||
None => return Err(CreatePrimeBufferError::NoRenderContext),
|
None => return Err(WlDrmError::NoRenderContext),
|
||||||
};
|
};
|
||||||
let formats = ctx.formats();
|
let formats = ctx.formats();
|
||||||
let format = match formats.get(&req.format) {
|
let format = match formats.get(&req.format) {
|
||||||
Some(f) => f.format,
|
Some(f) => f.format,
|
||||||
None => return Err(CreatePrimeBufferError::InvalidFormat(req.format)),
|
None => return Err(WlDrmError::InvalidFormat(req.format)),
|
||||||
};
|
};
|
||||||
let mut dmabuf = DmaBuf {
|
let mut dmabuf = DmaBuf {
|
||||||
width: req.width,
|
width: req.width,
|
||||||
|
|
@ -161,7 +161,7 @@ impl WlDrm {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlDrm, WlDrmError;
|
WlDrm;
|
||||||
|
|
||||||
AUTHENTICATE => authenticate,
|
AUTHENTICATE => authenticate,
|
||||||
CREATE_BUFFER => create_buffer,
|
CREATE_BUFFER => create_buffer,
|
||||||
|
|
@ -179,56 +179,18 @@ simple_add_obj!(WlDrm);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlDrmError {
|
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")]
|
#[error("Parsing failed")]
|
||||||
MsgParserError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
|
#[error(transparent)]
|
||||||
|
ClientError(Box<ClientError>),
|
||||||
|
#[error("This api is not supported")]
|
||||||
|
Unsupported,
|
||||||
#[error("The compositor has no render context attached")]
|
#[error("The compositor has no render context attached")]
|
||||||
NoRenderContext,
|
NoRenderContext,
|
||||||
#[error("The format {0} is not supported")]
|
#[error("The format {0} is not supported")]
|
||||||
InvalidFormat(u32),
|
InvalidFormat(u32),
|
||||||
#[error("Could not import the buffer")]
|
#[error("Could not import the buffer")]
|
||||||
ImportError(#[from] RenderError),
|
ImportError(#[from] RenderError),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
}
|
}
|
||||||
efrom!(CreatePrimeBufferError, MsgParserError);
|
efrom!(WlDrmError, ClientError);
|
||||||
efrom!(CreatePrimeBufferError, 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)?;
|
let _req: Release = self.client.parse(self, parser)?;
|
||||||
self.xdg_outputs.clear();
|
self.xdg_outputs.clear();
|
||||||
self.remove_binding();
|
self.remove_binding();
|
||||||
|
|
@ -240,7 +240,7 @@ impl WlOutput {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlOutput, WlOutputError;
|
WlOutput;
|
||||||
|
|
||||||
RELEASE => release,
|
RELEASE => release,
|
||||||
}
|
}
|
||||||
|
|
@ -264,19 +264,10 @@ dedicated_add_obj!(WlOutput, WlOutputId, outputs);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlOutputError {
|
pub enum WlOutputError {
|
||||||
#[error("Could not handle `release` request")]
|
|
||||||
ReleaseError(#[from] ReleaseError),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(WlOutputError, ClientError);
|
efrom!(WlOutputError, ClientError);
|
||||||
|
efrom!(WlOutputError, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -32,26 +32,26 @@ impl WlRegion {
|
||||||
self.region.borrow_mut().get()
|
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)?;
|
let _destroy: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add(&self, parser: MsgParser<'_, '_>) -> Result<(), AddError> {
|
fn add(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegionError> {
|
||||||
let add: Add = self.client.parse(self, parser)?;
|
let add: Add = self.client.parse(self, parser)?;
|
||||||
if add.width < 0 || add.height < 0 {
|
if add.width < 0 || add.height < 0 {
|
||||||
return Err(AddError::NegativeExtents);
|
return Err(WlRegionError::NegativeExtents);
|
||||||
}
|
}
|
||||||
let mut region = self.region.borrow_mut();
|
let mut region = self.region.borrow_mut();
|
||||||
region.add(Rect::new_sized(add.x, add.y, add.width, add.height).unwrap());
|
region.add(Rect::new_sized(add.x, add.y, add.width, add.height).unwrap());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn subtract(&self, parser: MsgParser<'_, '_>) -> Result<(), SubtractError> {
|
fn subtract(&self, parser: MsgParser<'_, '_>) -> Result<(), WlRegionError> {
|
||||||
let req: Subtract = self.client.parse(self, parser)?;
|
let req: Subtract = self.client.parse(self, parser)?;
|
||||||
if req.width < 0 || req.height < 0 {
|
if req.width < 0 || req.height < 0 {
|
||||||
return Err(SubtractError::NegativeExtents);
|
return Err(WlRegionError::NegativeExtents);
|
||||||
}
|
}
|
||||||
let mut region = self.region.borrow_mut();
|
let mut region = self.region.borrow_mut();
|
||||||
region.sub(Rect::new_sized(req.x, req.y, req.width, req.height).unwrap());
|
region.sub(Rect::new_sized(req.x, req.y, req.width, req.height).unwrap());
|
||||||
|
|
@ -60,7 +60,7 @@ impl WlRegion {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlRegion, WlRegionError;
|
WlRegion;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
ADD => add,
|
ADD => add,
|
||||||
|
|
@ -77,38 +77,12 @@ dedicated_add_obj!(WlRegion, WlRegionId, regions);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlRegionError {
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("width and/or height are negative")]
|
||||||
NegativeExtents,
|
NegativeExtents,
|
||||||
}
|
}
|
||||||
efrom!(AddError, ParseFailed, MsgParserError);
|
efrom!(WlRegionError, MsgParserError);
|
||||||
|
efrom!(WlRegionError, ClientError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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 bind: Bind = self.client.parse(self, parser)?;
|
||||||
let global = self
|
let global = self
|
||||||
.client
|
.client
|
||||||
|
|
@ -50,14 +50,14 @@ impl WlRegistry {
|
||||||
.globals
|
.globals
|
||||||
.get(GlobalName::from_raw(bind.name))?;
|
.get(GlobalName::from_raw(bind.name))?;
|
||||||
if global.interface().name() != bind.interface {
|
if global.interface().name() != bind.interface {
|
||||||
return Err(BindError::InvalidInterface(InterfaceError {
|
return Err(WlRegistryError::InvalidInterface(InterfaceError {
|
||||||
name: global.name(),
|
name: global.name(),
|
||||||
interface: global.interface(),
|
interface: global.interface(),
|
||||||
actual: bind.interface.to_string(),
|
actual: bind.interface.to_string(),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if bind.version > global.version() {
|
if bind.version > global.version() {
|
||||||
return Err(BindError::InvalidVersion(VersionError {
|
return Err(WlRegistryError::InvalidVersion(VersionError {
|
||||||
name: global.name(),
|
name: global.name(),
|
||||||
interface: global.interface(),
|
interface: global.interface(),
|
||||||
version: global.version(),
|
version: global.version(),
|
||||||
|
|
@ -70,7 +70,7 @@ impl WlRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlRegistry, WlRegistryError;
|
WlRegistry;
|
||||||
|
|
||||||
BIND => bind,
|
BIND => bind,
|
||||||
}
|
}
|
||||||
|
|
@ -85,16 +85,8 @@ simple_add_obj!(WlRegistry);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlRegistryError {
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
GlobalsError(Box<GlobalsError>),
|
GlobalsError(Box<GlobalsError>),
|
||||||
#[error("Tried to bind to global {} of type {} using interface {}", .0.name, .0.interface.name(), .0.actual)]
|
#[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)]
|
#[error("Tried to bind to global {} of type {} and version {} using version {}", .0.name, .0.interface.name(), .0.version, .0.actual)]
|
||||||
InvalidVersion(VersionError),
|
InvalidVersion(VersionError),
|
||||||
}
|
}
|
||||||
efrom!(BindError, ParseError, MsgParserError);
|
efrom!(WlRegistryError, MsgParserError);
|
||||||
efrom!(BindError, GlobalsError);
|
efrom!(WlRegistryError, GlobalsError);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct InterfaceError {
|
pub struct InterfaceError {
|
||||||
|
|
|
||||||
|
|
@ -711,7 +711,7 @@ impl WlSeat {
|
||||||
self.global.move_(node);
|
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 req: GetPointer = self.client.parse(&**self, parser)?;
|
||||||
let p = Rc::new(WlPointer::new(req.id, self));
|
let p = Rc::new(WlPointer::new(req.id, self));
|
||||||
track!(self.client, p);
|
track!(self.client, p);
|
||||||
|
|
@ -720,7 +720,7 @@ impl WlSeat {
|
||||||
Ok(())
|
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 req: GetKeyboard = self.client.parse(&**self, parser)?;
|
||||||
let p = Rc::new(WlKeyboard::new(req.id, self));
|
let p = Rc::new(WlKeyboard::new(req.id, self));
|
||||||
track!(self.client, p);
|
track!(self.client, p);
|
||||||
|
|
@ -760,7 +760,7 @@ impl WlSeat {
|
||||||
Ok(Rc::new(fd))
|
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 req: GetTouch = self.client.parse(&**self, parser)?;
|
||||||
let p = Rc::new(WlTouch::new(req.id, self));
|
let p = Rc::new(WlTouch::new(req.id, self));
|
||||||
track!(self.client, p);
|
track!(self.client, p);
|
||||||
|
|
@ -768,7 +768,7 @@ impl WlSeat {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSeatError> {
|
||||||
let _req: Release = self.client.parse(self, parser)?;
|
let _req: Release = self.client.parse(self, parser)?;
|
||||||
{
|
{
|
||||||
let mut bindings = self.global.bindings.borrow_mut();
|
let mut bindings = self.global.bindings.borrow_mut();
|
||||||
|
|
@ -785,7 +785,7 @@ impl WlSeat {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlSeat, WlSeatError;
|
WlSeat;
|
||||||
|
|
||||||
GET_POINTER => get_pointer,
|
GET_POINTER => get_pointer,
|
||||||
GET_KEYBOARD => get_keyboard,
|
GET_KEYBOARD => get_keyboard,
|
||||||
|
|
@ -821,63 +821,18 @@ dedicated_add_obj!(WlSeat, WlSeatId, seats);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlSeatError {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
IpcError(#[from] IpcError),
|
IpcError(#[from] IpcError),
|
||||||
}
|
|
||||||
efrom!(WlSeatError, ClientError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum GetPointerError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlKeyboardError(Box<WlKeyboardError>),
|
WlKeyboardError(Box<WlKeyboardError>),
|
||||||
}
|
}
|
||||||
efrom!(GetKeyboardError, ClientError);
|
efrom!(WlSeatError, ClientError);
|
||||||
efrom!(GetKeyboardError, ParseError, MsgParserError);
|
efrom!(WlSeatError, MsgParserError);
|
||||||
efrom!(GetKeyboardError, WlKeyboardError, WlKeyboardError);
|
efrom!(WlSeatError, 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);
|
|
||||||
|
|
||||||
pub fn collect_kb_foci2(node: Rc<dyn Node>, seats: &mut SmallVec<[Rc<WlSeatGlobal>; 3]>) {
|
pub fn collect_kb_foci2(node: Rc<dyn Node>, seats: &mut SmallVec<[Rc<WlSeatGlobal>; 3]>) {
|
||||||
node.node_visit(&mut generic_node_visitor(|node| {
|
node.node_visit(&mut generic_node_visitor(|node| {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ use {
|
||||||
thiserror::Error,
|
thiserror::Error,
|
||||||
uapi::OwnedFd,
|
uapi::OwnedFd,
|
||||||
};
|
};
|
||||||
|
use crate::utils::oserror::OsError;
|
||||||
|
|
||||||
pub const REPEAT_INFO_SINCE: u32 = 4;
|
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)?;
|
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||||
self.seat.keyboards.remove(&self.id);
|
self.seat.keyboards.remove(&self.id);
|
||||||
self.seat.client.remove_obj(self)?;
|
self.seat.client.remove_obj(self)?;
|
||||||
|
|
@ -107,7 +108,7 @@ impl WlKeyboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlKeyboard, WlKeyboardError;
|
WlKeyboard;
|
||||||
|
|
||||||
RELEASE => release,
|
RELEASE => release,
|
||||||
}
|
}
|
||||||
|
|
@ -124,21 +125,12 @@ simple_add_obj!(WlKeyboard);
|
||||||
pub enum WlKeyboardError {
|
pub enum WlKeyboardError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process a `release` request")]
|
|
||||||
ReleaseError(#[from] ReleaseError),
|
|
||||||
#[error("Could not create a keymap memfd")]
|
#[error("Could not create a keymap memfd")]
|
||||||
KeymapMemfd(#[source] crate::utils::oserror::OsError),
|
KeymapMemfd(#[source] OsError),
|
||||||
#[error("Could not copy the keymap")]
|
#[error("Could not copy the keymap")]
|
||||||
KeymapCopy(#[source] crate::utils::oserror::OsError),
|
KeymapCopy(#[source] OsError),
|
||||||
}
|
|
||||||
efrom!(WlKeyboardError, ClientError, ClientError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum ReleaseError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
}
|
}
|
||||||
efrom!(ReleaseError, ParseError, MsgParserError);
|
efrom!(WlKeyboardError, ClientError);
|
||||||
efrom!(ReleaseError, ClientError, 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)?;
|
let req: SetCursor = self.seat.client.parse(self, parser)?;
|
||||||
if !self.seat.client.valid_serial(req.serial) {
|
if !self.seat.client.valid_serial(req.serial) {
|
||||||
log::warn!("Client tried to set_cursor with an invalid serial");
|
log::warn!("Client tried to set_cursor with an invalid serial");
|
||||||
|
|
@ -184,7 +184,7 @@ impl WlPointer {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlPointerError> {
|
||||||
let _req: Release = self.seat.client.parse(self, parser)?;
|
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||||
self.seat.pointers.remove(&self.id);
|
self.seat.pointers.remove(&self.id);
|
||||||
self.seat.client.remove_obj(self)?;
|
self.seat.client.remove_obj(self)?;
|
||||||
|
|
@ -193,7 +193,7 @@ impl WlPointer {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlPointer, WlPointerError;
|
WlPointer;
|
||||||
|
|
||||||
SET_CURSOR => set_cursor,
|
SET_CURSOR => set_cursor,
|
||||||
RELEASE => release,
|
RELEASE => release,
|
||||||
|
|
@ -211,32 +211,11 @@ simple_add_obj!(WlPointer);
|
||||||
pub enum WlPointerError {
|
pub enum WlPointerError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
WlSurfaceError(Box<WlSurfaceError>),
|
||||||
}
|
}
|
||||||
efrom!(SetCursorError, ParseError, MsgParserError);
|
efrom!(WlPointerError, ClientError);
|
||||||
efrom!(SetCursorError, ClientError);
|
efrom!(WlPointerError, MsgParserError);
|
||||||
efrom!(SetCursorError, WlSurfaceError);
|
efrom!(WlPointerError, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Release = self.seat.client.parse(self, parser)?;
|
||||||
self.seat.client.remove_obj(self)?;
|
self.seat.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -49,7 +49,7 @@ impl WlTouch {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlTouch, WlTouchError;
|
WlTouch;
|
||||||
|
|
||||||
RELEASE => release,
|
RELEASE => release,
|
||||||
}
|
}
|
||||||
|
|
@ -66,17 +66,8 @@ simple_add_obj!(WlTouch);
|
||||||
pub enum WlTouchError {
|
pub enum WlTouchError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process a `release` request")]
|
#[error("Parsing failed")]
|
||||||
ReleaseError(#[from] ReleaseError),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(WlTouchError, ClientError);
|
efrom!(WlTouchError, ClientError);
|
||||||
|
efrom!(WlTouchError, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@ impl WlShmGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WlShm {
|
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)?;
|
let create: CreatePool = self.client.parse(self, parser)?;
|
||||||
if create.size < 0 {
|
if create.size < 0 {
|
||||||
return Err(CreatePoolError::NegativeSize);
|
return Err(WlShmError::NegativeSize);
|
||||||
}
|
}
|
||||||
let pool = Rc::new(WlShmPool::new(
|
let pool = Rc::new(WlShmPool::new(
|
||||||
create.id,
|
create.id,
|
||||||
|
|
@ -86,7 +86,7 @@ impl Global for WlShmGlobal {
|
||||||
simple_add_global!(WlShmGlobal);
|
simple_add_global!(WlShmGlobal);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlShm, WlShmError;
|
WlShm;
|
||||||
|
|
||||||
CREATE_POOL => create_pool,
|
CREATE_POOL => create_pool,
|
||||||
}
|
}
|
||||||
|
|
@ -103,22 +103,13 @@ simple_add_obj!(WlShm);
|
||||||
pub enum WlShmError {
|
pub enum WlShmError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("The passed size is negative")]
|
#[error("The passed size is negative")]
|
||||||
NegativeSize,
|
NegativeSize,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlShmPoolError(Box<WlShmPoolError>),
|
WlShmPoolError(Box<WlShmPoolError>),
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
}
|
}
|
||||||
efrom!(CreatePoolError, ParseError, MsgParserError);
|
efrom!(WlShmError, ClientError);
|
||||||
efrom!(CreatePoolError, WlShmPoolError);
|
efrom!(WlShmError, MsgParserError);
|
||||||
efrom!(CreatePoolError, ClientError);
|
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 req: CreateBuffer = self.client.parse(self, parser)?;
|
||||||
let drm_format = map_wayland_format_id(req.format);
|
let drm_format = map_wayland_format_id(req.format);
|
||||||
let format = match formats().get(&drm_format) {
|
let format = match formats().get(&drm_format) {
|
||||||
Some(f) => *f,
|
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 {
|
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(
|
let buffer = Rc::new(WlBuffer::new_shm(
|
||||||
req.id,
|
req.id,
|
||||||
|
|
@ -66,19 +66,19 @@ impl WlShmPool {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmPoolError> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), ResizeError> {
|
fn resize(&self, parser: MsgParser<'_, '_>) -> Result<(), WlShmPoolError> {
|
||||||
let req: Resize = self.client.parse(self, parser)?;
|
let req: Resize = self.client.parse(self, parser)?;
|
||||||
if req.size < 0 {
|
if req.size < 0 {
|
||||||
return Err(ResizeError::NegativeSize);
|
return Err(WlShmPoolError::NegativeSize);
|
||||||
}
|
}
|
||||||
if (req.size as usize) < self.mem.get().len() {
|
if (req.size as usize) < self.mem.get().len() {
|
||||||
return Err(ResizeError::CannotShrink);
|
return Err(WlShmPoolError::CannotShrink);
|
||||||
}
|
}
|
||||||
self.mem
|
self.mem
|
||||||
.set(Rc::new(ClientMem::new(self.fd.raw(), req.size as usize)?));
|
.set(Rc::new(ClientMem::new(self.fd.raw(), req.size as usize)?));
|
||||||
|
|
@ -87,7 +87,7 @@ impl WlShmPool {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlShmPool, WlShmPoolError;
|
WlShmPool;
|
||||||
|
|
||||||
CREATE_BUFFER => create_buffer,
|
CREATE_BUFFER => create_buffer,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -106,24 +106,14 @@ simple_add_obj!(WlShmPool);
|
||||||
pub enum WlShmPoolError {
|
pub enum WlShmPoolError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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)]
|
#[error(transparent)]
|
||||||
ClientMemError(Box<ClientMemError>),
|
ClientMemError(Box<ClientMemError>),
|
||||||
}
|
|
||||||
efrom!(WlShmPoolError, ClientError);
|
|
||||||
efrom!(WlShmPoolError, ClientMemError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum CreateBufferError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error("Tried to shrink the pool")]
|
||||||
ClientError(Box<ClientError>),
|
CannotShrink,
|
||||||
|
#[error("Requested size is negative")]
|
||||||
|
NegativeSize,
|
||||||
#[error("Format {0} is not supported")]
|
#[error("Format {0} is not supported")]
|
||||||
InvalidFormat(u32),
|
InvalidFormat(u32),
|
||||||
#[error("All parameters in a create_buffer request must be non-negative")]
|
#[error("All parameters in a create_buffer request must be non-negative")]
|
||||||
|
|
@ -131,30 +121,7 @@ pub enum CreateBufferError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlBufferError(Box<WlBufferError>),
|
WlBufferError(Box<WlBufferError>),
|
||||||
}
|
}
|
||||||
efrom!(CreateBufferError, ParseError, MsgParserError);
|
efrom!(WlShmPoolError, ClientError);
|
||||||
efrom!(CreateBufferError, ClientError);
|
efrom!(WlShmPoolError, ClientMemError);
|
||||||
efrom!(CreateBufferError, WlBufferError);
|
efrom!(WlShmPoolError, WlBufferError);
|
||||||
|
efrom!(WlShmPoolError, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -48,13 +48,13 @@ impl WlSubcompositorGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WlSubcompositor {
|
impl WlSubcompositor {
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubcompositorError> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
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 req: GetSubsurface = self.client.parse(self, parser)?;
|
||||||
let surface = self.client.lookup(req.surface)?;
|
let surface = self.client.lookup(req.surface)?;
|
||||||
let parent = self.client.lookup(req.parent)?;
|
let parent = self.client.lookup(req.parent)?;
|
||||||
|
|
@ -81,7 +81,7 @@ impl Global for WlSubcompositorGlobal {
|
||||||
simple_add_global!(WlSubcompositorGlobal);
|
simple_add_global!(WlSubcompositorGlobal);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlSubcompositor, WlSubcompositorError;
|
WlSubcompositor;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
GET_SUBSURFACE => get_subsurface,
|
GET_SUBSURFACE => get_subsurface,
|
||||||
|
|
@ -99,32 +99,11 @@ simple_add_obj!(WlSubcompositor);
|
||||||
pub enum WlSubcompositorError {
|
pub enum WlSubcompositorError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process `destroy` request")]
|
#[error("Parsing failed")]
|
||||||
DestroyError(#[from] DestroyError),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Could not process `get_subsurface` request")]
|
#[error(transparent)]
|
||||||
GetSubsurfaceError(#[from] GetSubsurfaceError),
|
WlSubsurfaceError(Box<WlSubsurfaceError>),
|
||||||
}
|
}
|
||||||
efrom!(WlSubcompositorError, ClientError);
|
efrom!(WlSubcompositorError, ClientError);
|
||||||
|
efrom!(WlSubcompositorError, MsgParserError);
|
||||||
#[derive(Debug, Error)]
|
efrom!(WlSubcompositorError, WlSubsurfaceError);
|
||||||
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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Destroy = self.parse(parser)?;
|
||||||
self.unset_dnd_icons();
|
self.unset_dnd_icons();
|
||||||
self.unset_cursors();
|
self.unset_cursors();
|
||||||
|
|
@ -402,7 +402,7 @@ impl WlSurface {
|
||||||
Ok(())
|
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 req: Attach = self.parse(parser)?;
|
||||||
let buf = if req.buffer.is_some() {
|
let buf = if req.buffer.is_some() {
|
||||||
Some((req.x, req.y, self.client.lookup(req.buffer)?))
|
Some((req.x, req.y, self.client.lookup(req.buffer)?))
|
||||||
|
|
@ -413,13 +413,13 @@ impl WlSurface {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn damage(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageError> {
|
fn damage(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||||
let _req: Damage = self.parse(parser)?;
|
let _req: Damage = self.parse(parser)?;
|
||||||
self.pending.damage.set(true);
|
self.pending.damage.set(true);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn frame(&self, parser: MsgParser<'_, '_>) -> Result<(), FrameError> {
|
fn frame(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||||
let req: Frame = self.parse(parser)?;
|
let req: Frame = self.parse(parser)?;
|
||||||
let cb = Rc::new(WlCallback::new(req.callback, &self.client));
|
let cb = Rc::new(WlCallback::new(req.callback, &self.client));
|
||||||
track!(self.client, cb);
|
track!(self.client, cb);
|
||||||
|
|
@ -428,7 +428,7 @@ impl WlSurface {
|
||||||
Ok(())
|
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: SetOpaqueRegion = self.parse(parser)?;
|
||||||
let region = if region.region.is_some() {
|
let region = if region.region.is_some() {
|
||||||
Some(self.client.lookup(region.region)?.region())
|
Some(self.client.lookup(region.region)?.region())
|
||||||
|
|
@ -439,7 +439,7 @@ impl WlSurface {
|
||||||
Ok(())
|
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 req: SetInputRegion = self.parse(parser)?;
|
||||||
let region = if req.region.is_some() {
|
let region = if req.region.is_some() {
|
||||||
Some(self.client.lookup(req.region)?.region())
|
Some(self.client.lookup(req.region)?.region())
|
||||||
|
|
@ -533,7 +533,7 @@ impl WlSurface {
|
||||||
Ok(())
|
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)?;
|
let _req: Commit = self.parse(parser)?;
|
||||||
self.do_commit(CommitContext::RootCommit)?;
|
self.do_commit(CommitContext::RootCommit)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -542,17 +542,17 @@ impl WlSurface {
|
||||||
fn set_buffer_transform(
|
fn set_buffer_transform(
|
||||||
&self,
|
&self,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), SetBufferTransformError> {
|
) -> Result<(), WlSurfaceError> {
|
||||||
let _req: SetBufferTransform = self.parse(parser)?;
|
let _req: SetBufferTransform = self.parse(parser)?;
|
||||||
Ok(())
|
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)?;
|
let _req: SetBufferScale = self.parse(parser)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn damage_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), DamageBufferError> {
|
fn damage_buffer(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSurfaceError> {
|
||||||
let _req: DamageBuffer = self.parse(parser)?;
|
let _req: DamageBuffer = self.parse(parser)?;
|
||||||
self.pending.damage.set(true);
|
self.pending.damage.set(true);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -670,7 +670,7 @@ impl WlSurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlSurface, WlSurfaceError;
|
WlSurface;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
ATTACH => attach,
|
ATTACH => attach,
|
||||||
|
|
@ -832,26 +832,6 @@ pub enum WlSurfaceError {
|
||||||
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
XdgSurfaceError(Box<XdgSurfaceError>),
|
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())]
|
#[error("Surface {} cannot be assigned the role {} because it already has the role {}", .id, .new.name(), .old.name())]
|
||||||
IncompatibleRole {
|
IncompatibleRole {
|
||||||
id: WlSurfaceId,
|
id: WlSurfaceId,
|
||||||
|
|
@ -860,111 +840,10 @@ pub enum WlSurfaceError {
|
||||||
},
|
},
|
||||||
#[error("Cannot destroy a `wl_surface` before its role object")]
|
#[error("Cannot destroy a `wl_surface` before its role object")]
|
||||||
ReloObjectStillExists,
|
ReloObjectStillExists,
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(WlSurfaceError, ClientError);
|
efrom!(WlSurfaceError, ClientError);
|
||||||
efrom!(WlSurfaceError, XdgSurfaceError);
|
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);
|
efrom!(WlSurfaceError, ZwlrLayerSurfaceV1Error);
|
||||||
|
efrom!(WlSurfaceError, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ impl WlSubsurface {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlSubsurfaceError> {
|
||||||
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
||||||
self.surface.unset_ext();
|
self.surface.unset_ext();
|
||||||
*self.node.borrow_mut() = None;
|
*self.node.borrow_mut() = None;
|
||||||
|
|
@ -160,15 +160,15 @@ impl WlSubsurface {
|
||||||
Ok(())
|
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)?;
|
let req: SetPosition = self.surface.client.parse(self, parser)?;
|
||||||
self.pending.position.set(Some((req.x, req.y)));
|
self.pending.position.set(Some((req.x, req.y)));
|
||||||
Ok(())
|
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 {
|
if sibling == self.surface.id {
|
||||||
return Err(PlacementError::AboveSelf(sibling));
|
return Err(WlSubsurfaceError::AboveSelf(sibling));
|
||||||
}
|
}
|
||||||
let pdata = self.parent.children.borrow();
|
let pdata = self.parent.children.borrow();
|
||||||
if let Some(pdata) = &*pdata {
|
if let Some(pdata) = &*pdata {
|
||||||
|
|
@ -184,7 +184,7 @@ impl WlSubsurface {
|
||||||
} else {
|
} else {
|
||||||
let sibling = match pdata.subsurfaces.get(&sibling) {
|
let sibling = match pdata.subsurfaces.get(&sibling) {
|
||||||
Some(s) => s,
|
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() {
|
let node = match sibling.pending.node.borrow().deref() {
|
||||||
Some(n) => n.to_ref(),
|
Some(n) => n.to_ref(),
|
||||||
|
|
@ -203,13 +203,13 @@ impl WlSubsurface {
|
||||||
Ok(())
|
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)?;
|
let req: PlaceAbove = self.surface.client.parse(self.deref(), parser)?;
|
||||||
self.place(req.sibling, true)?;
|
self.place(req.sibling, true)?;
|
||||||
Ok(())
|
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)?;
|
let req: PlaceBelow = self.surface.client.parse(self.deref(), parser)?;
|
||||||
self.place(req.sibling, false)?;
|
self.place(req.sibling, false)?;
|
||||||
Ok(())
|
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)?;
|
let _req: SetSync = self.surface.client.parse(self, parser)?;
|
||||||
self.update_sync(true);
|
self.update_sync(true);
|
||||||
Ok(())
|
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)?;
|
let _req: SetDesync = self.surface.client.parse(self, parser)?;
|
||||||
self.update_sync(false);
|
self.update_sync(false);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -242,7 +242,7 @@ impl WlSubsurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
WlSubsurface, WlSubsurfaceError;
|
WlSubsurface;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
SET_POSITION => set_position,
|
SET_POSITION => set_position,
|
||||||
|
|
@ -303,18 +303,6 @@ impl SurfaceExt for WlSubsurface {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum WlSubsurfaceError {
|
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`")]
|
#[error("Surface {0} already has an attached `wl_subsurface`")]
|
||||||
AlreadyAttached(WlSurfaceId),
|
AlreadyAttached(WlSurfaceId),
|
||||||
#[error("Surface {0} cannot be made its own parent")]
|
#[error("Surface {0} cannot be made its own parent")]
|
||||||
|
|
@ -325,62 +313,15 @@ pub enum WlSubsurfaceError {
|
||||||
MaxDepthExceeded,
|
MaxDepthExceeded,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
WlSurfaceError(Box<WlSurfaceError>),
|
||||||
}
|
|
||||||
efrom!(WlSubsurfaceError, WlSurfaceError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
|
||||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
|
||||||
efrom!(DestroyError, ClientError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum SetPositionError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[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 {
|
|
||||||
#[error("Cannot place {0} above/below itself")]
|
#[error("Cannot place {0} above/below itself")]
|
||||||
AboveSelf(WlSurfaceId),
|
AboveSelf(WlSurfaceId),
|
||||||
#[error("{0} is not a sibling of {1}")]
|
#[error("{0} is not a sibling of {1}")]
|
||||||
NotASibling(WlSurfaceId, WlSurfaceId),
|
NotASibling(WlSurfaceId, WlSurfaceId),
|
||||||
}
|
}
|
||||||
|
efrom!(WlSubsurfaceError, WlSurfaceError);
|
||||||
#[derive(Debug, Error)]
|
efrom!(WlSubsurfaceError, MsgParserError);
|
||||||
pub enum PlaceBelowError {
|
efrom!(WlSubsurfaceError, ClientError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -181,15 +181,15 @@ impl XdgSurface {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgSurfaceError> {
|
||||||
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
let _req: Destroy = self.surface.client.parse(self, parser)?;
|
||||||
if self.ext.get().is_some() {
|
if self.ext.get().is_some() {
|
||||||
return Err(DestroyError::RoleNotYetDestroyed(self.id));
|
return Err(XdgSurfaceError::RoleNotYetDestroyed(self.id));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let children = self.popups.lock();
|
let children = self.popups.lock();
|
||||||
if !children.is_empty() {
|
if !children.is_empty() {
|
||||||
return Err(DestroyError::PopupsNotYetDestroyed);
|
return Err(XdgSurfaceError::PopupsNotYetDestroyed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.surface.unset_ext();
|
self.surface.unset_ext();
|
||||||
|
|
@ -198,7 +198,7 @@ impl XdgSurface {
|
||||||
Ok(())
|
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)?;
|
let req: GetToplevel = self.surface.client.parse(&**self, parser)?;
|
||||||
self.set_role(XdgSurfaceRole::XdgToplevel)?;
|
self.set_role(XdgSurfaceRole::XdgToplevel)?;
|
||||||
if self.ext.get().is_some() {
|
if self.ext.get().is_some() {
|
||||||
|
|
@ -210,7 +210,7 @@ impl XdgSurface {
|
||||||
self.surface.id
|
self.surface.id
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Err(GetToplevelError::AlreadyConstructed);
|
return Err(XdgSurfaceError::AlreadyConstructed);
|
||||||
}
|
}
|
||||||
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
|
let toplevel = Rc::new(XdgToplevel::new(req.id, self));
|
||||||
track!(self.surface.client, toplevel);
|
track!(self.surface.client, toplevel);
|
||||||
|
|
@ -220,7 +220,7 @@ impl XdgSurface {
|
||||||
Ok(())
|
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)?;
|
let req: GetPopup = self.surface.client.parse(&**self, parser)?;
|
||||||
self.set_role(XdgSurfaceRole::XdgPopup)?;
|
self.set_role(XdgSurfaceRole::XdgPopup)?;
|
||||||
let mut parent = None;
|
let mut parent = None;
|
||||||
|
|
@ -237,7 +237,7 @@ impl XdgSurface {
|
||||||
self.surface.id
|
self.surface.id
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Err(GetPopupError::AlreadyConstructed);
|
return Err(XdgSurfaceError::AlreadyConstructed);
|
||||||
}
|
}
|
||||||
let popup = Rc::new(XdgPopup::new(req.id, self, parent.as_ref(), &positioner)?);
|
let popup = Rc::new(XdgPopup::new(req.id, self, parent.as_ref(), &positioner)?);
|
||||||
track!(self.surface.client, popup);
|
track!(self.surface.client, popup);
|
||||||
|
|
@ -249,17 +249,17 @@ impl XdgSurface {
|
||||||
Ok(())
|
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)?;
|
let req: SetWindowGeometry = self.surface.client.parse(self, parser)?;
|
||||||
if req.height <= 0 || req.width <= 0 {
|
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();
|
let extents = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
||||||
self.pending.geometry.set(Some(extents));
|
self.pending.geometry.set(Some(extents));
|
||||||
Ok(())
|
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)?;
|
let req: AckConfigure = self.surface.client.parse(self, parser)?;
|
||||||
if self.requested_serial.get() == req.serial {
|
if self.requested_serial.get() == req.serial {
|
||||||
self.acked_serial.set(Some(req.serial));
|
self.acked_serial.set(Some(req.serial));
|
||||||
|
|
@ -306,7 +306,7 @@ impl XdgSurface {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
XdgSurface, XdgSurfaceError;
|
XdgSurface;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
GET_TOPLEVEL => get_toplevel,
|
GET_TOPLEVEL => get_toplevel,
|
||||||
|
|
@ -368,21 +368,9 @@ impl SurfaceExt for XdgSurface {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum XdgSurfaceError {
|
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")]
|
#[error("Surface {0} cannot be turned into a xdg_surface because it already has an attached xdg_surface")]
|
||||||
AlreadyAttached(WlSurfaceId),
|
AlreadyAttached(WlSurfaceId),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
|
||||||
#[error(transparent)]
|
|
||||||
XdgPopupError(#[from] XdgPopupError),
|
XdgPopupError(#[from] XdgPopupError),
|
||||||
#[error("Surface {} cannot be assigned the role {} because it already has the role {}", .id, .new.name(), .old.name())]
|
#[error("Surface {} cannot be assigned the role {} because it already has the role {}", .id, .new.name(), .old.name())]
|
||||||
IncompatibleRole {
|
IncompatibleRole {
|
||||||
|
|
@ -390,80 +378,21 @@ pub enum XdgSurfaceError {
|
||||||
old: XdgSurfaceRole,
|
old: XdgSurfaceRole,
|
||||||
new: XdgSurfaceRole,
|
new: XdgSurfaceRole,
|
||||||
},
|
},
|
||||||
}
|
|
||||||
efrom!(XdgSurfaceError, WlSurfaceError);
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Cannot destroy xdg_surface {0} because it's associated xdg_toplevel/popup is not yet destroyed")]
|
||||||
RoleNotYetDestroyed(XdgSurfaceId),
|
RoleNotYetDestroyed(XdgSurfaceId),
|
||||||
#[error("The surface still has popups attached")]
|
#[error("The surface still has popups attached")]
|
||||||
PopupsNotYetDestroyed,
|
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")]
|
#[error("The surface already has an assigned xdg_toplevel")]
|
||||||
AlreadyConstructed,
|
AlreadyConstructed,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
WlSurfaceError(Box<WlSurfaceError>),
|
||||||
#[error(transparent)]
|
|
||||||
XdgSurfaceError(Box<XdgSurfaceError>),
|
|
||||||
}
|
}
|
||||||
efrom!(GetToplevelError, ParseFailed, MsgParserError);
|
efrom!(XdgSurfaceError, WlSurfaceError);
|
||||||
efrom!(GetToplevelError, ClientError);
|
efrom!(XdgSurfaceError, ClientError);
|
||||||
efrom!(GetToplevelError, WlSurfaceError);
|
efrom!(XdgSurfaceError, MsgParserError);
|
||||||
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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Destroy = self.xdg.surface.client.parse(self, parser)?;
|
||||||
self.destroy_node();
|
self.destroy_node();
|
||||||
{
|
{
|
||||||
|
|
@ -216,12 +216,12 @@ impl XdgPopup {
|
||||||
Ok(())
|
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)?;
|
let _req: Grab = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
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)?;
|
let req: Reposition = self.xdg.surface.client.parse(&**self, parser)?;
|
||||||
*self.pos.borrow_mut() = self.xdg.surface.client.lookup(req.positioner)?.value();
|
*self.pos.borrow_mut() = self.xdg.surface.client.lookup(req.positioner)?.value();
|
||||||
if let Some(parent) = self.parent.get() {
|
if let Some(parent) = self.parent.get() {
|
||||||
|
|
@ -253,7 +253,7 @@ impl XdgPopup {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
XdgPopup, XdgPopupError;
|
XdgPopup;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
GRAB => grab,
|
GRAB => grab,
|
||||||
|
|
@ -386,48 +386,12 @@ impl XdgSurfaceExt for XdgPopup {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum XdgPopupError {
|
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")]
|
#[error("The `xdg_positioner` is incomplete")]
|
||||||
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")]
|
#[error("Parsing failed")]
|
||||||
ParseFailed(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
efrom!(XdgPopupError, MsgParserError);
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(XdgPopupError, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Destroy = self.xdg.surface.client.parse(self.deref(), parser)?;
|
||||||
self.tl_destroy();
|
self.tl_destroy();
|
||||||
self.xdg.ext.set(None);
|
self.xdg.ext.set(None);
|
||||||
|
|
@ -193,7 +193,7 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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 req: SetParent = self.xdg.surface.client.parse(self, parser)?;
|
||||||
let mut parent = None;
|
let mut parent = None;
|
||||||
if req.parent.is_some() {
|
if req.parent.is_some() {
|
||||||
|
|
@ -203,25 +203,25 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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)?;
|
let req: SetTitle = self.xdg.surface.client.parse(self, parser)?;
|
||||||
*self.toplevel_data.title.borrow_mut() = req.title.to_string();
|
*self.toplevel_data.title.borrow_mut() = req.title.to_string();
|
||||||
self.tl_title_changed();
|
self.tl_title_changed();
|
||||||
Ok(())
|
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)?;
|
let req: SetAppId = self.xdg.surface.client.parse(self, parser)?;
|
||||||
self.bugs.set(bugs::get(req.app_id));
|
self.bugs.set(bugs::get(req.app_id));
|
||||||
Ok(())
|
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)?;
|
let _req: ShowWindowMenu = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
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 req: Move = self.xdg.surface.client.parse(self, parser)?;
|
||||||
let seat = self.xdg.surface.client.lookup(req.seat)?;
|
let seat = self.xdg.surface.client.lookup(req.seat)?;
|
||||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
if let Some(parent) = self.toplevel_data.parent.get() {
|
||||||
|
|
@ -232,15 +232,15 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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)?;
|
let _req: Resize = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
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)?;
|
let req: SetMaxSize = self.xdg.surface.client.parse(self, parser)?;
|
||||||
if req.height < 0 || req.width < 0 {
|
if req.height < 0 || req.width < 0 {
|
||||||
return Err(SetMaxSizeError::NonNegative);
|
return Err(XdgToplevelError::NonNegative);
|
||||||
}
|
}
|
||||||
self.max_width.set(if req.width == 0 {
|
self.max_width.set(if req.width == 0 {
|
||||||
None
|
None
|
||||||
|
|
@ -255,10 +255,10 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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)?;
|
let req: SetMinSize = self.xdg.surface.client.parse(self, parser)?;
|
||||||
if req.height < 0 || req.width < 0 {
|
if req.height < 0 || req.width < 0 {
|
||||||
return Err(SetMinSizeError::NonNegative);
|
return Err(XdgToplevelError::NonNegative);
|
||||||
}
|
}
|
||||||
self.min_width.set(if req.width == 0 {
|
self.min_width.set(if req.width == 0 {
|
||||||
None
|
None
|
||||||
|
|
@ -273,12 +273,12 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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)?;
|
let _req: SetMaximized = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
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)?;
|
let _req: UnsetMaximized = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -286,7 +286,7 @@ impl XdgToplevel {
|
||||||
fn set_fullscreen(
|
fn set_fullscreen(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), SetFullscreenError> {
|
) -> Result<(), XdgToplevelError> {
|
||||||
let client = &self.xdg.surface.client;
|
let client = &self.xdg.surface.client;
|
||||||
let req: SetFullscreen = client.parse(self.deref(), parser)?;
|
let req: SetFullscreen = client.parse(self.deref(), parser)?;
|
||||||
self.states.borrow_mut().insert(STATE_FULLSCREEN);
|
self.states.borrow_mut().insert(STATE_FULLSCREEN);
|
||||||
|
|
@ -314,7 +314,7 @@ impl XdgToplevel {
|
||||||
fn unset_fullscreen(
|
fn unset_fullscreen(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), UnsetFullscreenError> {
|
) -> Result<(), XdgToplevelError> {
|
||||||
let _req: UnsetFullscreen = self.xdg.surface.client.parse(self.deref(), parser)?;
|
let _req: UnsetFullscreen = self.xdg.surface.client.parse(self.deref(), parser)?;
|
||||||
self.states.borrow_mut().remove(&STATE_FULLSCREEN);
|
self.states.borrow_mut().remove(&STATE_FULLSCREEN);
|
||||||
self.toplevel_data
|
self.toplevel_data
|
||||||
|
|
@ -323,7 +323,7 @@ impl XdgToplevel {
|
||||||
Ok(())
|
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)?;
|
let _req: SetMinimized = self.xdg.surface.client.parse(self, parser)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ impl XdgToplevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
XdgToplevel, XdgToplevelError;
|
XdgToplevel;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
SET_PARENT => set_parent,
|
SET_PARENT => set_parent,
|
||||||
|
|
@ -576,176 +576,12 @@ impl XdgSurfaceExt for XdgToplevel {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum XdgToplevelError {
|
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")]
|
#[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 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>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("width/height must be non-negative")]
|
#[error("width/height must be non-negative")]
|
||||||
NonNegative,
|
NonNegative,
|
||||||
}
|
}
|
||||||
efrom!(SetMaxSizeError, ParseFailed, MsgParserError);
|
efrom!(XdgToplevelError, MsgParserError);
|
||||||
efrom!(SetMaxSizeError, ClientError);
|
efrom!(XdgToplevelError, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -130,10 +130,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
self.client.event(Closed { self_id: self.id });
|
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)?;
|
let req: SetSize = self.client.parse(self, parser)?;
|
||||||
if req.width > u16::MAX as u32 || req.height > u16::MAX as u32 {
|
if req.width > u16::MAX as u32 || req.height > u16::MAX as u32 {
|
||||||
return Err(SetSizeError::ExcessiveSize);
|
return Err(ZwlrLayerSurfaceV1Error::ExcessiveSize);
|
||||||
}
|
}
|
||||||
self.pending
|
self.pending
|
||||||
.size
|
.size
|
||||||
|
|
@ -142,24 +142,24 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
Ok(())
|
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)?;
|
let req: SetAnchor = self.client.parse(self, parser)?;
|
||||||
if req.anchor & !(LEFT | RIGHT | TOP | BOTTOM) != 0 {
|
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.anchor.set(Some(req.anchor));
|
||||||
self.pending.any.set(true);
|
self.pending.any.set(true);
|
||||||
Ok(())
|
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)?;
|
let req: SetExclusiveZone = self.client.parse(self, parser)?;
|
||||||
self.pending.exclusive_zone.set(Some(req.zone));
|
self.pending.exclusive_zone.set(Some(req.zone));
|
||||||
self.pending.any.set(true);
|
self.pending.any.set(true);
|
||||||
Ok(())
|
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)?;
|
let req: SetMargin = self.client.parse(self, parser)?;
|
||||||
self.pending
|
self.pending
|
||||||
.margin
|
.margin
|
||||||
|
|
@ -171,10 +171,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
fn set_keyboard_interactivity(
|
fn set_keyboard_interactivity(
|
||||||
&self,
|
&self,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), SetKeyboardInteractivityError> {
|
) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let req: SetKeyboardInteractivity = self.client.parse(self, parser)?;
|
let req: SetKeyboardInteractivity = self.client.parse(self, parser)?;
|
||||||
if req.keyboard_interactivity > KI_ON_DEMAND {
|
if req.keyboard_interactivity > KI_ON_DEMAND {
|
||||||
return Err(SetKeyboardInteractivityError::UnknownKi(
|
return Err(ZwlrLayerSurfaceV1Error::UnknownKi(
|
||||||
req.keyboard_interactivity,
|
req.keyboard_interactivity,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
@ -185,18 +185,18 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
Ok(())
|
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)?;
|
let _req: GetPopup = self.client.parse(self, parser)?;
|
||||||
Ok(())
|
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)?;
|
let req: AckConfigure = self.client.parse(self, parser)?;
|
||||||
self.acked_serial.set(Some(req.serial));
|
self.acked_serial.set(Some(req.serial));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.destroy_node();
|
self.destroy_node();
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
|
|
@ -204,10 +204,10 @@ impl ZwlrLayerSurfaceV1 {
|
||||||
Ok(())
|
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)?;
|
let req: SetLayer = self.client.parse(self, parser)?;
|
||||||
if req.layer > OVERLAY {
|
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.layer.set(Some(req.layer));
|
||||||
self.pending.any.set(true);
|
self.pending.any.set(true);
|
||||||
|
|
@ -396,7 +396,7 @@ impl Node for ZwlrLayerSurfaceV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwlrLayerSurfaceV1, ZwlrLayerSurfaceV1Error;
|
ZwlrLayerSurfaceV1;
|
||||||
|
|
||||||
SET_SIZE => set_size,
|
SET_SIZE => set_size,
|
||||||
SET_ANCHOR => set_anchor,
|
SET_ANCHOR => set_anchor,
|
||||||
|
|
@ -428,24 +428,6 @@ simple_add_obj!(ZwlrLayerSurfaceV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwlrLayerSurfaceV1Error {
|
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")]
|
#[error("Surface {0} cannot be turned into a zwlr_layer_surface because it already has an attached zwlr_layer_surface")]
|
||||||
AlreadyAttached(WlSurfaceId),
|
AlreadyAttached(WlSurfaceId),
|
||||||
#[error("Width was set to 0 but anchor did not contain LEFT and RIGHT")]
|
#[error("Width was set to 0 but anchor did not contain LEFT and RIGHT")]
|
||||||
|
|
@ -454,103 +436,19 @@ pub enum ZwlrLayerSurfaceV1Error {
|
||||||
HeightZero,
|
HeightZero,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
WlSurfaceError(Box<WlSurfaceError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
MsgParserError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Unknown layer {0}")]
|
#[error("Unknown layer {0}")]
|
||||||
UnknownLayer(u32),
|
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!(ZwlrLayerSurfaceV1Error, WlSurfaceError);
|
||||||
efrom!(SetLayerError, ClientError);
|
efrom!(ZwlrLayerSurfaceV1Error, MsgParserError);
|
||||||
|
efrom!(ZwlrLayerSurfaceV1Error, ClientError);
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ impl ZwpIdleInhibitorV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
ZwpIdleInhibitorV1;
|
ZwpIdleInhibitorV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ impl WpPresentation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
WpPresentation;
|
WpPresentation;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ impl WpPresentationFeedback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
WpPresentationFeedback;
|
WpPresentationFeedback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,13 +157,13 @@ impl XdgPositioner {
|
||||||
*self.position.borrow()
|
*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)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
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)?;
|
let req: SetSize = self.client.parse(self, parser)?;
|
||||||
if req.width <= 0 || req.height <= 0 {
|
if req.width <= 0 || req.height <= 0 {
|
||||||
self.client.protocol_error(
|
self.client.protocol_error(
|
||||||
|
|
@ -171,7 +171,7 @@ impl XdgPositioner {
|
||||||
INVALID_INPUT,
|
INVALID_INPUT,
|
||||||
&format!("Cannot set a non-positive size"),
|
&format!("Cannot set a non-positive size"),
|
||||||
);
|
);
|
||||||
return Err(SetSizeError::NonPositiveSize);
|
return Err(XdgPositionerError::NonPositiveSize);
|
||||||
}
|
}
|
||||||
let mut position = self.position.borrow_mut();
|
let mut position = self.position.borrow_mut();
|
||||||
position.size_width = req.width;
|
position.size_width = req.width;
|
||||||
|
|
@ -179,7 +179,7 @@ impl XdgPositioner {
|
||||||
Ok(())
|
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)?;
|
let req: SetAnchorRect = self.client.parse(self, parser)?;
|
||||||
if req.width < 0 || req.height < 0 {
|
if req.width < 0 || req.height < 0 {
|
||||||
self.client.protocol_error(
|
self.client.protocol_error(
|
||||||
|
|
@ -187,28 +187,28 @@ impl XdgPositioner {
|
||||||
INVALID_INPUT,
|
INVALID_INPUT,
|
||||||
&format!("Cannot set an anchor rect with negative size"),
|
&format!("Cannot set an anchor rect with negative size"),
|
||||||
);
|
);
|
||||||
return Err(SetAnchorRectError::NegativeAnchorRect);
|
return Err(XdgPositionerError::NegativeAnchorRect);
|
||||||
}
|
}
|
||||||
let mut position = self.position.borrow_mut();
|
let mut position = self.position.borrow_mut();
|
||||||
position.ar = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
position.ar = Rect::new_sized(req.x, req.y, req.width, req.height).unwrap();
|
||||||
Ok(())
|
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 req: SetAnchor = self.client.parse(self, parser)?;
|
||||||
let anchor = match Edge::from_enum(req.anchor) {
|
let anchor = match Edge::from_enum(req.anchor) {
|
||||||
Some(a) => a,
|
Some(a) => a,
|
||||||
_ => return Err(SetAnchorError::UnknownAnchor(req.anchor)),
|
_ => return Err(XdgPositionerError::UnknownAnchor(req.anchor)),
|
||||||
};
|
};
|
||||||
self.position.borrow_mut().anchor = anchor;
|
self.position.borrow_mut().anchor = anchor;
|
||||||
Ok(())
|
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 req: SetGravity = self.client.parse(self, parser)?;
|
||||||
let gravity = match Edge::from_enum(req.gravity) {
|
let gravity = match Edge::from_enum(req.gravity) {
|
||||||
Some(a) => a,
|
Some(a) => a,
|
||||||
_ => return Err(SetGravityError::UnknownGravity(req.gravity)),
|
_ => return Err(XdgPositionerError::UnknownGravity(req.gravity)),
|
||||||
};
|
};
|
||||||
self.position.borrow_mut().gravity = gravity;
|
self.position.borrow_mut().gravity = gravity;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -217,12 +217,12 @@ impl XdgPositioner {
|
||||||
fn set_constraint_adjustment(
|
fn set_constraint_adjustment(
|
||||||
&self,
|
&self,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), SetConstraintAdjustmentError> {
|
) -> Result<(), XdgPositionerError> {
|
||||||
let req: SetConstraintAdjustment = self.client.parse(self, parser)?;
|
let req: SetConstraintAdjustment = self.client.parse(self, parser)?;
|
||||||
let ca = match CA::from_bits(req.constraint_adjustment) {
|
let ca = match CA::from_bits(req.constraint_adjustment) {
|
||||||
Some(c) => c,
|
Some(c) => c,
|
||||||
_ => {
|
_ => {
|
||||||
return Err(SetConstraintAdjustmentError::UnknownCa(
|
return Err(XdgPositionerError::UnknownCa(
|
||||||
req.constraint_adjustment,
|
req.constraint_adjustment,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
@ -231,7 +231,7 @@ impl XdgPositioner {
|
||||||
Ok(())
|
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 req: SetOffset = self.client.parse(self, parser)?;
|
||||||
let mut position = self.position.borrow_mut();
|
let mut position = self.position.borrow_mut();
|
||||||
position.off_x = req.x;
|
position.off_x = req.x;
|
||||||
|
|
@ -239,13 +239,13 @@ impl XdgPositioner {
|
||||||
Ok(())
|
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)?;
|
let _req: SetReactive = self.client.parse(self, parser)?;
|
||||||
self.position.borrow_mut().reactive = true;
|
self.position.borrow_mut().reactive = true;
|
||||||
Ok(())
|
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)?;
|
let req: SetParentSize = self.client.parse(self, parser)?;
|
||||||
if req.parent_width < 0 || req.parent_height < 0 {
|
if req.parent_width < 0 || req.parent_height < 0 {
|
||||||
self.client.protocol_error(
|
self.client.protocol_error(
|
||||||
|
|
@ -253,7 +253,7 @@ impl XdgPositioner {
|
||||||
INVALID_INPUT,
|
INVALID_INPUT,
|
||||||
&format!("Cannot set a negative parent size"),
|
&format!("Cannot set a negative parent size"),
|
||||||
);
|
);
|
||||||
return Err(SetParentSizeError::NegativeParentSize);
|
return Err(XdgPositionerError::NegativeParentSize);
|
||||||
}
|
}
|
||||||
let mut position = self.position.borrow_mut();
|
let mut position = self.position.borrow_mut();
|
||||||
position.parent_width = req.parent_width;
|
position.parent_width = req.parent_width;
|
||||||
|
|
@ -264,7 +264,7 @@ impl XdgPositioner {
|
||||||
fn set_parent_configure(
|
fn set_parent_configure(
|
||||||
&self,
|
&self,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), SetParentConfigureError> {
|
) -> Result<(), XdgPositionerError> {
|
||||||
let req: SetParentConfigure = self.client.parse(self, parser)?;
|
let req: SetParentConfigure = self.client.parse(self, parser)?;
|
||||||
self.position.borrow_mut().parent_serial = req.serial;
|
self.position.borrow_mut().parent_serial = req.serial;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -272,7 +272,7 @@ impl XdgPositioner {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
XdgPositioner, XdgPositionerError;
|
XdgPositioner;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
SET_SIZE => set_size,
|
SET_SIZE => set_size,
|
||||||
|
|
@ -300,109 +300,22 @@ dedicated_add_obj!(XdgPositioner, XdgPositionerId, xdg_positioners);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum XdgPositionerError {
|
pub enum XdgPositionerError {
|
||||||
#[error("Could not process a `destroy` request")]
|
#[error("Cannot set a non-positive size")]
|
||||||
DestroyError(#[from] DestroyError),
|
NonPositiveSize,
|
||||||
#[error("Could not process a `set_size` request")]
|
#[error("Cannot set an anchor rect with a negative size")]
|
||||||
SetSizeError(#[from] SetSizeError),
|
NegativeAnchorRect,
|
||||||
#[error("Could not process a `set_anchor_rect` request")]
|
#[error("Unknown anchor {0}")]
|
||||||
SetAnchorRectError(#[from] SetAnchorRectError),
|
UnknownAnchor(u32),
|
||||||
#[error("Could not process a `set_anchor` request")]
|
#[error("Unknown gravity {0}")]
|
||||||
SetAnchorError(#[from] SetAnchorError),
|
UnknownGravity(u32),
|
||||||
#[error("Could not process a `set_gravity` request")]
|
#[error("Unknown constraint adjustment {0}")]
|
||||||
SetGravityError(#[from] SetGravityError),
|
UnknownCa(u32),
|
||||||
#[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("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
|
#[error("Cannot set a negative parent size")]
|
||||||
|
NegativeParentSize,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, ParseError, MsgParserError);
|
efrom!(XdgPositionerError, MsgParserError);
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(XdgPositionerError, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ impl XdgWmBaseGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl XdgWmBase {
|
impl XdgWmBase {
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgWmBaseError> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
if !self.surfaces.is_empty() {
|
if !self.surfaces.is_empty() {
|
||||||
self.client.protocol_error(
|
self.client.protocol_error(
|
||||||
|
|
@ -78,7 +78,7 @@ impl XdgWmBase {
|
||||||
self.id
|
self.id
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return Err(DestroyError::DefunctSurfaces);
|
return Err(XdgWmBaseError::DefunctSurfaces);
|
||||||
}
|
}
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -87,7 +87,7 @@ impl XdgWmBase {
|
||||||
fn create_positioner(
|
fn create_positioner(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), CreatePositionerError> {
|
) -> Result<(), XdgWmBaseError> {
|
||||||
let req: CreatePositioner = self.client.parse(&**self, parser)?;
|
let req: CreatePositioner = self.client.parse(&**self, parser)?;
|
||||||
let pos = Rc::new(XdgPositioner::new(self, req.id, &self.client));
|
let pos = Rc::new(XdgPositioner::new(self, req.id, &self.client));
|
||||||
track!(self.client, pos);
|
track!(self.client, pos);
|
||||||
|
|
@ -98,7 +98,7 @@ impl XdgWmBase {
|
||||||
fn get_xdg_surface(
|
fn get_xdg_surface(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), GetXdgSurfaceError> {
|
) -> Result<(), XdgWmBaseError> {
|
||||||
let req: GetXdgSurface = self.client.parse(&**self, parser)?;
|
let req: GetXdgSurface = self.client.parse(&**self, parser)?;
|
||||||
let surface = self.client.lookup(req.surface)?;
|
let surface = self.client.lookup(req.surface)?;
|
||||||
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface));
|
let xdg_surface = Rc::new(XdgSurface::new(self, req.id, &surface));
|
||||||
|
|
@ -109,7 +109,7 @@ impl XdgWmBase {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pong(&self, parser: MsgParser<'_, '_>) -> Result<(), PongError> {
|
fn pong(&self, parser: MsgParser<'_, '_>) -> Result<(), XdgWmBaseError> {
|
||||||
let _req: Pong = self.client.parse(self, parser)?;
|
let _req: Pong = self.client.parse(self, parser)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ impl Global for XdgWmBaseGlobal {
|
||||||
simple_add_global!(XdgWmBaseGlobal);
|
simple_add_global!(XdgWmBaseGlobal);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
XdgWmBase, XdgWmBaseError;
|
XdgWmBase;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
CREATE_POSITIONER => create_positioner,
|
CREATE_POSITIONER => create_positioner,
|
||||||
|
|
@ -154,55 +154,13 @@ impl Object for XdgWmBase {
|
||||||
pub enum XdgWmBaseError {
|
pub enum XdgWmBaseError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Tried to destroy xdg_wm_base object before destroying its surfaces")]
|
#[error("Tried to destroy xdg_wm_base object before destroying its surfaces")]
|
||||||
DefunctSurfaces,
|
DefunctSurfaces,
|
||||||
#[error(transparent)]
|
#[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>),
|
XdgSurfaceError(Box<XdgSurfaceError>),
|
||||||
}
|
}
|
||||||
efrom!(GetXdgSurfaceError, ParseError, MsgParserError);
|
efrom!(XdgWmBaseError, ClientError);
|
||||||
efrom!(GetXdgSurfaceError, ClientError);
|
efrom!(XdgWmBaseError, MsgParserError);
|
||||||
efrom!(GetXdgSurfaceError, XdgSurfaceError);
|
efrom!(XdgWmBaseError, XdgSurfaceError);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum PongError {
|
|
||||||
#[error("Parsing failed")]
|
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
|
||||||
}
|
|
||||||
efrom!(PongError, ParseError, MsgParserError);
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ impl ZwlrLayerShellV1Global {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZwlrLayerShellV1 {
|
impl ZwlrLayerShellV1 {
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwlrLayerSurfaceV1Error> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -63,7 +63,7 @@ impl ZwlrLayerShellV1 {
|
||||||
fn get_layer_surface(
|
fn get_layer_surface(
|
||||||
self: &Rc<Self>,
|
self: &Rc<Self>,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), GetLayerSurfaceError> {
|
) -> Result<(), ZwlrLayerShellV1Error> {
|
||||||
let req: GetLayerSurface = self.client.parse(&**self, parser)?;
|
let req: GetLayerSurface = self.client.parse(&**self, parser)?;
|
||||||
let surface = self.client.lookup(req.surface)?;
|
let surface = self.client.lookup(req.surface)?;
|
||||||
let output = 'get_output: {
|
let output = 'get_output: {
|
||||||
|
|
@ -80,11 +80,11 @@ impl ZwlrLayerShellV1 {
|
||||||
if let Some(output) = outputs.values().next() {
|
if let Some(output) = outputs.values().next() {
|
||||||
break 'get_output output.node.clone();
|
break 'get_output output.node.clone();
|
||||||
}
|
}
|
||||||
return Err(GetLayerSurfaceError::NoOutputs);
|
return Err(ZwlrLayerShellV1Error::NoOutputs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if req.layer > OVERLAY {
|
if req.layer > OVERLAY {
|
||||||
return Err(GetLayerSurfaceError::UnknownLayer(req.layer));
|
return Err(ZwlrLayerShellV1Error::UnknownLayer(req.layer));
|
||||||
}
|
}
|
||||||
let surface = Rc::new(ZwlrLayerSurfaceV1::new(
|
let surface = Rc::new(ZwlrLayerSurfaceV1::new(
|
||||||
req.id,
|
req.id,
|
||||||
|
|
@ -120,7 +120,7 @@ impl Global for ZwlrLayerShellV1Global {
|
||||||
simple_add_global!(ZwlrLayerShellV1Global);
|
simple_add_global!(ZwlrLayerShellV1Global);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwlrLayerShellV1, ZwlrLayerShellV1Error;
|
ZwlrLayerShellV1;
|
||||||
|
|
||||||
GET_LAYER_SURFACE => get_layer_surface,
|
GET_LAYER_SURFACE => get_layer_surface,
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
@ -141,29 +141,8 @@ impl Object for ZwlrLayerShellV1 {
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwlrLayerShellV1Error {
|
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")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Unknown layer {0}")]
|
#[error("Unknown layer {0}")]
|
||||||
|
|
@ -173,6 +152,6 @@ pub enum GetLayerSurfaceError {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
ZwlrLayerSurfaceV1Error(Box<ZwlrLayerSurfaceV1Error>),
|
||||||
}
|
}
|
||||||
efrom!(GetLayerSurfaceError, ParseError, MsgParserError);
|
efrom!(ZwlrLayerShellV1Error, ClientError);
|
||||||
efrom!(GetLayerSurfaceError, ClientError);
|
efrom!(ZwlrLayerShellV1Error, MsgParserError);
|
||||||
efrom!(GetLayerSurfaceError, ZwlrLayerSurfaceV1Error);
|
efrom!(ZwlrLayerShellV1Error, ZwlrLayerSurfaceV1Error);
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ impl ZwpIdleInhibitManagerV1 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base2! {
|
object_base! {
|
||||||
ZwpIdleInhibitManagerV1;
|
ZwpIdleInhibitManagerV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
|
|
|
||||||
|
|
@ -61,25 +61,25 @@ impl ZwpLinuxBufferParamsV1 {
|
||||||
self.parent.client.event(Failed { self_id: self.id })
|
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)?;
|
let _req: Destroy = self.parent.client.parse(&**self, parser)?;
|
||||||
self.parent.client.remove_obj(&**self)?;
|
self.parent.client.remove_obj(&**self)?;
|
||||||
Ok(())
|
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 req: Add = self.parent.client.parse(&**self, parser)?;
|
||||||
let modifier = ((req.modifier_hi as u64) << 32) | req.modifier_lo as u64;
|
let modifier = ((req.modifier_hi as u64) << 32) | req.modifier_lo as u64;
|
||||||
match self.modifier.get() {
|
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)),
|
_ => self.modifier.set(Some(modifier)),
|
||||||
}
|
}
|
||||||
let plane = req.plane_idx;
|
let plane = req.plane_idx;
|
||||||
if plane > MAX_PLANE {
|
if plane > MAX_PLANE {
|
||||||
return Err(AddError::MaxPlane);
|
return Err(ZwpLinuxBufferParamsV1Error::MaxPlane);
|
||||||
}
|
}
|
||||||
if self.planes.borrow_mut().insert(plane, req).is_some() {
|
if self.planes.borrow_mut().insert(plane, req).is_some() {
|
||||||
return Err(AddError::AlreadySet(plane));
|
return Err(ZwpLinuxBufferParamsV1Error::AlreadySet(plane));
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -91,22 +91,22 @@ impl ZwpLinuxBufferParamsV1 {
|
||||||
height: i32,
|
height: i32,
|
||||||
format: u32,
|
format: u32,
|
||||||
_flags: u32,
|
_flags: u32,
|
||||||
) -> Result<WlBufferId, DoCreateError> {
|
) -> Result<WlBufferId, ZwpLinuxBufferParamsV1Error> {
|
||||||
let ctx = match self.parent.client.state.render_ctx.get() {
|
let ctx = match self.parent.client.state.render_ctx.get() {
|
||||||
Some(ctx) => ctx,
|
Some(ctx) => ctx,
|
||||||
None => return Err(DoCreateError::NoRenderContext),
|
None => return Err(ZwpLinuxBufferParamsV1Error::NoRenderContext),
|
||||||
};
|
};
|
||||||
let formats = ctx.formats();
|
let formats = ctx.formats();
|
||||||
let format = match formats.get(&format) {
|
let format = match formats.get(&format) {
|
||||||
Some(f) => f,
|
Some(f) => f,
|
||||||
None => return Err(DoCreateError::InvalidFormat(format)),
|
None => return Err(ZwpLinuxBufferParamsV1Error::InvalidFormat(format)),
|
||||||
};
|
};
|
||||||
let modifier = match self.modifier.get() {
|
let modifier = match self.modifier.get() {
|
||||||
Some(m) => m,
|
Some(m) => m,
|
||||||
_ => return Err(DoCreateError::NoPlanes),
|
_ => return Err(ZwpLinuxBufferParamsV1Error::NoPlanes),
|
||||||
};
|
};
|
||||||
if !format.modifiers.contains_key(&modifier) {
|
if !format.modifiers.contains_key(&modifier) {
|
||||||
return Err(DoCreateError::InvalidModifier(modifier));
|
return Err(ZwpLinuxBufferParamsV1Error::InvalidModifier(modifier));
|
||||||
}
|
}
|
||||||
let mut dmabuf = DmaBuf {
|
let mut dmabuf = DmaBuf {
|
||||||
width,
|
width,
|
||||||
|
|
@ -119,7 +119,7 @@ impl ZwpLinuxBufferParamsV1 {
|
||||||
planes.sort_by_key(|a| a.plane_idx);
|
planes.sort_by_key(|a| a.plane_idx);
|
||||||
for (i, p) in planes.into_iter().enumerate() {
|
for (i, p) in planes.into_iter().enumerate() {
|
||||||
if p.plane_idx as usize != i {
|
if p.plane_idx as usize != i {
|
||||||
return Err(DoCreateError::MissingPlane(i));
|
return Err(ZwpLinuxBufferParamsV1Error::MissingPlane(i));
|
||||||
}
|
}
|
||||||
dmabuf.planes.push(DmaBufPlane {
|
dmabuf.planes.push(DmaBufPlane {
|
||||||
offset: p.offset,
|
offset: p.offset,
|
||||||
|
|
@ -147,27 +147,27 @@ impl ZwpLinuxBufferParamsV1 {
|
||||||
Ok(buffer_id)
|
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)?;
|
let req: Create = self.parent.client.parse(&**self, parser)?;
|
||||||
if self.used.replace(true) {
|
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) {
|
match self.do_create(None, req.width, req.height, req.format, req.flags) {
|
||||||
Ok(id) => {
|
Ok(id) => {
|
||||||
self.send_created(id);
|
self.send_created(id);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
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();
|
self.send_failed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
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)?;
|
let req: CreateImmed = self.parent.client.parse(&**self, parser)?;
|
||||||
if self.used.replace(true) {
|
if self.used.replace(true) {
|
||||||
return Err(CreateImmedError::AlreadyUsed);
|
return Err(ZwpLinuxBufferParamsV1Error::AlreadyUsed);
|
||||||
}
|
}
|
||||||
self.do_create(
|
self.do_create(
|
||||||
Some(req.buffer_id),
|
Some(req.buffer_id),
|
||||||
|
|
@ -181,7 +181,7 @@ impl ZwpLinuxBufferParamsV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpLinuxBufferParamsV1, ZwpLinuxBufferParamsV1Error;
|
ZwpLinuxBufferParamsV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
ADD => add,
|
ADD => add,
|
||||||
|
|
@ -199,49 +199,18 @@ simple_add_obj!(ZwpLinuxBufferParamsV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwpLinuxBufferParamsV1Error {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
#[error("The params object has already been used")]
|
||||||
efrom!(ZwpLinuxBufferParamsV1Error, ClientError);
|
AlreadyUsed,
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
ParseError(#[source] Box<MsgParserError>),
|
MsgParserError(#[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>),
|
|
||||||
#[error("A buffer can contain at most 4 planes")]
|
#[error("A buffer can contain at most 4 planes")]
|
||||||
MaxPlane,
|
MaxPlane,
|
||||||
#[error(transparent)]
|
|
||||||
ClientError(Box<ClientError>),
|
|
||||||
#[error("Tried to add a plane with modifier {0} that differs from a previous modifier {1}")]
|
#[error("Tried to add a plane with modifier {0} that differs from a previous modifier {1}")]
|
||||||
MixedModifiers(u64, u64),
|
MixedModifiers(u64, u64),
|
||||||
#[error("The plane {0} was already set")]
|
#[error("The plane {0} was already set")]
|
||||||
AlreadySet(u32),
|
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")]
|
#[error("The compositor has no render context attached")]
|
||||||
NoRenderContext,
|
NoRenderContext,
|
||||||
#[error("The format {0} is not supported")]
|
#[error("The format {0} is not supported")]
|
||||||
|
|
@ -255,30 +224,5 @@ pub enum DoCreateError {
|
||||||
#[error("Could not import the buffer")]
|
#[error("Could not import the buffer")]
|
||||||
ImportError(#[from] RenderError),
|
ImportError(#[from] RenderError),
|
||||||
}
|
}
|
||||||
efrom!(DoCreateError, ClientError);
|
efrom!(ZwpLinuxBufferParamsV1Error, ClientError);
|
||||||
|
efrom!(ZwpLinuxBufferParamsV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Destroy = self.client.parse(&**self, parser)?;
|
||||||
self.client.remove_obj(&**self)?;
|
self.client.remove_obj(&**self)?;
|
||||||
Ok(())
|
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 req: CreateParams = self.client.parse(&**self, parser)?;
|
||||||
let params = Rc::new(ZwpLinuxBufferParamsV1::new(req.params_id, self));
|
let params = Rc::new(ZwpLinuxBufferParamsV1::new(req.params_id, self));
|
||||||
track!(self.client, params);
|
track!(self.client, params);
|
||||||
|
|
@ -110,7 +110,7 @@ impl ZwpLinuxDmabufV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZwpLinuxDmabufV1, ZwpLinuxDmabufV1Error;
|
ZwpLinuxDmabufV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
CREATE_PARAMS => create_params,
|
CREATE_PARAMS => create_params,
|
||||||
|
|
@ -126,31 +126,10 @@ simple_add_obj!(ZwpLinuxDmabufV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZwpLinuxDmabufV1Error {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(ZwpLinuxDmabufV1Error, ClientError);
|
efrom!(ZwpLinuxDmabufV1Error, ClientError);
|
||||||
|
efrom!(ZwpLinuxDmabufV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ pub struct ZxdgDecorationManagerV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -74,7 +74,7 @@ impl ZxdgDecorationManagerV1 {
|
||||||
fn get_toplevel_decoration(
|
fn get_toplevel_decoration(
|
||||||
&self,
|
&self,
|
||||||
parser: MsgParser<'_, '_>,
|
parser: MsgParser<'_, '_>,
|
||||||
) -> Result<(), GetToplevelDecorationError> {
|
) -> Result<(), ZxdgDecorationManagerV1Error> {
|
||||||
let req: GetToplevelDecoration = self.client.parse(self, parser)?;
|
let req: GetToplevelDecoration = self.client.parse(self, parser)?;
|
||||||
let tl = self.client.lookup(req.toplevel)?;
|
let tl = self.client.lookup(req.toplevel)?;
|
||||||
let obj = Rc::new(ZxdgToplevelDecorationV1::new(req.id, &self.client, &tl));
|
let obj = Rc::new(ZxdgToplevelDecorationV1::new(req.id, &self.client, &tl));
|
||||||
|
|
@ -86,7 +86,7 @@ impl ZxdgDecorationManagerV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZxdgDecorationManagerV1, ZxdgDecorationManagerV1Error;
|
ZxdgDecorationManagerV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
GET_TOPLEVEL_DECORATION => get_toplevel_decoration,
|
GET_TOPLEVEL_DECORATION => get_toplevel_decoration,
|
||||||
|
|
@ -102,31 +102,10 @@ simple_add_obj!(ZxdgDecorationManagerV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZxdgDecorationManagerV1Error {
|
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)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
|
#[error("Parsing failed")]
|
||||||
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
}
|
}
|
||||||
efrom!(ZxdgDecorationManagerV1Error, ClientError);
|
efrom!(ZxdgDecorationManagerV1Error, ClientError);
|
||||||
|
efrom!(ZxdgDecorationManagerV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@ impl ZxdgOutputManagerV1Global {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZxdgOutputManagerV1 {
|
impl ZxdgOutputManagerV1 {
|
||||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZxdgOutputManagerV1Error> {
|
||||||
let _req: Destroy = self.client.parse(self, parser)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
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 req: GetXdgOutput = self.client.parse(&**self, parser)?;
|
||||||
let output = self.client.lookup(req.output)?;
|
let output = self.client.lookup(req.output)?;
|
||||||
let xdg_output = Rc::new(ZxdgOutputV1 {
|
let xdg_output = Rc::new(ZxdgOutputV1 {
|
||||||
|
|
@ -90,7 +90,7 @@ impl Global for ZxdgOutputManagerV1Global {
|
||||||
simple_add_global!(ZxdgOutputManagerV1Global);
|
simple_add_global!(ZxdgOutputManagerV1Global);
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZxdgOutputManagerV1, ZxdgOutputManagerV1Error;
|
ZxdgOutputManagerV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
GET_XDG_OUTPUT => get_xdg_output,
|
GET_XDG_OUTPUT => get_xdg_output,
|
||||||
|
|
@ -108,29 +108,8 @@ impl Object for ZxdgOutputManagerV1 {
|
||||||
pub enum ZxdgOutputManagerV1Error {
|
pub enum ZxdgOutputManagerV1Error {
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
#[error("Could not process a `destroy` request")]
|
#[error("Parsing failed")]
|
||||||
DestroyError(#[from] DestroyError),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error("Could not process a `get_xdg_output` request")]
|
|
||||||
GetXdgOutputError(#[from] GetXdgOutputError),
|
|
||||||
}
|
}
|
||||||
efrom!(ZxdgOutputManagerV1Error, ClientError);
|
efrom!(ZxdgOutputManagerV1Error, ClientError);
|
||||||
|
efrom!(ZxdgOutputManagerV1Error, MsgParserError);
|
||||||
#[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);
|
|
||||||
|
|
|
||||||
|
|
@ -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)?;
|
let _req: Destroy = self.client.parse(self, msg)?;
|
||||||
self.output.xdg_outputs.remove(&self.id);
|
self.output.xdg_outputs.remove(&self.id);
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
|
|
@ -83,7 +83,7 @@ impl ZxdgOutputV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZxdgOutputV1, ZxdgOutputV1Error;
|
ZxdgOutputV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
}
|
}
|
||||||
|
|
@ -98,16 +98,10 @@ simple_add_obj!(ZxdgOutputV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZxdgOutputV1Error {
|
pub enum ZxdgOutputV1Error {
|
||||||
#[error("Could not process a `destroy` request")]
|
|
||||||
DestroyError(#[from] DestroyError),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
|
||||||
pub enum DestroyError {
|
|
||||||
#[error("Parsing failed")]
|
#[error("Parsing failed")]
|
||||||
MsgParserError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, MsgParserError);
|
efrom!(ZxdgOutputV1Error, MsgParserError);
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(ZxdgOutputV1Error, ClientError);
|
||||||
|
|
|
||||||
|
|
@ -51,19 +51,19 @@ impl ZxdgToplevelDecorationV1 {
|
||||||
self.toplevel.xdg.do_send_configure();
|
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)?;
|
let _req: Destroy = self.client.parse(self, parser)?;
|
||||||
self.client.remove_obj(self)?;
|
self.client.remove_obj(self)?;
|
||||||
Ok(())
|
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)?;
|
let _req: SetMode = self.client.parse(&**self, parser)?;
|
||||||
self.do_send_configure();
|
self.do_send_configure();
|
||||||
Ok(())
|
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)?;
|
let _req: UnsetMode = self.client.parse(&**self, parser)?;
|
||||||
self.do_send_configure();
|
self.do_send_configure();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -71,7 +71,7 @@ impl ZxdgToplevelDecorationV1 {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_base! {
|
object_base! {
|
||||||
ZxdgToplevelDecorationV1, ZxdgToplevelDecorationV1Error;
|
ZxdgToplevelDecorationV1;
|
||||||
|
|
||||||
DESTROY => destroy,
|
DESTROY => destroy,
|
||||||
SET_MODE => set_mode,
|
SET_MODE => set_mode,
|
||||||
|
|
@ -88,34 +88,10 @@ simple_add_obj!(ZxdgToplevelDecorationV1);
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum ZxdgToplevelDecorationV1Error {
|
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")]
|
#[error("Parsing failed")]
|
||||||
MsgParserError(#[source] Box<MsgParserError>),
|
MsgParserError(#[source] Box<MsgParserError>),
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
ClientError(Box<ClientError>),
|
ClientError(Box<ClientError>),
|
||||||
}
|
}
|
||||||
efrom!(DestroyError, ClientError);
|
efrom!(ZxdgToplevelDecorationV1Error, ClientError);
|
||||||
efrom!(DestroyError, MsgParserError);
|
efrom!(ZxdgToplevelDecorationV1Error, 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);
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ macro_rules! efrom {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! object_base2 {
|
macro_rules! object_base {
|
||||||
($oname:ident; $($code:ident => $f:ident,)*) => {
|
($oname:ident; $($code:ident => $f:ident,)*) => {
|
||||||
impl crate::object::ObjectBase for $oname {
|
impl crate::object::ObjectBase for $oname {
|
||||||
fn id(&self) -> crate::object::ObjectId {
|
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 {
|
macro_rules! global_base {
|
||||||
($oname:ty, $ifname:ident, $ename:ty) => {
|
($oname:ty, $ifname:ident, $ename:ty) => {
|
||||||
impl crate::globals::GlobalBase for $oname {
|
impl crate::globals::GlobalBase for $oname {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue