autocommit 2022-04-28 15:19:15 CEST
This commit is contained in:
parent
a8ad097f8b
commit
19aef8c58a
49 changed files with 413 additions and 1886 deletions
|
|
@ -92,7 +92,7 @@ impl WlDataDevice {
|
|||
self.manager.client.event(Drop { self_id: self.id })
|
||||
}
|
||||
|
||||
fn start_drag(&self, parser: MsgParser<'_, '_>) -> Result<(), StartDragError> {
|
||||
fn start_drag(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let req: StartDrag = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to start_drag with an invalid serial");
|
||||
|
|
@ -117,7 +117,7 @@ impl WlDataDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSelectionError> {
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to set_selection with an invalid serial");
|
||||
|
|
@ -140,7 +140,7 @@ impl WlDataDevice {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), ReleaseError> {
|
||||
fn release(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceError> {
|
||||
let _req: Release = self.manager.client.parse(self, parser)?;
|
||||
destroy_device::<Self>(self);
|
||||
self.seat.remove_data_device(self);
|
||||
|
|
@ -229,7 +229,7 @@ impl Vtable for WlDataDevice {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataDevice, WlDataDeviceError;
|
||||
WlDataDevice;
|
||||
|
||||
START_DRAG => start_drag,
|
||||
SET_SELECTION => set_selection,
|
||||
|
|
@ -251,52 +251,16 @@ simple_add_obj!(WlDataDevice);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDataDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `start_drag` request")]
|
||||
StartDragError(#[from] StartDragError),
|
||||
#[error("Could not process `set_selection` request")]
|
||||
SetSelectionError(#[from] SetSelectionError),
|
||||
#[error("Could not process `release` request")]
|
||||
ReleaseError(#[from] ReleaseError),
|
||||
}
|
||||
efrom!(WlDataDeviceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum StartDragError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
#[error(transparent)]
|
||||
WlSurfaceError(Box<WlSurfaceError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(StartDragError, ParseFailed, MsgParserError);
|
||||
efrom!(StartDragError, ClientError);
|
||||
efrom!(StartDragError, WlSeatError);
|
||||
efrom!(StartDragError, WlSurfaceError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetSelectionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(SetSelectionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetSelectionError, ClientError);
|
||||
efrom!(SetSelectionError, WlSeatError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReleaseError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReleaseError, ParseFailed, MsgParserError);
|
||||
efrom!(ReleaseError, ClientError);
|
||||
efrom!(WlDataDeviceError, MsgParserError);
|
||||
efrom!(WlDataDeviceError, ClientError);
|
||||
efrom!(WlDataDeviceError, WlSeatError);
|
||||
efrom!(WlDataDeviceError, WlSurfaceError);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ impl WlDataDeviceManagerGlobal {
|
|||
}
|
||||
|
||||
impl WlDataDeviceManager {
|
||||
fn create_data_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateDataSourceError> {
|
||||
fn create_data_source(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataDeviceManagerError> {
|
||||
let req: CreateDataSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(WlDataSource::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
|
|
@ -67,7 +67,7 @@ impl WlDataDeviceManager {
|
|||
fn get_data_device(
|
||||
self: &Rc<Self>,
|
||||
parser: MsgParser<'_, '_>,
|
||||
) -> Result<(), GetDataDeviceError> {
|
||||
) -> Result<(), WlDataDeviceManagerError> {
|
||||
let req: GetDataDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(WlDataDevice::new(req.id, self, &seat));
|
||||
|
|
@ -97,7 +97,7 @@ impl Global for WlDataDeviceManagerGlobal {
|
|||
simple_add_global!(WlDataDeviceManagerGlobal);
|
||||
|
||||
object_base! {
|
||||
WlDataDeviceManager, WlDataDeviceManagerError;
|
||||
WlDataDeviceManager;
|
||||
|
||||
CREATE_DATA_SOURCE => create_data_source,
|
||||
GET_DATA_DEVICE => get_data_device,
|
||||
|
|
@ -115,29 +115,8 @@ simple_add_obj!(WlDataDeviceManager);
|
|||
pub enum WlDataDeviceManagerError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `create_data_source` request")]
|
||||
CreateDataSourceError(#[from] CreateDataSourceError),
|
||||
#[error("Could not process `get_data_device` request")]
|
||||
GetDataDeviceError(#[from] GetDataDeviceError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(WlDataDeviceManagerError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateDataSourceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateDataSourceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateDataSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetDataDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetDataDeviceError, ParseFailed, MsgParserError);
|
||||
efrom!(GetDataDeviceError, ClientError);
|
||||
efrom!(WlDataDeviceManagerError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -61,12 +61,12 @@ impl WlDataOffer {
|
|||
})
|
||||
}
|
||||
|
||||
fn accept(&self, parser: MsgParser<'_, '_>) -> Result<(), AcceptError> {
|
||||
fn accept(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: Accept = self.client.parse(self, parser)?;
|
||||
let _ = req.serial; // unused
|
||||
let mut state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(AcceptError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if req.mime_type.is_some() {
|
||||
state |= OFFER_STATE_ACCEPTED;
|
||||
|
|
@ -80,36 +80,36 @@ impl WlDataOffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ReceiveError> {
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: Receive = self.client.parse(self, parser)?;
|
||||
if self.data.shared.state.get().contains(OFFER_STATE_FINISHED) {
|
||||
return Err(ReceiveError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
receive::<WlDataDevice>(self, req.mime_type, req.fd);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
destroy_offer::<WlDataDevice>(self);
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), FinishError> {
|
||||
fn finish(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let _req: Finish = self.client.parse(self, parser)?;
|
||||
if self.data.shared.role.get() != Role::Dnd {
|
||||
return Err(FinishError::NotDnd);
|
||||
return Err(WlDataOfferError::NotDnd);
|
||||
}
|
||||
let mut state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(FinishError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if !state.contains(OFFER_STATE_DROPPED) {
|
||||
return Err(FinishError::StillDragging);
|
||||
return Err(WlDataOfferError::StillDragging);
|
||||
}
|
||||
if !state.contains(OFFER_STATE_ACCEPTED) {
|
||||
return Err(FinishError::NoMimeTypeAccepted);
|
||||
return Err(WlDataOfferError::NoMimeTypeAccepted);
|
||||
}
|
||||
state |= OFFER_STATE_FINISHED;
|
||||
if let Some(src) = self.data.source.get() {
|
||||
|
|
@ -122,17 +122,17 @@ impl WlDataOffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), SetActionsError> {
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataOfferError> {
|
||||
let req: SetActions = self.client.parse(self, parser)?;
|
||||
let state = self.data.shared.state.get();
|
||||
if state.contains(OFFER_STATE_FINISHED) {
|
||||
return Err(SetActionsError::AlreadyFinished);
|
||||
return Err(WlDataOfferError::AlreadyFinished);
|
||||
}
|
||||
if (req.dnd_actions & !DND_ALL, req.preferred_action & !DND_ALL) != (0, 0) {
|
||||
return Err(SetActionsError::InvalidActions);
|
||||
return Err(WlDataOfferError::InvalidActions);
|
||||
}
|
||||
if req.preferred_action.count_ones() > 1 {
|
||||
return Err(SetActionsError::MultiplePreferred);
|
||||
return Err(WlDataOfferError::MultiplePreferred);
|
||||
}
|
||||
self.data.shared.receiver_actions.set(req.dnd_actions);
|
||||
self.data
|
||||
|
|
@ -147,7 +147,7 @@ impl WlDataOffer {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataOffer, WlDataOfferError;
|
||||
WlDataOffer;
|
||||
|
||||
ACCEPT => accept,
|
||||
RECEIVE => receive,
|
||||
|
|
@ -172,59 +172,8 @@ simple_add_obj!(WlDataOffer);
|
|||
pub enum WlDataOfferError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `accept` request")]
|
||||
AcceptError(#[from] AcceptError),
|
||||
#[error("Could not process `receive` request")]
|
||||
ReceiveError(#[from] ReceiveError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `finish` request")]
|
||||
FinishError(#[from] FinishError),
|
||||
#[error("Could not process `set_actions` request")]
|
||||
SetActionsError(#[from] SetActionsError),
|
||||
}
|
||||
efrom!(WlDataOfferError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum AcceptError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
}
|
||||
efrom!(AcceptError, ParseFailed, MsgParserError);
|
||||
efrom!(AcceptError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReceiveError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
}
|
||||
efrom!(ReceiveError, ParseFailed, MsgParserError);
|
||||
efrom!(ReceiveError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum FinishError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
#[error("The drag operation is still ongoing")]
|
||||
|
|
@ -233,22 +182,10 @@ pub enum FinishError {
|
|||
NoMimeTypeAccepted,
|
||||
#[error("This is not a drag-and-drop offer")]
|
||||
NotDnd,
|
||||
}
|
||||
efrom!(FinishError, ParseFailed, MsgParserError);
|
||||
efrom!(FinishError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetActionsError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("`finish` was already called")]
|
||||
AlreadyFinished,
|
||||
#[error("The set of actions is invalid")]
|
||||
InvalidActions,
|
||||
#[error("Multiple preferred actions were specified")]
|
||||
MultiplePreferred,
|
||||
}
|
||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
||||
efrom!(SetActionsError, ClientError);
|
||||
efrom!(WlDataOfferError, ClientError);
|
||||
efrom!(WlDataOfferError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -138,26 +138,26 @@ impl WlDataSource {
|
|||
.event(DndDropPerformed { self_id: self.id })
|
||||
}
|
||||
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), OfferError> {
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let req: Offer = self.data.client.parse(self, parser)?;
|
||||
add_mime_type::<WlDataDevice>(self, req.mime_type);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||
destroy_source::<WlDataDevice>(self);
|
||||
self.data.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), SetActionsError> {
|
||||
fn set_actions(&self, parser: MsgParser<'_, '_>) -> Result<(), WlDataSourceError> {
|
||||
let req: SetActions = self.data.client.parse(self, parser)?;
|
||||
if self.data.actions.get().is_some() {
|
||||
return Err(SetActionsError::AlreadySet);
|
||||
return Err(WlDataSourceError::AlreadySet);
|
||||
}
|
||||
if req.dnd_actions & !DND_ALL != 0 {
|
||||
return Err(SetActionsError::InvalidActions);
|
||||
return Err(WlDataSourceError::InvalidActions);
|
||||
}
|
||||
self.data.actions.set(Some(req.dnd_actions));
|
||||
Ok(())
|
||||
|
|
@ -165,7 +165,7 @@ impl WlDataSource {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
WlDataSource, WlDataSourceError;
|
||||
WlDataSource;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -186,41 +186,8 @@ dedicated_add_obj!(WlDataSource, WlDataSourceId, wl_data_source);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum WlDataSourceError {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `offer` request")]
|
||||
OfferError(#[from] OfferError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `set_actions` request")]
|
||||
SetActionsError(#[from] SetActionsError),
|
||||
}
|
||||
efrom!(WlDataSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OfferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(OfferError, ParseFailed, MsgParserError);
|
||||
efrom!(OfferError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetActionsError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("The set of actions is invalid")]
|
||||
|
|
@ -228,5 +195,5 @@ pub enum SetActionsError {
|
|||
#[error("The actions have already been set")]
|
||||
AlreadySet,
|
||||
}
|
||||
efrom!(SetActionsError, ParseFailed, MsgParserError);
|
||||
efrom!(SetActionsError, ClientError);
|
||||
efrom!(WlDataSourceError, ClientError);
|
||||
efrom!(WlDataSourceError, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
}
|
||||
|
||||
impl ZwpPrimarySelectionDeviceManagerV1 {
|
||||
fn create_source(&self, parser: MsgParser<'_, '_>) -> Result<(), CreateSourceError> {
|
||||
fn create_source(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let req: CreateSource = self.client.parse(self, parser)?;
|
||||
let res = Rc::new(ZwpPrimarySelectionSourceV1::new(req.id, &self.client));
|
||||
track!(self.client, res);
|
||||
|
|
@ -58,7 +58,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn get_data_device(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), GetDeviceError> {
|
||||
fn get_data_device(self: &Rc<Self>, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let req: GetDevice = self.client.parse(&**self, parser)?;
|
||||
let seat = self.client.lookup(req.seat)?;
|
||||
let dev = Rc::new(ZwpPrimarySelectionDeviceV1::new(req.id, self, &seat));
|
||||
|
|
@ -68,7 +68,7 @@ impl ZwpPrimarySelectionDeviceManagerV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceManagerV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
self.client.remove_obj(self)?;
|
||||
Ok(())
|
||||
|
|
@ -94,7 +94,7 @@ impl Global for ZwpPrimarySelectionDeviceManagerV1Global {
|
|||
simple_add_global!(ZwpPrimarySelectionDeviceManagerV1Global);
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceManagerV1, ZwpPrimarySelectionDeviceManagerV1Error;
|
||||
ZwpPrimarySelectionDeviceManagerV1;
|
||||
|
||||
CREATE_SOURCE => create_source,
|
||||
GET_DEVICE => get_data_device,
|
||||
|
|
@ -111,43 +111,10 @@ simple_add_obj!(ZwpPrimarySelectionDeviceManagerV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPrimarySelectionDeviceManagerV1Error {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Could not process `create_source` request")]
|
||||
CreateSourceError(#[from] CreateSourceError),
|
||||
#[error("Could not process `get_device` request")]
|
||||
GetDeviceError(#[from] GetDeviceError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum CreateSourceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(CreateSourceError, ParseFailed, MsgParserError);
|
||||
efrom!(CreateSourceError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum GetDeviceError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(GetDeviceError, ParseFailed, MsgParserError);
|
||||
efrom!(GetDeviceError, ClientError);
|
||||
efrom!(ZwpPrimarySelectionDeviceManagerV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), SetSelectionError> {
|
||||
fn set_selection(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceV1Error> {
|
||||
let req: SetSelection = self.manager.client.parse(self, parser)?;
|
||||
if !self.manager.client.valid_serial(req.serial) {
|
||||
log::warn!("Client tried to set_selection with an invalid serial");
|
||||
|
|
@ -86,7 +86,7 @@ impl ZwpPrimarySelectionDeviceV1 {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionDeviceV1Error> {
|
||||
let _req: Destroy = self.manager.client.parse(self, parser)?;
|
||||
destroy_device::<Self>(self);
|
||||
self.seat.remove_primary_selection_device(self);
|
||||
|
|
@ -171,7 +171,7 @@ impl Vtable for ZwpPrimarySelectionDeviceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionDeviceV1, ZwpPrimarySelectionDeviceV1Error;
|
||||
ZwpPrimarySelectionDeviceV1;
|
||||
|
||||
SET_SELECTION => set_selection,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -194,32 +194,11 @@ simple_add_obj!(ZwpPrimarySelectionDeviceV1);
|
|||
pub enum ZwpPrimarySelectionDeviceV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `set_selection` request")]
|
||||
SetSelectionError(#[from] SetSelectionError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum SetSelectionError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
WlSeatError(Box<WlSeatError>),
|
||||
}
|
||||
efrom!(SetSelectionError, ParseFailed, MsgParserError);
|
||||
efrom!(SetSelectionError, ClientError);
|
||||
efrom!(SetSelectionError, WlSeatError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, ClientError);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, MsgParserError);
|
||||
efrom!(ZwpPrimarySelectionDeviceV1Error, WlSeatError);
|
||||
|
|
|
|||
|
|
@ -29,13 +29,13 @@ impl ZwpPrimarySelectionOfferV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ReceiveError> {
|
||||
fn receive(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionOfferV1Error> {
|
||||
let req: Receive = self.client.parse(self, parser)?;
|
||||
receive::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type, req.fd);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionOfferV1Error> {
|
||||
let _req: Destroy = self.client.parse(self, parser)?;
|
||||
destroy_offer::<ZwpPrimarySelectionDeviceV1>(self);
|
||||
self.client.remove_obj(self)?;
|
||||
|
|
@ -44,7 +44,7 @@ impl ZwpPrimarySelectionOfferV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionOfferV1, ZwpPrimarySelectionOfferV1Error;
|
||||
ZwpPrimarySelectionOfferV1;
|
||||
|
||||
RECEIVE => receive,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -64,31 +64,10 @@ simple_add_obj!(ZwpPrimarySelectionOfferV1);
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ZwpPrimarySelectionOfferV1Error {
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `receive` request")]
|
||||
ReceiveError(#[from] ReceiveError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionOfferV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum ReceiveError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(ReceiveError, ParseFailed, MsgParserError);
|
||||
efrom!(ReceiveError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(ZwpPrimarySelectionOfferV1Error, MsgParserError);
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
})
|
||||
}
|
||||
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), OfferError> {
|
||||
fn offer(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionSourceV1Error> {
|
||||
let req: Offer = self.data.client.parse(self, parser)?;
|
||||
add_mime_type::<ZwpPrimarySelectionDeviceV1>(self, req.mime_type);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), DestroyError> {
|
||||
fn destroy(&self, parser: MsgParser<'_, '_>) -> Result<(), ZwpPrimarySelectionSourceV1Error> {
|
||||
let _req: Destroy = self.data.client.parse(self, parser)?;
|
||||
destroy_source::<ZwpPrimarySelectionDeviceV1>(self);
|
||||
self.data.client.remove_obj(self)?;
|
||||
|
|
@ -57,7 +57,7 @@ impl ZwpPrimarySelectionSourceV1 {
|
|||
}
|
||||
|
||||
object_base! {
|
||||
ZwpPrimarySelectionSourceV1, ZwpPrimarySelectionSourceV1Error;
|
||||
ZwpPrimarySelectionSourceV1;
|
||||
|
||||
OFFER => offer,
|
||||
DESTROY => destroy,
|
||||
|
|
@ -83,29 +83,8 @@ dedicated_add_obj!(
|
|||
pub enum ZwpPrimarySelectionSourceV1Error {
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
#[error("Could not process `offer` request")]
|
||||
OfferError(#[from] OfferError),
|
||||
#[error("Could not process `destroy` request")]
|
||||
DestroyError(#[from] DestroyError),
|
||||
#[error("Parsing failed")]
|
||||
MsgParserError(#[source] Box<MsgParserError>),
|
||||
}
|
||||
efrom!(ZwpPrimarySelectionSourceV1Error, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum OfferError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(OfferError, ParseFailed, MsgParserError);
|
||||
efrom!(OfferError, ClientError);
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum DestroyError {
|
||||
#[error("Parsing failed")]
|
||||
ParseFailed(#[source] Box<MsgParserError>),
|
||||
#[error(transparent)]
|
||||
ClientError(Box<ClientError>),
|
||||
}
|
||||
efrom!(DestroyError, ParseFailed, MsgParserError);
|
||||
efrom!(DestroyError, ClientError);
|
||||
efrom!(ZwpPrimarySelectionSourceV1Error, MsgParserError);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue