From 7c9b71f5c61764be2e1459750dcd7978b8f45e5b Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Thu, 10 Oct 2019 19:44:56 -0700 Subject: criteria: make literal comparison for __focused__ values --- include/sway/criteria.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'include/sway/criteria.h') diff --git a/include/sway/criteria.h b/include/sway/criteria.h index dc8dcb98..1ee69a38 100644 --- a/include/sway/criteria.h +++ b/include/sway/criteria.h @@ -14,29 +14,38 @@ enum criteria_type { CT_NO_FOCUS = 1 << 4, }; +enum pattern_type { + PATTERN_PCRE, + PATTERN_FOCUSED, +}; + +struct pattern { + enum pattern_type match_type; + pcre *regex; +}; + struct criteria { enum criteria_type type; char *raw; // entire criteria string (for logging) char *cmdlist; char *target; // workspace or output name for `assign` criteria - bool autofail; // __focused__ while no focus or n/a for focused view - pcre *title; - pcre *shell; - pcre *app_id; - pcre *con_mark; + struct pattern *title; + struct pattern *shell; + struct pattern *app_id; + struct pattern *con_mark; uint32_t con_id; // internal ID #if HAVE_XWAYLAND - pcre *class; + struct pattern *class; uint32_t id; // X11 window ID - pcre *instance; - pcre *window_role; + struct pattern *instance; + struct pattern *window_role; enum atom_name window_type; #endif bool floating; bool tiling; char urgent; // 'l' for latest or 'o' for oldest - pcre *workspace; + struct pattern *workspace; }; bool criteria_is_empty(struct criteria *criteria); -- cgit v1.2.3