1
0
Fork 0
forked from wry/wry

autocommit 2022-04-16 13:42:13 CEST

This commit is contained in:
Julian Orth 2022-04-16 13:42:13 +02:00
parent 4826305236
commit 50b792db78
27 changed files with 217 additions and 60 deletions

View file

@ -127,6 +127,8 @@ impl Clients {
tracker: Default::default(),
xwayland_queue,
secure,
last_serial: Cell::new(0),
last_enter_serial: Cell::new(0),
});
track!(data, data);
let display = Rc::new(WlDisplay::new(&data));
@ -224,6 +226,8 @@ pub struct Client {
pub tracker: Tracker<Client>,
pub xwayland_queue: Option<Rc<AsyncQueue<XWaylandEvent>>>,
pub secure: bool,
pub last_serial: Cell<u32>,
pub last_enter_serial: Cell<u32>,
}
impl Client {
@ -251,6 +255,18 @@ impl Client {
}
}
pub fn validate_serial(&self, serial: u32) -> Result<(), ClientError> {
if serial > self.last_serial.get() {
Err(ClientError::InvalidSerial)
} else {
Ok(())
}
}
pub fn next_serial(&self) -> u32 {
self.state.next_serial(Some(self))
}
pub fn new_id<T: From<ObjectId>>(&self) -> Result<T, ClientError> {
self.objects.id(self)
}