diff --git a/jay-config-schema/src/input.rs b/jay-config-schema/src/input.rs new file mode 100644 index 00000000..e35cd6bc --- /dev/null +++ b/jay-config-schema/src/input.rs @@ -0,0 +1,17 @@ +#[derive(Debug, Clone)] +pub enum InputMatch { + Any(Vec), + All { + tag: Option, + name: Option, + syspath: Option, + devnode: Option, + is_keyboard: Option, + is_pointer: Option, + is_touch: Option, + is_tablet_tool: Option, + is_tablet_pad: Option, + is_gesture: Option, + is_switch: Option, + }, +} diff --git a/jay-config-schema/src/lib.rs b/jay-config-schema/src/lib.rs index 2706de60..422d92c2 100644 --- a/jay-config-schema/src/lib.rs +++ b/jay-config-schema/src/lib.rs @@ -5,11 +5,13 @@ //! generated config documentation, and compositor-side application code. pub mod animations; +pub mod input; pub mod options; pub mod output; pub mod theme; pub use animations::{AnimationCurveConfig, Animations}; +pub use input::InputMatch; pub use options::{ ColorManagement, Float, FocusHistory, Libei, RepeatRate, SimpleIm, Tearing, UiDrag, Vrr, Xwayland, diff --git a/toml-config/src/config.rs b/toml-config/src/config.rs index 49249b2b..00408b1d 100644 --- a/toml-config/src/config.rs +++ b/toml-config/src/config.rs @@ -44,8 +44,8 @@ use { pub use jay_config_schema::{ AnimationCurveConfig, Animations, ColorManagement, ConfigConnector, ConfigDrmDevice, - ConnectorMatch, DrmDeviceMatch, Float, FocusHistory, Libei, Mode, Output, OutputMatch, - RepeatRate, SimpleIm, Tearing, Theme, UiDrag, Vrr, Xwayland, + ConnectorMatch, DrmDeviceMatch, Float, FocusHistory, InputMatch, Libei, Mode, Output, + OutputMatch, RepeatRate, SimpleIm, Tearing, Theme, UiDrag, Vrr, Xwayland, }; #[derive(Debug, Copy, Clone)] @@ -291,24 +291,6 @@ pub struct WindowMatch { pub content_types: Option, } -#[derive(Debug, Clone)] -pub enum InputMatch { - Any(Vec), - All { - tag: Option, - name: Option, - syspath: Option, - devnode: Option, - is_keyboard: Option, - is_pointer: Option, - is_touch: Option, - is_tablet_tool: Option, - is_tablet_pad: Option, - is_gesture: Option, - is_switch: Option, - }, -} - #[derive(Debug, Clone)] pub struct Input { pub tag: Option, diff --git a/toml-config/src/lib.rs b/toml-config/src/lib.rs index 4a6d5381..b2475670 100644 --- a/toml-config/src/lib.rs +++ b/toml-config/src/lib.rs @@ -637,7 +637,18 @@ impl DrmDeviceMatchExt for DrmDeviceMatch { } } -impl InputMatch { +trait InputMatchExt { + fn matches(&self, d: InputDevice, state: &State) -> bool; + + fn matches_<'a>( + &'a self, + d: InputDevice, + state: &'a State, + active: &mut AHashSet<&'a str>, + ) -> bool; +} + +impl InputMatchExt for InputMatch { fn matches(&self, d: InputDevice, state: &State) -> bool { self.matches_(d, state, &mut AHashSet::new()) }