shell: Handle unmapped windows correctly
This commit is contained in:
parent
aaa40df963
commit
973cfed87b
8 changed files with 175 additions and 51 deletions
|
|
@ -19,7 +19,7 @@ use cosmic_protocols::toplevel_info::v1::server::{
|
|||
zcosmic_toplevel_info_v1::{self, ZcosmicToplevelInfoV1},
|
||||
};
|
||||
|
||||
pub trait Window: IsAlive + Clone + Send {
|
||||
pub trait Window: IsAlive + Clone + PartialEq + Send {
|
||||
fn title(&self) -> String;
|
||||
fn app_id(&self) -> String;
|
||||
fn is_activated(&self) -> bool;
|
||||
|
|
@ -247,6 +247,24 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
pub fn remove_toplevel(&mut self, toplevel: &W) {
|
||||
if let Some(state) = toplevel.user_data().get::<ToplevelState>() {
|
||||
let mut state_inner = state.lock().unwrap();
|
||||
for handle in &state_inner.instances {
|
||||
// don't send events to stopped instances
|
||||
if self
|
||||
.instances
|
||||
.iter()
|
||||
.any(|i| i.id().same_client_as(&handle.id()))
|
||||
{
|
||||
handle.closed();
|
||||
}
|
||||
}
|
||||
*state_inner = Default::default();
|
||||
}
|
||||
self.toplevels.retain(|w| w != toplevel);
|
||||
}
|
||||
|
||||
pub fn refresh(&mut self, workspace_state: Option<&WorkspaceState<D>>) {
|
||||
self.toplevels.retain(|window| {
|
||||
let mut state = window
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue