aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
authorLibravatar Pascal Pascher <pascalpascher@gmx.net>2018-07-25 12:17:10 +0200
committerLibravatar Pascal Pascher <pascalpascher@gmx.net>2018-07-25 12:17:10 +0200
commit79a45d4a4049e3b9235915cd308ed2995623f833 (patch)
tree11c0f4b2eb4338b6ace9f519cc21328d68918b8e /sway/criteria.c
parentstyle fixes, exclude sway/desctop/xwayland.c when enable_xwayland: false (diff)
downloadsway-79a45d4a4049e3b9235915cd308ed2995623f833.tar.gz
sway-79a45d4a4049e3b9235915cd308ed2995623f833.tar.zst
sway-79a45d4a4049e3b9235915cd308ed2995623f833.zip
more style fixes, included "sway/config.h" where needed
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index b2c6edf9..48899125 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -10,6 +10,7 @@
10#include "stringop.h" 10#include "stringop.h"
11#include "list.h" 11#include "list.h"
12#include "log.h" 12#include "log.h"
13#include "config.h"
13 14
14bool criteria_is_empty(struct criteria *criteria) { 15bool criteria_is_empty(struct criteria *criteria) {
15 return !criteria->title 16 return !criteria->title
@@ -19,9 +20,9 @@ bool criteria_is_empty(struct criteria *criteria) {
19 && !criteria->instance 20 && !criteria->instance
20 && !criteria->con_mark 21 && !criteria->con_mark
21 && !criteria->con_id 22 && !criteria->con_id
22 #ifdef HAVE_XWAYLAND 23#ifdef HAVE_XWAYLAND
23 && !criteria->id 24 && !criteria->id
24 #endif 25#endif
25 && !criteria->window_role 26 && !criteria->window_role
26 && !criteria->window_type 27 && !criteria->window_type
27 && !criteria->floating 28 && !criteria->floating
@@ -129,14 +130,14 @@ static bool criteria_matches_view(struct criteria *criteria,
129 } 130 }
130 } 131 }
131 132
132 #ifdef HAVE_XWAYLAND 133#ifdef HAVE_XWAYLAND
133 if (criteria->id) { // X11 window ID 134 if (criteria->id) { // X11 window ID
134 uint32_t x11_window_id = view_get_x11_window_id(view); 135 uint32_t x11_window_id = view_get_x11_window_id(view);
135 if (!x11_window_id || x11_window_id != criteria->id) { 136 if (!x11_window_id || x11_window_id != criteria->id) {
136 return false; 137 return false;
137 } 138 }
138 } 139 }
139 #endif 140#endif
140 141
141 if (criteria->window_role) { 142 if (criteria->window_role) {
142 // TODO 143 // TODO
@@ -293,10 +294,10 @@ static enum criteria_token token_from_name(char *name) {
293 return T_CON_ID; 294 return T_CON_ID;
294 } else if (strcmp(name, "con_mark") == 0) { 295 } else if (strcmp(name, "con_mark") == 0) {
295 return T_CON_MARK; 296 return T_CON_MARK;
296 #ifdef HAVE_XWAYLAND 297#ifdef HAVE_XWAYLAND
297 } else if (strcmp(name, "id") == 0) { 298 } else if (strcmp(name, "id") == 0) {
298 return T_ID; 299 return T_ID;
299 #endif 300#endif
300 } else if (strcmp(name, "instance") == 0) { 301 } else if (strcmp(name, "instance") == 0) {
301 return T_INSTANCE; 302 return T_INSTANCE;
302 } else if (strcmp(name, "shell") == 0) { 303 } else if (strcmp(name, "shell") == 0) {
@@ -363,9 +364,9 @@ static char *get_focused_prop(enum criteria_token token) {
363 case T_CON_ID: // These do not support __focused__ 364 case T_CON_ID: // These do not support __focused__
364 case T_CON_MARK: 365 case T_CON_MARK:
365 case T_FLOATING: 366 case T_FLOATING:
366 #ifdef HAVE_XWAYLAND 367#ifdef HAVE_XWAYLAND
367 case T_ID: 368 case T_ID:
368 #endif 369#endif
369 case T_TILING: 370 case T_TILING:
370 case T_URGENT: 371 case T_URGENT:
371 case T_WINDOW_TYPE: 372 case T_WINDOW_TYPE:
@@ -436,14 +437,14 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
436 case T_WINDOW_TYPE: 437 case T_WINDOW_TYPE:
437 // TODO: This is a string but will be stored as an enum or integer 438 // TODO: This is a string but will be stored as an enum or integer
438 break; 439 break;
439 #ifdef HAVE_XWAYLAND 440#ifdef HAVE_XWAYLAND
440 case T_ID: 441 case T_ID:
441 criteria->id = strtoul(effective_value, &endptr, 10); 442 criteria->id = strtoul(effective_value, &endptr, 10);
442 if (*endptr != 0) { 443 if (*endptr != 0) {
443 error = strdup("The value for 'id' should be numeric"); 444 error = strdup("The value for 'id' should be numeric");
444 } 445 }
445 break; 446 break;
446 #endif 447#endif
447 case T_FLOATING: 448 case T_FLOATING:
448 criteria->floating = true; 449 criteria->floating = true;
449 break; 450 break;