config: rename criterion payload types
This commit is contained in:
parent
a8176b96c3
commit
f9e8d614ce
4 changed files with 75 additions and 75 deletions
|
|
@ -62,7 +62,7 @@ pub struct PollableId(pub u64);
|
||||||
pub const DEFAULT_SEAT_NAME: &str = "default";
|
pub const DEFAULT_SEAT_NAME: &str = "default";
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
pub enum GenericCriterionIpc<T> {
|
pub enum GenericCriterionPayload<T> {
|
||||||
Matcher(T),
|
Matcher(T),
|
||||||
Not(T),
|
Not(T),
|
||||||
List { list: Vec<T>, all: bool },
|
List { list: Vec<T>, all: bool },
|
||||||
|
|
@ -70,8 +70,8 @@ pub enum GenericCriterionIpc<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
pub enum ClientCriterionIpc {
|
pub enum ClientCriterionPayload {
|
||||||
Generic(GenericCriterionIpc<ClientMatcher>),
|
Generic(GenericCriterionPayload<ClientMatcher>),
|
||||||
String {
|
String {
|
||||||
string: String,
|
string: String,
|
||||||
field: ClientCriterionStringField,
|
field: ClientCriterionStringField,
|
||||||
|
|
@ -93,8 +93,8 @@ pub enum ClientCriterionStringField {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
|
||||||
pub enum WindowCriterionIpc {
|
pub enum WindowCriterionPayload {
|
||||||
Generic(GenericCriterionIpc<WindowMatcher>),
|
Generic(GenericCriterionPayload<WindowMatcher>),
|
||||||
String {
|
String {
|
||||||
string: String,
|
string: String,
|
||||||
field: WindowCriterionStringField,
|
field: WindowCriterionStringField,
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
_private::{
|
_private::{
|
||||||
ClientCriterionIpc, ClientCriterionStringField, GenericCriterionIpc, PollableId,
|
ClientCriterionPayload, ClientCriterionStringField, GenericCriterionPayload, PollableId,
|
||||||
ServerHandler, Unref, WindowCriterionIpc, WindowCriterionStringField, WireMode,
|
ServerHandler, Unref, WindowCriterionPayload, WindowCriterionStringField, WireMode,
|
||||||
messages::{
|
messages::{
|
||||||
ClientMessage, InitMessage, Response, ServerFeature, ServerMessage, WorkspaceSource,
|
ClientMessage, InitMessage, Response, ServerFeature, ServerMessage, WorkspaceSource,
|
||||||
},
|
},
|
||||||
|
|
@ -1689,7 +1689,7 @@ impl ConfigClient {
|
||||||
criterion: GenericCriterion<'_, Crit, Matcher>,
|
criterion: GenericCriterion<'_, Crit, Matcher>,
|
||||||
child: bool,
|
child: bool,
|
||||||
create_child_matcher: impl Fn(Crit) -> (Matcher, bool),
|
create_child_matcher: impl Fn(Crit) -> (Matcher, bool),
|
||||||
create_matcher: impl Fn(GenericCriterionIpc<Matcher>) -> Matcher,
|
create_matcher: impl Fn(GenericCriterionPayload<Matcher>) -> Matcher,
|
||||||
destroy_matcher: impl Fn(Matcher),
|
destroy_matcher: impl Fn(Matcher),
|
||||||
) -> (Matcher, bool)
|
) -> (Matcher, bool)
|
||||||
where
|
where
|
||||||
|
|
@ -1716,18 +1716,18 @@ impl ConfigClient {
|
||||||
if child {
|
if child {
|
||||||
return (m, false);
|
return (m, false);
|
||||||
}
|
}
|
||||||
GenericCriterionIpc::Matcher(m)
|
GenericCriterionPayload::Matcher(m)
|
||||||
}
|
}
|
||||||
GenericCriterion::Not(c) => GenericCriterionIpc::Not(create_child_matcher(*c)),
|
GenericCriterion::Not(c) => GenericCriterionPayload::Not(create_child_matcher(*c)),
|
||||||
GenericCriterion::All(l) => GenericCriterionIpc::List {
|
GenericCriterion::All(l) => GenericCriterionPayload::List {
|
||||||
list: create_vec(l),
|
list: create_vec(l),
|
||||||
all: true,
|
all: true,
|
||||||
},
|
},
|
||||||
GenericCriterion::Any(l) => GenericCriterionIpc::List {
|
GenericCriterion::Any(l) => GenericCriterionPayload::List {
|
||||||
list: create_vec(l),
|
list: create_vec(l),
|
||||||
all: false,
|
all: false,
|
||||||
},
|
},
|
||||||
GenericCriterion::Exactly(num, l) => GenericCriterionIpc::Exactly {
|
GenericCriterion::Exactly(num, l) => GenericCriterionPayload::Exactly {
|
||||||
list: create_vec(l),
|
list: create_vec(l),
|
||||||
num,
|
num,
|
||||||
},
|
},
|
||||||
|
|
@ -1750,7 +1750,7 @@ impl ConfigClient {
|
||||||
) -> (ClientMatcher, bool) {
|
) -> (ClientMatcher, bool) {
|
||||||
macro_rules! string {
|
macro_rules! string {
|
||||||
($t:expr, $field:ident, $regex:expr) => {
|
($t:expr, $field:ident, $regex:expr) => {
|
||||||
ClientCriterionIpc::String {
|
ClientCriterionPayload::String {
|
||||||
string: $t.to_string(),
|
string: $t.to_string(),
|
||||||
field: ClientCriterionStringField::$field,
|
field: ClientCriterionStringField::$field,
|
||||||
regex: $regex,
|
regex: $regex,
|
||||||
|
|
@ -1759,7 +1759,7 @@ impl ConfigClient {
|
||||||
}
|
}
|
||||||
let create_matcher = |criterion| {
|
let create_matcher = |criterion| {
|
||||||
let res = self.send_with_response(&ClientMessage::CreateClientMatcher {
|
let res = self.send_with_response(&ClientMessage::CreateClientMatcher {
|
||||||
criterion: ClientCriterionIpc::Generic(criterion),
|
criterion: ClientCriterionPayload::Generic(criterion),
|
||||||
});
|
});
|
||||||
get_response!(res, ClientMatcher(0), CreateClientMatcher { matcher });
|
get_response!(res, ClientMatcher(0), CreateClientMatcher { matcher });
|
||||||
matcher
|
matcher
|
||||||
|
|
@ -1788,10 +1788,10 @@ impl ConfigClient {
|
||||||
ClientCriterion::SandboxAppIdRegex(t) => string!(t, SandboxAppId, true),
|
ClientCriterion::SandboxAppIdRegex(t) => string!(t, SandboxAppId, true),
|
||||||
ClientCriterion::SandboxInstanceId(t) => string!(t, SandboxInstanceId, false),
|
ClientCriterion::SandboxInstanceId(t) => string!(t, SandboxInstanceId, false),
|
||||||
ClientCriterion::SandboxInstanceIdRegex(t) => string!(t, SandboxInstanceId, true),
|
ClientCriterion::SandboxInstanceIdRegex(t) => string!(t, SandboxInstanceId, true),
|
||||||
ClientCriterion::Sandboxed => ClientCriterionIpc::Sandboxed,
|
ClientCriterion::Sandboxed => ClientCriterionPayload::Sandboxed,
|
||||||
ClientCriterion::Uid(p) => ClientCriterionIpc::Uid(p),
|
ClientCriterion::Uid(p) => ClientCriterionPayload::Uid(p),
|
||||||
ClientCriterion::Pid(p) => ClientCriterionIpc::Pid(p),
|
ClientCriterion::Pid(p) => ClientCriterionPayload::Pid(p),
|
||||||
ClientCriterion::IsXwayland => ClientCriterionIpc::IsXwayland,
|
ClientCriterion::IsXwayland => ClientCriterionPayload::IsXwayland,
|
||||||
ClientCriterion::Comm(t) => string!(t, Comm, false),
|
ClientCriterion::Comm(t) => string!(t, Comm, false),
|
||||||
ClientCriterion::CommRegex(t) => string!(t, Comm, true),
|
ClientCriterion::CommRegex(t) => string!(t, Comm, true),
|
||||||
ClientCriterion::Exe(t) => string!(t, Exe, false),
|
ClientCriterion::Exe(t) => string!(t, Exe, false),
|
||||||
|
|
@ -1851,7 +1851,7 @@ impl ConfigClient {
|
||||||
) -> (WindowMatcher, bool) {
|
) -> (WindowMatcher, bool) {
|
||||||
macro_rules! string {
|
macro_rules! string {
|
||||||
($t:expr, $field:ident, $regex:expr) => {
|
($t:expr, $field:ident, $regex:expr) => {
|
||||||
WindowCriterionIpc::String {
|
WindowCriterionPayload::String {
|
||||||
string: $t.to_string(),
|
string: $t.to_string(),
|
||||||
field: WindowCriterionStringField::$field,
|
field: WindowCriterionStringField::$field,
|
||||||
regex: $regex,
|
regex: $regex,
|
||||||
|
|
@ -1860,7 +1860,7 @@ impl ConfigClient {
|
||||||
}
|
}
|
||||||
let create_matcher = |criterion| {
|
let create_matcher = |criterion| {
|
||||||
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher {
|
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher {
|
||||||
criterion: WindowCriterionIpc::Generic(criterion),
|
criterion: WindowCriterionPayload::Generic(criterion),
|
||||||
});
|
});
|
||||||
get_response!(res, WindowMatcher(0), CreateWindowMatcher { matcher });
|
get_response!(res, WindowMatcher(0), CreateWindowMatcher { matcher });
|
||||||
matcher
|
matcher
|
||||||
|
|
@ -1884,24 +1884,24 @@ impl ConfigClient {
|
||||||
WindowCriterion::All(c) => return generic(GenericCriterion::All(c)),
|
WindowCriterion::All(c) => return generic(GenericCriterion::All(c)),
|
||||||
WindowCriterion::Any(c) => return generic(GenericCriterion::Any(c)),
|
WindowCriterion::Any(c) => return generic(GenericCriterion::Any(c)),
|
||||||
WindowCriterion::Exactly(n, c) => return generic(GenericCriterion::Exactly(n, c)),
|
WindowCriterion::Exactly(n, c) => return generic(GenericCriterion::Exactly(n, c)),
|
||||||
WindowCriterion::Types(t) => WindowCriterionIpc::Types(t),
|
WindowCriterion::Types(t) => WindowCriterionPayload::Types(t),
|
||||||
WindowCriterion::Client(c) => {
|
WindowCriterion::Client(c) => {
|
||||||
let (matcher, original) = self.create_client_matcher_(*c, true);
|
let (matcher, original) = self.create_client_matcher_(*c, true);
|
||||||
if original {
|
if original {
|
||||||
_destroy_client_matcher = on_drop(move || matcher.destroy());
|
_destroy_client_matcher = on_drop(move || matcher.destroy());
|
||||||
}
|
}
|
||||||
WindowCriterionIpc::Client(matcher)
|
WindowCriterionPayload::Client(matcher)
|
||||||
}
|
}
|
||||||
WindowCriterion::Title(t) => string!(t, Title, false),
|
WindowCriterion::Title(t) => string!(t, Title, false),
|
||||||
WindowCriterion::TitleRegex(t) => string!(t, Title, true),
|
WindowCriterion::TitleRegex(t) => string!(t, Title, true),
|
||||||
WindowCriterion::AppId(t) => string!(t, AppId, false),
|
WindowCriterion::AppId(t) => string!(t, AppId, false),
|
||||||
WindowCriterion::AppIdRegex(t) => string!(t, AppId, true),
|
WindowCriterion::AppIdRegex(t) => string!(t, AppId, true),
|
||||||
WindowCriterion::Floating => WindowCriterionIpc::Floating,
|
WindowCriterion::Floating => WindowCriterionPayload::Floating,
|
||||||
WindowCriterion::Visible => WindowCriterionIpc::Visible,
|
WindowCriterion::Visible => WindowCriterionPayload::Visible,
|
||||||
WindowCriterion::Urgent => WindowCriterionIpc::Urgent,
|
WindowCriterion::Urgent => WindowCriterionPayload::Urgent,
|
||||||
WindowCriterion::Focus(seat) => WindowCriterionIpc::SeatFocus(seat),
|
WindowCriterion::Focus(seat) => WindowCriterionPayload::SeatFocus(seat),
|
||||||
WindowCriterion::Fullscreen => WindowCriterionIpc::Fullscreen,
|
WindowCriterion::Fullscreen => WindowCriterionPayload::Fullscreen,
|
||||||
WindowCriterion::JustMapped => WindowCriterionIpc::JustMapped,
|
WindowCriterion::JustMapped => WindowCriterionPayload::JustMapped,
|
||||||
WindowCriterion::Tag(t) => string!(t, Tag, false),
|
WindowCriterion::Tag(t) => string!(t, Tag, false),
|
||||||
WindowCriterion::TagRegex(t) => string!(t, Tag, true),
|
WindowCriterion::TagRegex(t) => string!(t, Tag, true),
|
||||||
WindowCriterion::XClass(t) => string!(t, XClass, false),
|
WindowCriterion::XClass(t) => string!(t, XClass, false),
|
||||||
|
|
@ -1910,10 +1910,10 @@ impl ConfigClient {
|
||||||
WindowCriterion::XInstanceRegex(t) => string!(t, XInstance, true),
|
WindowCriterion::XInstanceRegex(t) => string!(t, XInstance, true),
|
||||||
WindowCriterion::XRole(t) => string!(t, XRole, false),
|
WindowCriterion::XRole(t) => string!(t, XRole, false),
|
||||||
WindowCriterion::XRoleRegex(t) => string!(t, XRole, true),
|
WindowCriterion::XRoleRegex(t) => string!(t, XRole, true),
|
||||||
WindowCriterion::Workspace(t) => WindowCriterionIpc::Workspace(t),
|
WindowCriterion::Workspace(t) => WindowCriterionPayload::Workspace(t),
|
||||||
WindowCriterion::WorkspaceName(t) => string!(t, Workspace, false),
|
WindowCriterion::WorkspaceName(t) => string!(t, Workspace, false),
|
||||||
WindowCriterion::WorkspaceNameRegex(t) => string!(t, Workspace, true),
|
WindowCriterion::WorkspaceNameRegex(t) => string!(t, Workspace, true),
|
||||||
WindowCriterion::ContentTypes(t) => WindowCriterionIpc::ContentTypes(t),
|
WindowCriterion::ContentTypes(t) => WindowCriterionPayload::ContentTypes(t),
|
||||||
};
|
};
|
||||||
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher { criterion });
|
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher { criterion });
|
||||||
get_response!(
|
get_response!(
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use {
|
use {
|
||||||
crate::{
|
crate::{
|
||||||
_private::{ClientCriterionIpc, PollableId, WindowCriterionIpc, WireMode},
|
_private::{ClientCriterionPayload, PollableId, WindowCriterionPayload, WireMode},
|
||||||
Axis, Direction, PciId, Workspace,
|
Axis, Direction, PciId, Workspace,
|
||||||
client::{Client, ClientMatcher},
|
client::{Client, ClientMatcher},
|
||||||
input::{
|
input::{
|
||||||
|
|
@ -707,7 +707,7 @@ pub enum ClientMessage<'a> {
|
||||||
pinned: bool,
|
pinned: bool,
|
||||||
},
|
},
|
||||||
CreateClientMatcher {
|
CreateClientMatcher {
|
||||||
criterion: ClientCriterionIpc,
|
criterion: ClientCriterionPayload,
|
||||||
},
|
},
|
||||||
DestroyClientMatcher {
|
DestroyClientMatcher {
|
||||||
matcher: ClientMatcher,
|
matcher: ClientMatcher,
|
||||||
|
|
@ -716,7 +716,7 @@ pub enum ClientMessage<'a> {
|
||||||
matcher: ClientMatcher,
|
matcher: ClientMatcher,
|
||||||
},
|
},
|
||||||
CreateWindowMatcher {
|
CreateWindowMatcher {
|
||||||
criterion: WindowCriterionIpc,
|
criterion: WindowCriterionPayload,
|
||||||
},
|
},
|
||||||
DestroyWindowMatcher {
|
DestroyWindowMatcher {
|
||||||
matcher: WindowMatcher,
|
matcher: WindowMatcher,
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,8 @@ use {
|
||||||
},
|
},
|
||||||
jay_config::{
|
jay_config::{
|
||||||
_private::{
|
_private::{
|
||||||
ClientCriterionIpc, ClientCriterionStringField, GenericCriterionIpc, PollableId,
|
ClientCriterionPayload, ClientCriterionStringField, GenericCriterionPayload, PollableId,
|
||||||
ConfigHandler, Unref, WindowCriterionIpc, WindowCriterionStringField, WireMode,
|
ConfigHandler, Unref, WindowCriterionPayload, WindowCriterionStringField, WireMode,
|
||||||
messages::{ClientMessage, Response, ServerMessage, WorkspaceSource},
|
messages::{ClientMessage, Response, ServerMessage, WorkspaceSource},
|
||||||
},
|
},
|
||||||
Axis, Direction, Workspace,
|
Axis, Direction, Workspace,
|
||||||
|
|
@ -114,21 +114,21 @@ pub(super) struct ConfigProxyHandler {
|
||||||
|
|
||||||
pub client_matcher_ids: NumCell<u64>,
|
pub client_matcher_ids: NumCell<u64>,
|
||||||
pub client_matchers:
|
pub client_matchers:
|
||||||
CopyHashMap<ClientMatcher, Rc<CachedCriterion<ClientCriterionIpc, Client>>>,
|
CopyHashMap<ClientMatcher, Rc<CachedCriterion<ClientCriterionPayload, Client>>>,
|
||||||
pub client_matcher_cache: CriterionCache<ClientCriterionIpc, Client>,
|
pub client_matcher_cache: CriterionCache<ClientCriterionPayload, Client>,
|
||||||
pub client_matcher_leafs: CopyHashMap<ClientMatcher, Rc<ClmLeafMatcher>>,
|
pub client_matcher_leafs: CopyHashMap<ClientMatcher, Rc<ClmLeafMatcher>>,
|
||||||
pub window_matcher_ids: NumCell<u64>,
|
pub window_matcher_ids: NumCell<u64>,
|
||||||
pub window_matchers:
|
pub window_matchers:
|
||||||
CopyHashMap<WindowMatcher, Rc<CachedCriterion<WindowCriterionIpc, ToplevelData>>>,
|
CopyHashMap<WindowMatcher, Rc<CachedCriterion<WindowCriterionPayload, ToplevelData>>>,
|
||||||
pub window_matcher_cache: CriterionCache<WindowCriterionIpc, ToplevelData>,
|
pub window_matcher_cache: CriterionCache<WindowCriterionPayload, ToplevelData>,
|
||||||
pub window_matcher_leafs: CopyHashMap<WindowMatcher, Rc<TlmLeafMatcher>>,
|
pub window_matcher_leafs: CopyHashMap<WindowMatcher, Rc<TlmLeafMatcher>>,
|
||||||
pub window_matcher_std_kinds: Rc<TlmUpstreamNode>,
|
pub window_matcher_std_kinds: Rc<TlmUpstreamNode>,
|
||||||
pub window_matcher_no_auto_focus:
|
pub window_matcher_no_auto_focus:
|
||||||
CopyHashMap<WindowMatcher, Rc<CachedCriterion<WindowCriterionIpc, ToplevelData>>>,
|
CopyHashMap<WindowMatcher, Rc<CachedCriterion<WindowCriterionPayload, ToplevelData>>>,
|
||||||
pub window_matcher_initial_tile_state: CopyHashMap<
|
pub window_matcher_initial_tile_state: CopyHashMap<
|
||||||
WindowMatcher,
|
WindowMatcher,
|
||||||
(
|
(
|
||||||
Rc<CachedCriterion<WindowCriterionIpc, ToplevelData>>,
|
Rc<CachedCriterion<WindowCriterionPayload, ToplevelData>>,
|
||||||
TileState,
|
TileState,
|
||||||
),
|
),
|
||||||
>,
|
>,
|
||||||
|
|
@ -2072,7 +2072,7 @@ impl ConfigProxyHandler {
|
||||||
fn get_client_matcher(
|
fn get_client_matcher(
|
||||||
&self,
|
&self,
|
||||||
matcher: ClientMatcher,
|
matcher: ClientMatcher,
|
||||||
) -> Result<Rc<CachedCriterion<ClientCriterionIpc, Client>>, CphError> {
|
) -> Result<Rc<CachedCriterion<ClientCriterionPayload, Client>>, CphError> {
|
||||||
self.client_matchers
|
self.client_matchers
|
||||||
.get(&matcher)
|
.get(&matcher)
|
||||||
.ok_or(CphError::ClientMatcherDoesNotExist(matcher))
|
.ok_or(CphError::ClientMatcherDoesNotExist(matcher))
|
||||||
|
|
@ -2080,23 +2080,23 @@ impl ConfigProxyHandler {
|
||||||
|
|
||||||
fn sort_generic_matcher<T, K>(
|
fn sort_generic_matcher<T, K>(
|
||||||
&self,
|
&self,
|
||||||
generic: &mut GenericCriterionIpc<T>,
|
generic: &mut GenericCriterionPayload<T>,
|
||||||
key: impl FnMut(&T) -> K,
|
key: impl FnMut(&T) -> K,
|
||||||
) where
|
) where
|
||||||
K: Ord,
|
K: Ord,
|
||||||
{
|
{
|
||||||
match generic {
|
match generic {
|
||||||
GenericCriterionIpc::List { list, .. } | GenericCriterionIpc::Exactly { list, .. } => {
|
GenericCriterionPayload::List { list, .. } | GenericCriterionPayload::Exactly { list, .. } => {
|
||||||
list.sort_by_key(key)
|
list.sort_by_key(key)
|
||||||
}
|
}
|
||||||
GenericCriterionIpc::Matcher(_) | GenericCriterionIpc::Not(_) => {}
|
GenericCriterionPayload::Matcher(_) | GenericCriterionPayload::Not(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_generic_matcher<Crit, Matcher, Mgr>(
|
fn create_generic_matcher<Crit, Matcher, Mgr>(
|
||||||
&self,
|
&self,
|
||||||
mgr: &Mgr,
|
mgr: &Mgr,
|
||||||
generic: &GenericCriterionIpc<Matcher>,
|
generic: &GenericCriterionPayload<Matcher>,
|
||||||
upstream: &mut Vec<Rc<CachedCriterion<Crit, Mgr::Target>>>,
|
upstream: &mut Vec<Rc<CachedCriterion<Crit, Mgr::Target>>>,
|
||||||
get_matcher: impl Fn(&Matcher) -> Result<Rc<CachedCriterion<Crit, Mgr::Target>>, CphError>,
|
get_matcher: impl Fn(&Matcher) -> Result<Rc<CachedCriterion<Crit, Mgr::Target>>, CphError>,
|
||||||
) -> Result<Rc<dyn CritUpstreamNode<Mgr::Target>>, CphError>
|
) -> Result<Rc<dyn CritUpstreamNode<Mgr::Target>>, CphError>
|
||||||
|
|
@ -2111,16 +2111,16 @@ impl ConfigProxyHandler {
|
||||||
Ok(node)
|
Ok(node)
|
||||||
};
|
};
|
||||||
let node = match generic {
|
let node = match generic {
|
||||||
GenericCriterionIpc::Matcher(m) => get_matcher(m)?.node.clone(),
|
GenericCriterionPayload::Matcher(m) => get_matcher(m)?.node.clone(),
|
||||||
GenericCriterionIpc::Not(m) => mgr.not(&get_upstream(m)?),
|
GenericCriterionPayload::Not(m) => mgr.not(&get_upstream(m)?),
|
||||||
GenericCriterionIpc::List { list, all } => {
|
GenericCriterionPayload::List { list, all } => {
|
||||||
let mut m = Vec::with_capacity(list.len());
|
let mut m = Vec::with_capacity(list.len());
|
||||||
for c in list {
|
for c in list {
|
||||||
m.push(get_upstream(c)?);
|
m.push(get_upstream(c)?);
|
||||||
}
|
}
|
||||||
mgr.list(&m, *all)
|
mgr.list(&m, *all)
|
||||||
}
|
}
|
||||||
GenericCriterionIpc::Exactly { list, num } => {
|
GenericCriterionPayload::Exactly { list, num } => {
|
||||||
let mut m = Vec::with_capacity(list.len());
|
let mut m = Vec::with_capacity(list.len());
|
||||||
for c in list {
|
for c in list {
|
||||||
m.push(get_upstream(c)?);
|
m.push(get_upstream(c)?);
|
||||||
|
|
@ -2133,9 +2133,9 @@ impl ConfigProxyHandler {
|
||||||
|
|
||||||
fn handle_create_client_matcher(
|
fn handle_create_client_matcher(
|
||||||
&self,
|
&self,
|
||||||
mut criterion: ClientCriterionIpc,
|
mut criterion: ClientCriterionPayload,
|
||||||
) -> Result<(), CphError> {
|
) -> Result<(), CphError> {
|
||||||
if let ClientCriterionIpc::Generic(generic) = &mut criterion {
|
if let ClientCriterionPayload::Generic(generic) = &mut criterion {
|
||||||
self.sort_generic_matcher(generic, |m| m.0);
|
self.sort_generic_matcher(generic, |m| m.0);
|
||||||
}
|
}
|
||||||
let id = ClientMatcher(self.client_matcher_ids.fetch_add(1));
|
let id = ClientMatcher(self.client_matcher_ids.fetch_add(1));
|
||||||
|
|
@ -2150,10 +2150,10 @@ impl ConfigProxyHandler {
|
||||||
let mgr = &self.state.cl_matcher_manager;
|
let mgr = &self.state.cl_matcher_manager;
|
||||||
let mut upstream = vec![];
|
let mut upstream = vec![];
|
||||||
let matcher = match &criterion {
|
let matcher = match &criterion {
|
||||||
ClientCriterionIpc::Generic(m) => {
|
ClientCriterionPayload::Generic(m) => {
|
||||||
self.create_generic_matcher(mgr, m, &mut upstream, |m| self.get_client_matcher(*m))?
|
self.create_generic_matcher(mgr, m, &mut upstream, |m| self.get_client_matcher(*m))?
|
||||||
}
|
}
|
||||||
ClientCriterionIpc::String {
|
ClientCriterionPayload::String {
|
||||||
string,
|
string,
|
||||||
field,
|
field,
|
||||||
regex,
|
regex,
|
||||||
|
|
@ -2175,10 +2175,10 @@ impl ConfigProxyHandler {
|
||||||
ClientCriterionStringField::Exe => mgr.exe(needle),
|
ClientCriterionStringField::Exe => mgr.exe(needle),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ClientCriterionIpc::Sandboxed => mgr.sandboxed(),
|
ClientCriterionPayload::Sandboxed => mgr.sandboxed(),
|
||||||
ClientCriterionIpc::Uid(p) => mgr.uid(*p),
|
ClientCriterionPayload::Uid(p) => mgr.uid(*p),
|
||||||
ClientCriterionIpc::Pid(p) => mgr.pid(*p),
|
ClientCriterionPayload::Pid(p) => mgr.pid(*p),
|
||||||
ClientCriterionIpc::IsXwayland => mgr.is_xwayland(),
|
ClientCriterionPayload::IsXwayland => mgr.is_xwayland(),
|
||||||
};
|
};
|
||||||
let cached = Rc::new(CachedCriterion {
|
let cached = Rc::new(CachedCriterion {
|
||||||
crit: criterion.clone(),
|
crit: criterion.clone(),
|
||||||
|
|
@ -2225,7 +2225,7 @@ impl ConfigProxyHandler {
|
||||||
fn get_window_matcher(
|
fn get_window_matcher(
|
||||||
&self,
|
&self,
|
||||||
matcher: WindowMatcher,
|
matcher: WindowMatcher,
|
||||||
) -> Result<Rc<CachedCriterion<WindowCriterionIpc, ToplevelData>>, CphError> {
|
) -> Result<Rc<CachedCriterion<WindowCriterionPayload, ToplevelData>>, CphError> {
|
||||||
self.window_matchers
|
self.window_matchers
|
||||||
.get(&matcher)
|
.get(&matcher)
|
||||||
.ok_or(CphError::WindowMatcherDoesNotExist(matcher))
|
.ok_or(CphError::WindowMatcherDoesNotExist(matcher))
|
||||||
|
|
@ -2233,9 +2233,9 @@ impl ConfigProxyHandler {
|
||||||
|
|
||||||
fn handle_create_window_matcher(
|
fn handle_create_window_matcher(
|
||||||
&self,
|
&self,
|
||||||
mut criterion: WindowCriterionIpc,
|
mut criterion: WindowCriterionPayload,
|
||||||
) -> Result<(), CphError> {
|
) -> Result<(), CphError> {
|
||||||
if let WindowCriterionIpc::Generic(generic) = &mut criterion {
|
if let WindowCriterionPayload::Generic(generic) = &mut criterion {
|
||||||
self.sort_generic_matcher(generic, |m| m.0);
|
self.sort_generic_matcher(generic, |m| m.0);
|
||||||
}
|
}
|
||||||
let id = WindowMatcher(self.window_matcher_ids.fetch_add(1));
|
let id = WindowMatcher(self.window_matcher_ids.fetch_add(1));
|
||||||
|
|
@ -2250,10 +2250,10 @@ impl ConfigProxyHandler {
|
||||||
let mgr = &self.state.tl_matcher_manager;
|
let mgr = &self.state.tl_matcher_manager;
|
||||||
let mut upstream = vec![];
|
let mut upstream = vec![];
|
||||||
let matcher = match &criterion {
|
let matcher = match &criterion {
|
||||||
WindowCriterionIpc::Generic(m) => {
|
WindowCriterionPayload::Generic(m) => {
|
||||||
self.create_generic_matcher(mgr, m, &mut upstream, |m| self.get_window_matcher(*m))?
|
self.create_generic_matcher(mgr, m, &mut upstream, |m| self.get_window_matcher(*m))?
|
||||||
}
|
}
|
||||||
WindowCriterionIpc::String {
|
WindowCriterionPayload::String {
|
||||||
string,
|
string,
|
||||||
field,
|
field,
|
||||||
regex,
|
regex,
|
||||||
|
|
@ -2275,21 +2275,21 @@ impl ConfigProxyHandler {
|
||||||
WindowCriterionStringField::Workspace => mgr.workspace(needle),
|
WindowCriterionStringField::Workspace => mgr.workspace(needle),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
WindowCriterionIpc::Types(t) => mgr.kind(*t),
|
WindowCriterionPayload::Types(t) => mgr.kind(*t),
|
||||||
WindowCriterionIpc::Client(c) => {
|
WindowCriterionPayload::Client(c) => {
|
||||||
self.state.cl_matcher_manager.rematch_all(&self.state);
|
self.state.cl_matcher_manager.rematch_all(&self.state);
|
||||||
mgr.client(&self.state, &self.get_client_matcher(*c)?.node)
|
mgr.client(&self.state, &self.get_client_matcher(*c)?.node)
|
||||||
}
|
}
|
||||||
WindowCriterionIpc::Floating => mgr.floating(),
|
WindowCriterionPayload::Floating => mgr.floating(),
|
||||||
WindowCriterionIpc::Visible => mgr.visible(),
|
WindowCriterionPayload::Visible => mgr.visible(),
|
||||||
WindowCriterionIpc::Urgent => mgr.urgent(),
|
WindowCriterionPayload::Urgent => mgr.urgent(),
|
||||||
WindowCriterionIpc::SeatFocus(seat) => mgr.seat_focus(&*self.get_seat(*seat)?),
|
WindowCriterionPayload::SeatFocus(seat) => mgr.seat_focus(&*self.get_seat(*seat)?),
|
||||||
WindowCriterionIpc::Fullscreen => mgr.fullscreen(),
|
WindowCriterionPayload::Fullscreen => mgr.fullscreen(),
|
||||||
WindowCriterionIpc::JustMapped => mgr.just_mapped(),
|
WindowCriterionPayload::JustMapped => mgr.just_mapped(),
|
||||||
WindowCriterionIpc::Workspace(w) => mgr.workspace(CritLiteralOrRegex::Literal(
|
WindowCriterionPayload::Workspace(w) => mgr.workspace(CritLiteralOrRegex::Literal(
|
||||||
self.get_workspace(*w)?.to_string(),
|
self.get_workspace(*w)?.to_string(),
|
||||||
)),
|
)),
|
||||||
WindowCriterionIpc::ContentTypes(t) => mgr.content_type(*t),
|
WindowCriterionPayload::ContentTypes(t) => mgr.content_type(*t),
|
||||||
};
|
};
|
||||||
let cached = Rc::new(CachedCriterion {
|
let cached = Rc::new(CachedCriterion {
|
||||||
crit: criterion.clone(),
|
crit: criterion.clone(),
|
||||||
|
|
@ -2319,7 +2319,7 @@ impl ConfigProxyHandler {
|
||||||
}
|
}
|
||||||
let upstream = self.get_window_matcher(matcher)?;
|
let upstream = self.get_window_matcher(matcher)?;
|
||||||
let mut node = upstream.node.clone();
|
let mut node = upstream.node.clone();
|
||||||
if !upstream.any(&|crit| matches!(crit, WindowCriterionIpc::Types(_))) {
|
if !upstream.any(&|crit| matches!(crit, WindowCriterionPayload::Types(_))) {
|
||||||
let list = [self.window_matcher_std_kinds.clone(), node];
|
let list = [self.window_matcher_std_kinds.clone(), node];
|
||||||
node = self.state.tl_matcher_manager.list(&list, true);
|
node = self.state.tl_matcher_manager.list(&list, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue