aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index c2e9c07e..39d300ea 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,7 +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
23#ifdef HAVE_XWAYLAND
22 && !criteria->id 24 && !criteria->id
25#endif
23 && !criteria->window_role 26 && !criteria->window_role
24 && !criteria->window_type 27 && !criteria->window_type
25 && !criteria->floating 28 && !criteria->floating
@@ -127,12 +130,14 @@ static bool criteria_matches_view(struct criteria *criteria,
127 } 130 }
128 } 131 }
129 132
133#ifdef HAVE_XWAYLAND
130 if (criteria->id) { // X11 window ID 134 if (criteria->id) { // X11 window ID
131 uint32_t x11_window_id = view_get_x11_window_id(view); 135 uint32_t x11_window_id = view_get_x11_window_id(view);
132 if (!x11_window_id || x11_window_id != criteria->id) { 136 if (!x11_window_id || x11_window_id != criteria->id) {
133 return false; 137 return false;
134 } 138 }
135 } 139 }
140#endif
136 141
137 if (criteria->window_role) { 142 if (criteria->window_role) {
138 // TODO 143 // TODO
@@ -265,7 +270,9 @@ enum criteria_token {
265 T_CON_ID, 270 T_CON_ID,
266 T_CON_MARK, 271 T_CON_MARK,
267 T_FLOATING, 272 T_FLOATING,
273#ifdef HAVE_XWAYLAND
268 T_ID, 274 T_ID,
275#endif
269 T_INSTANCE, 276 T_INSTANCE,
270 T_SHELL, 277 T_SHELL,
271 T_TILING, 278 T_TILING,
@@ -287,8 +294,10 @@ static enum criteria_token token_from_name(char *name) {
287 return T_CON_ID; 294 return T_CON_ID;
288 } else if (strcmp(name, "con_mark") == 0) { 295 } else if (strcmp(name, "con_mark") == 0) {
289 return T_CON_MARK; 296 return T_CON_MARK;
297#ifdef HAVE_XWAYLAND
290 } else if (strcmp(name, "id") == 0) { 298 } else if (strcmp(name, "id") == 0) {
291 return T_ID; 299 return T_ID;
300#endif
292 } else if (strcmp(name, "instance") == 0) { 301 } else if (strcmp(name, "instance") == 0) {
293 return T_INSTANCE; 302 return T_INSTANCE;
294 } else if (strcmp(name, "shell") == 0) { 303 } else if (strcmp(name, "shell") == 0) {
@@ -355,7 +364,9 @@ static char *get_focused_prop(enum criteria_token token) {
355 case T_CON_ID: // These do not support __focused__ 364 case T_CON_ID: // These do not support __focused__
356 case T_CON_MARK: 365 case T_CON_MARK:
357 case T_FLOATING: 366 case T_FLOATING:
367#ifdef HAVE_XWAYLAND
358 case T_ID: 368 case T_ID:
369#endif
359 case T_TILING: 370 case T_TILING:
360 case T_URGENT: 371 case T_URGENT:
361 case T_WINDOW_TYPE: 372 case T_WINDOW_TYPE:
@@ -426,12 +437,14 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
426 case T_WINDOW_TYPE: 437 case T_WINDOW_TYPE:
427 // 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
428 break; 439 break;
440#ifdef HAVE_XWAYLAND
429 case T_ID: 441 case T_ID:
430 criteria->id = strtoul(effective_value, &endptr, 10); 442 criteria->id = strtoul(effective_value, &endptr, 10);
431 if (*endptr != 0) { 443 if (*endptr != 0) {
432 error = strdup("The value for 'id' should be numeric"); 444 error = strdup("The value for 'id' should be numeric");
433 } 445 }
434 break; 446 break;
447#endif
435 case T_FLOATING: 448 case T_FLOATING:
436 criteria->floating = true; 449 criteria->floating = true;
437 break; 450 break;