shell: trigger re-render when surface disappears
This commit is contained in:
parent
56e72b4fef
commit
825430fdfd
4 changed files with 47 additions and 5 deletions
25
src/utils.rs
25
src/utils.rs
|
|
@ -1,7 +1,13 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use smithay::reexports::wayland_server::{Global, Interface, Resource};
|
||||
use std::convert::{AsRef, From};
|
||||
use std::{
|
||||
convert::{AsRef, From},
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct GlobalDrop<I: Interface + AsRef<Resource<I>> + From<Resource<I>>>(Option<Global<I>>);
|
||||
|
||||
|
|
@ -18,3 +24,20 @@ impl<I: Interface + AsRef<Resource<I>> + From<Resource<I>>> Drop for GlobalDrop<
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This hack will hopefully will be superseeded by a better solution, when smithay transitions to wayland-rs 0.30.
|
||||
// But until then there is not really a better way to schedule a repaint on surface destruction
|
||||
#[derive(Debug)]
|
||||
pub struct SurfaceDropNotifier(Arc<AtomicBool>);
|
||||
|
||||
impl From<&crate::state::Common> for SurfaceDropNotifier {
|
||||
fn from(state: &crate::state::Common) -> Self {
|
||||
SurfaceDropNotifier(state.dirty_flag.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for SurfaceDropNotifier {
|
||||
fn drop(&mut self) {
|
||||
self.0.store(true, Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue