wl_surface: handle buffer release automatically
This commit is contained in:
parent
6bdd1ff6e7
commit
8f576f498e
5 changed files with 51 additions and 34 deletions
|
|
@ -48,6 +48,19 @@ pub struct DmabufBufferParams {
|
|||
tex_impossible: bool,
|
||||
}
|
||||
|
||||
pub struct AttachedBuffer {
|
||||
pub send_release: bool,
|
||||
pub buf: Rc<WlBuffer>,
|
||||
}
|
||||
|
||||
impl Drop for AttachedBuffer {
|
||||
fn drop(&mut self) {
|
||||
if self.send_release && !self.buf.destroyed() {
|
||||
self.buf.send_release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct WlBuffer {
|
||||
pub id: WlBufferId,
|
||||
destroyed: Cell<bool>,
|
||||
|
|
@ -507,7 +520,7 @@ impl WlBuffer {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn send_release(&self) {
|
||||
fn send_release(&self) {
|
||||
self.client.event(Release { self_id: self.id })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue