diff options
author | emersion <contact@emersion.fr> | 2018-11-18 00:33:06 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-11-18 00:33:06 +0100 |
commit | cad851805bea6b4777685df1c6adf8cb9fa71835 (patch) | |
tree | 145fcb048cc3df3d04a8b6afb90de68dd2dd80a9 /sway/criteria.c | |
parent | Merge pull request #3142 from RyanDwyer/move-view-properties (diff) | |
download | sway-cad851805bea6b4777685df1c6adf8cb9fa71835.tar.gz sway-cad851805bea6b4777685df1c6adf8cb9fa71835.tar.zst sway-cad851805bea6b4777685df1c6adf8cb9fa71835.zip |
Use #if instead of #ifdef
Diffstat (limited to 'sway/criteria.c')
-rw-r--r-- | sway/criteria.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/sway/criteria.c b/sway/criteria.c index 1d404333..3393852c 100644 --- a/sway/criteria.c +++ b/sway/criteria.c | |||
@@ -21,7 +21,7 @@ bool criteria_is_empty(struct criteria *criteria) { | |||
21 | && !criteria->app_id | 21 | && !criteria->app_id |
22 | && !criteria->con_mark | 22 | && !criteria->con_mark |
23 | && !criteria->con_id | 23 | && !criteria->con_id |
24 | #ifdef HAVE_XWAYLAND | 24 | #if HAVE_XWAYLAND |
25 | && !criteria->class | 25 | && !criteria->class |
26 | && !criteria->id | 26 | && !criteria->id |
27 | && !criteria->instance | 27 | && !criteria->instance |
@@ -42,7 +42,7 @@ void criteria_destroy(struct criteria *criteria) { | |||
42 | pcre_free(criteria->shell); | 42 | pcre_free(criteria->shell); |
43 | pcre_free(criteria->app_id); | 43 | pcre_free(criteria->app_id); |
44 | pcre_free(criteria->con_mark); | 44 | pcre_free(criteria->con_mark); |
45 | #ifdef HAVE_XWAYLAND | 45 | #if HAVE_XWAYLAND |
46 | pcre_free(criteria->class); | 46 | pcre_free(criteria->class); |
47 | pcre_free(criteria->instance); | 47 | pcre_free(criteria->instance); |
48 | pcre_free(criteria->window_role); | 48 | pcre_free(criteria->window_role); |
@@ -55,7 +55,7 @@ static int regex_cmp(const char *item, const pcre *regex) { | |||
55 | return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0); | 55 | return pcre_exec(regex, NULL, item, strlen(item), 0, 0, NULL, 0); |
56 | } | 56 | } |
57 | 57 | ||
58 | #ifdef HAVE_XWAYLAND | 58 | #if HAVE_XWAYLAND |
59 | static bool view_has_window_type(struct sway_view *view, enum atom_name name) { | 59 | static bool view_has_window_type(struct sway_view *view, enum atom_name name) { |
60 | if (view->type != SWAY_VIEW_XWAYLAND) { | 60 | if (view->type != SWAY_VIEW_XWAYLAND) { |
61 | return false; | 61 | return false; |
@@ -140,7 +140,7 @@ static bool criteria_matches_view(struct criteria *criteria, | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | #ifdef HAVE_XWAYLAND | 143 | #if HAVE_XWAYLAND |
144 | if (criteria->id) { // X11 window ID | 144 | if (criteria->id) { // X11 window ID |
145 | uint32_t x11_window_id = view_get_x11_window_id(view); | 145 | uint32_t x11_window_id = view_get_x11_window_id(view); |
146 | if (!x11_window_id || x11_window_id != criteria->id) { | 146 | if (!x11_window_id || x11_window_id != criteria->id) { |
@@ -276,7 +276,7 @@ static bool generate_regex(pcre **regex, char *value) { | |||
276 | return true; | 276 | return true; |
277 | } | 277 | } |
278 | 278 | ||
279 | #ifdef HAVE_XWAYLAND | 279 | #if HAVE_XWAYLAND |
280 | static enum atom_name parse_window_type(const char *type) { | 280 | static enum atom_name parse_window_type(const char *type) { |
281 | if (strcasecmp(type, "normal") == 0) { | 281 | if (strcasecmp(type, "normal") == 0) { |
282 | return NET_WM_WINDOW_TYPE_NORMAL; | 282 | return NET_WM_WINDOW_TYPE_NORMAL; |
@@ -308,7 +308,7 @@ enum criteria_token { | |||
308 | T_CON_ID, | 308 | T_CON_ID, |
309 | T_CON_MARK, | 309 | T_CON_MARK, |
310 | T_FLOATING, | 310 | T_FLOATING, |
311 | #ifdef HAVE_XWAYLAND | 311 | #if HAVE_XWAYLAND |
312 | T_CLASS, | 312 | T_CLASS, |
313 | T_ID, | 313 | T_ID, |
314 | T_INSTANCE, | 314 | T_INSTANCE, |
@@ -331,7 +331,7 @@ static enum criteria_token token_from_name(char *name) { | |||
331 | return T_CON_ID; | 331 | return T_CON_ID; |
332 | } else if (strcmp(name, "con_mark") == 0) { | 332 | } else if (strcmp(name, "con_mark") == 0) { |
333 | return T_CON_MARK; | 333 | return T_CON_MARK; |
334 | #ifdef HAVE_XWAYLAND | 334 | #if HAVE_XWAYLAND |
335 | } else if (strcmp(name, "class") == 0) { | 335 | } else if (strcmp(name, "class") == 0) { |
336 | return T_CLASS; | 336 | return T_CLASS; |
337 | } else if (strcmp(name, "id") == 0) { | 337 | } else if (strcmp(name, "id") == 0) { |
@@ -402,7 +402,7 @@ static char *get_focused_prop(enum criteria_token token) { | |||
402 | snprintf(id_str, id_size, "%zu", id); | 402 | snprintf(id_str, id_size, "%zu", id); |
403 | value = id_str; | 403 | value = id_str; |
404 | break; | 404 | break; |
405 | #ifdef HAVE_XWAYLAND | 405 | #if HAVE_XWAYLAND |
406 | case T_CLASS: | 406 | case T_CLASS: |
407 | value = view_get_class(view); | 407 | value = view_get_class(view); |
408 | break; | 408 | break; |
@@ -474,7 +474,7 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) { | |||
474 | case T_CON_MARK: | 474 | case T_CON_MARK: |
475 | generate_regex(&criteria->con_mark, effective_value); | 475 | generate_regex(&criteria->con_mark, effective_value); |
476 | break; | 476 | break; |
477 | #ifdef HAVE_XWAYLAND | 477 | #if HAVE_XWAYLAND |
478 | case T_CLASS: | 478 | case T_CLASS: |
479 | generate_regex(&criteria->class, effective_value); | 479 | generate_regex(&criteria->class, effective_value); |
480 | break; | 480 | break; |
@@ -577,7 +577,7 @@ struct criteria *criteria_parse(char *raw, char **error_arg) { | |||
577 | ++head; | 577 | ++head; |
578 | 578 | ||
579 | struct criteria *criteria = calloc(1, sizeof(struct criteria)); | 579 | struct criteria *criteria = calloc(1, sizeof(struct criteria)); |
580 | #ifdef HAVE_XWAYLAND | 580 | #if HAVE_XWAYLAND |
581 | criteria->window_type = ATOM_LAST; // default value | 581 | criteria->window_type = ATOM_LAST; // default value |
582 | #endif | 582 | #endif |
583 | char *name = NULL, *value = NULL; | 583 | char *name = NULL, *value = NULL; |