diff --git a/src/criteria/clm.rs b/src/criteria/clm.rs index 57a929cf..022be1a0 100644 --- a/src/criteria/clm.rs +++ b/src/criteria/clm.rs @@ -63,6 +63,18 @@ pub struct RootMatchers { exe: ClmRootMatcherMap, } +impl RootMatchers { + fn clear(&self) { + self.sandbox_app_id.clear(); + self.sandbox_engine.clear(); + self.sandbox_instance_id.clear(); + self.uid.clear(); + self.pid.clear(); + self.comm.clear(); + self.exe.clear(); + } +} + pub async fn handle_cl_changes(state: Rc) { let mgr = &state.cl_matcher_manager; loop { @@ -112,6 +124,10 @@ impl ClMatcherManager { pub fn clear(&self) { self.changes.clear(); self.leaf_events.clear(); + self.constant.values().for_each(|c| c.clear()); + self.sandboxed.values().for_each(|c| c.clear()); + self.is_xwayland.values().for_each(|c| c.clear()); + self.matchers.clear(); } pub fn rematch_all(&self, state: &Rc) { diff --git a/src/criteria/crit_graph/crit_root.rs b/src/criteria/crit_graph/crit_root.rs index c8ca8abd..3c2c6f4c 100644 --- a/src/criteria/crit_graph/crit_root.rs +++ b/src/criteria/crit_graph/crit_root.rs @@ -129,6 +129,10 @@ where slf } + pub fn clear(&self) { + self.downstream.clear(); + } + pub fn handle(&self, target: &Target) { let new = self.criterion.matches(target) ^ self.not; let node = match new { diff --git a/src/criteria/crit_graph/crit_upstream.rs b/src/criteria/crit_graph/crit_upstream.rs index 7e21c78e..df799075 100644 --- a/src/criteria/crit_graph/crit_upstream.rs +++ b/src/criteria/crit_graph/crit_upstream.rs @@ -125,6 +125,10 @@ where } } + pub fn clear(&self) { + self.nodes.clear() + } + pub fn update_matched( &self, target: &Target, diff --git a/src/criteria/crit_per_target_data.rs b/src/criteria/crit_per_target_data.rs index 6ce7aca1..d675513c 100644 --- a/src/criteria/crit_per_target_data.rs +++ b/src/criteria/crit_per_target_data.rs @@ -56,6 +56,10 @@ where } } + pub fn clear(&self) { + self.data.borrow_mut().clear(); + } + pub fn get_or_create(&self, target: &Target, default: impl FnOnce() -> T) -> RefMut { RefMut::map(self.data.borrow_mut(), |d| { &mut d diff --git a/src/criteria/tlm.rs b/src/criteria/tlm.rs index cdaeac99..29cca67b 100644 --- a/src/criteria/tlm.rs +++ b/src/criteria/tlm.rs @@ -95,6 +95,22 @@ pub struct RootMatchers { content_ty: TlmRootMatcherMap, } +impl RootMatchers { + fn clear(&self) { + self.kinds.clear(); + self.clients.clear(); + self.title.clear(); + self.tag.clear(); + self.app_id.clear(); + self.seat_foci.clear(); + self.class.clear(); + self.instance.clear(); + self.role.clear(); + self.workspace.clear(); + self.content_ty.clear(); + } +} + pub async fn handle_tl_changes(state: Rc) { let mgr = &state.tl_matcher_manager; loop { @@ -159,6 +175,13 @@ impl TlMatcherManager { self.changes.clear(); self.leaf_events.clear(); self.handle_just_mapped.clear(); + self.constant.values().for_each(|c| c.clear()); + self.floating.values().for_each(|c| c.clear()); + self.visible.values().for_each(|c| c.clear()); + self.urgent.values().for_each(|c| c.clear()); + self.fullscreen.values().for_each(|c| c.clear()); + self.just_mapped.values().for_each(|c| c.clear()); + self.matchers.clear(); } pub fn rematch_all(&self, state: &Rc) {