wayland: implement tablet-v2
This commit is contained in:
parent
86e283d255
commit
7ed499eabd
62 changed files with 5174 additions and 318 deletions
|
|
@ -5,7 +5,11 @@ use {
|
|||
utils::copyhashmap::{CopyHashMap, Locked},
|
||||
},
|
||||
ahash::AHashMap,
|
||||
std::{cell::RefCell, collections::hash_map::Entry, rc::Rc},
|
||||
std::{
|
||||
cell::{Ref, RefCell},
|
||||
collections::hash_map::Entry,
|
||||
rc::Rc,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct Bindings<P> {
|
||||
|
|
@ -84,4 +88,8 @@ impl<P: Object> PerClientBindings<P> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn borrow(&self) -> Ref<AHashMap<ClientId, AHashMap<ObjectId, Rc<P>>>> {
|
||||
self.bindings.borrow()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ impl<K: Eq + Hash, V> CopyHashMap<K, V> {
|
|||
unsafe { self.map.get().deref().contains_key(k) }
|
||||
}
|
||||
|
||||
pub fn lock(&self) -> Locked<K, V> {
|
||||
pub fn lock(&self) -> Locked<'_, K, V> {
|
||||
Locked {
|
||||
source: self,
|
||||
map: self.clear(),
|
||||
|
|
|
|||
19
src/utils/pending_serial.rs
Normal file
19
src/utils/pending_serial.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
use crate::client::Client;
|
||||
|
||||
pub struct PendingSerial<'a> {
|
||||
serial: Option<u32>,
|
||||
client: &'a Client,
|
||||
}
|
||||
|
||||
impl<'a> PendingSerial<'a> {
|
||||
pub fn new(client: &'a Client) -> Self {
|
||||
Self {
|
||||
serial: None,
|
||||
client,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get(&mut self) -> u32 {
|
||||
*self.serial.get_or_insert_with(|| self.client.next_serial())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue