query: fix three-state-parameter parsing, simplify match logic

Fixes: #2288.
This commit is contained in:
Andrew J. Hesford 2024-10-31 09:59:22 -04:00
parent 2b877d2293
commit 14aad38a2c
3 changed files with 74 additions and 92 deletions

View file

@ -30,16 +30,19 @@ other_instances_exist(struct view *self, struct view_query *query)
static bool
view_matches_criteria(struct window_rule *rule, struct view *view)
{
struct view_query query = {0};
query.identifier = rule->identifier;
query.title = rule->title;
query.window_type = rule->window_type;
query.sandbox_engine = rule->sandbox_engine;
query.sandbox_app_id = rule->sandbox_app_id;
struct view_query query = {
.identifier = rule->identifier,
.title = rule->title,
.window_type = rule->window_type,
.sandbox_engine = rule->sandbox_engine,
.sandbox_app_id = rule->sandbox_app_id,
.maximized = VIEW_AXIS_INVALID,
};
if (rule->match_once && other_instances_exist(view, &query)) {
return false;
}
return view_matches_query(view, &query);
}