wayland: implement wp-drm-lease-v1
This commit is contained in:
parent
e92c92bf49
commit
abbc847144
27 changed files with 797 additions and 19 deletions
39
src/utils/bindings.rs
Normal file
39
src/utils/bindings.rs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
use {
|
||||
crate::{
|
||||
client::{Client, ClientId},
|
||||
object::{Object, ObjectId},
|
||||
utils::copyhashmap::{CopyHashMap, Locked},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct Bindings<P> {
|
||||
bindings: CopyHashMap<(ClientId, ObjectId), Rc<P>>,
|
||||
}
|
||||
|
||||
impl<P> Default for Bindings<P> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
bindings: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: Object> Bindings<P> {
|
||||
pub fn add(&self, client: &Client, obj: &Rc<P>) {
|
||||
let prev = self.bindings.set((client.id, obj.id()), obj.clone());
|
||||
assert!(prev.is_none());
|
||||
}
|
||||
|
||||
pub fn remove(&self, client: &Client, obj: &P) {
|
||||
self.bindings.remove(&(client.id, obj.id()));
|
||||
}
|
||||
|
||||
pub fn clear(&self) {
|
||||
self.bindings.clear();
|
||||
}
|
||||
|
||||
pub fn lock(&self) -> Locked<(ClientId, ObjectId), Rc<P>> {
|
||||
self.bindings.lock()
|
||||
}
|
||||
}
|
||||
|
|
@ -163,7 +163,7 @@ static ERRORS: Lazy<&'static [Option<&'static str>]> = Lazy::new(|| {
|
|||
res.leak()
|
||||
});
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct OsError(pub c::c_int);
|
||||
|
||||
impl From<Errno> for OsError {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue