1
0
Fork 0
forked from wry/wry

wayland: implement ext-transient-seat-v1

This commit is contained in:
Julian Orth 2024-04-24 14:03:33 +02:00
parent b924393746
commit 25f363d086
9 changed files with 178 additions and 0 deletions

View file

@ -0,0 +1,48 @@
use {
crate::{
client::{Client, ClientError},
leaks::Tracker,
object::{Object, Version},
wire::{ext_transient_seat_v1::*, ExtTransientSeatV1Id},
},
std::rc::Rc,
thiserror::Error,
};
pub struct ExtTransientSeatV1 {
pub id: ExtTransientSeatV1Id,
pub client: Rc<Client>,
pub tracker: Tracker<Self>,
pub version: Version,
}
impl ExtTransientSeatV1 {
pub fn send_denied(&self) {
self.client.event(Denied { self_id: self.id });
}
}
impl ExtTransientSeatV1RequestHandler for ExtTransientSeatV1 {
type Error = ExtTransientSeatV1Error;
fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
self.client.remove_obj(self)?;
Ok(())
}
}
object_base! {
self = ExtTransientSeatV1;
version = self.version;
}
impl Object for ExtTransientSeatV1 {}
simple_add_obj!(ExtTransientSeatV1);
#[derive(Debug, Error)]
pub enum ExtTransientSeatV1Error {
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(ExtTransientSeatV1Error, ClientError);