config: add window-rule infrastructure
This commit is contained in:
parent
a6257910bb
commit
59f8acdfde
26 changed files with 1829 additions and 38 deletions
21
src/criteria/tlm/tlm_matchers.rs
Normal file
21
src/criteria/tlm/tlm_matchers.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#[expect(unused_macros)]
|
||||
macro_rules! fixed_root_criterion {
|
||||
($ty:ty, $field:ident) => {
|
||||
impl crate::criteria::crit_graph::CritFixedRootCriterionBase<crate::tree::ToplevelData>
|
||||
for $ty
|
||||
{
|
||||
fn constant(&self) -> bool {
|
||||
self.0
|
||||
}
|
||||
|
||||
fn not<'a>(
|
||||
&self,
|
||||
mgr: &'a crate::criteria::tlm::TlMatcherManager,
|
||||
) -> &'a crate::criteria::FixedRootMatcher<crate::tree::ToplevelData, Self> {
|
||||
&mgr.$field
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
pub mod tlmm_kind;
|
||||
31
src/criteria/tlm/tlm_matchers/tlmm_kind.rs
Normal file
31
src/criteria/tlm/tlm_matchers/tlmm_kind.rs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
use {
|
||||
crate::{
|
||||
criteria::{
|
||||
crit_graph::CritRootCriterion,
|
||||
tlm::{RootMatchers, TlmRootMatcherMap},
|
||||
},
|
||||
tree::ToplevelData,
|
||||
utils::bitflags::BitflagsExt,
|
||||
},
|
||||
jay_config::window::WindowType,
|
||||
};
|
||||
|
||||
pub struct TlmMatchKind {
|
||||
kind: WindowType,
|
||||
}
|
||||
|
||||
impl TlmMatchKind {
|
||||
pub fn new(kind: WindowType) -> TlmMatchKind {
|
||||
Self { kind }
|
||||
}
|
||||
}
|
||||
|
||||
impl CritRootCriterion<ToplevelData> for TlmMatchKind {
|
||||
fn matches(&self, data: &ToplevelData) -> bool {
|
||||
self.kind.0.contains(data.kind.to_window_type().0)
|
||||
}
|
||||
|
||||
fn nodes(roots: &RootMatchers) -> Option<&TlmRootMatcherMap<Self>> {
|
||||
Some(&roots.kinds)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue