1
0
Fork 0
forked from wry/wry

config: move input match schema into schema crate

This commit is contained in:
kossLAN 2026-05-29 17:05:46 -04:00
parent fb65585bfa
commit 81a1a865a1
No known key found for this signature in database
4 changed files with 33 additions and 21 deletions

View file

@ -0,0 +1,17 @@
#[derive(Debug, Clone)]
pub enum InputMatch {
Any(Vec<InputMatch>),
All {
tag: Option<String>,
name: Option<String>,
syspath: Option<String>,
devnode: Option<String>,
is_keyboard: Option<bool>,
is_pointer: Option<bool>,
is_touch: Option<bool>,
is_tablet_tool: Option<bool>,
is_tablet_pad: Option<bool>,
is_gesture: Option<bool>,
is_switch: Option<bool>,
},
}

View file

@ -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,

View file

@ -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<ContentType>,
}
#[derive(Debug, Clone)]
pub enum InputMatch {
Any(Vec<InputMatch>),
All {
tag: Option<String>,
name: Option<String>,
syspath: Option<String>,
devnode: Option<String>,
is_keyboard: Option<bool>,
is_pointer: Option<bool>,
is_touch: Option<bool>,
is_tablet_tool: Option<bool>,
is_tablet_pad: Option<bool>,
is_gesture: Option<bool>,
is_switch: Option<bool>,
},
}
#[derive(Debug, Clone)]
pub struct Input {
pub tag: Option<String>,

View file

@ -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())
}