aboutsummaryrefslogtreecommitdiffstats
path: root/sway/criteria.c
diff options
context:
space:
mode:
authorLibravatar Pascal Pascher <aur@clouddrop.de>2018-07-24 22:16:06 +0200
committerLibravatar Pascal Pascher <aur@clouddrop.de>2018-07-24 22:16:06 +0200
commit24ad1c3983192b47345566fd876e26b45160d68e (patch)
treeb617f8d15cb20897b1c016fb67fab80d7245c66a /sway/criteria.c
parentMerge pull request #2165 from swaywm/pid-workspaces (diff)
downloadsway-24ad1c3983192b47345566fd876e26b45160d68e.tar.gz
sway-24ad1c3983192b47345566fd876e26b45160d68e.tar.zst
sway-24ad1c3983192b47345566fd876e26b45160d68e.zip
Added meson option "enable_xwayland" (default: true) to enable/disable xwayland support
Diffstat (limited to 'sway/criteria.c')
-rw-r--r--sway/criteria.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sway/criteria.c b/sway/criteria.c
index c2e9c07e..b2c6edf9 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -19,7 +19,9 @@ bool criteria_is_empty(struct criteria *criteria) {
19 && !criteria->instance 19 && !criteria->instance
20 && !criteria->con_mark 20 && !criteria->con_mark
21 && !criteria->con_id 21 && !criteria->con_id
22 #ifdef HAVE_XWAYLAND
22 && !criteria->id 23 && !criteria->id
24 #endif
23 && !criteria->window_role 25 && !criteria->window_role
24 && !criteria->window_type 26 && !criteria->window_type
25 && !criteria->floating 27 && !criteria->floating
@@ -127,12 +129,14 @@ static bool criteria_matches_view(struct criteria *criteria,
127 } 129 }
128 } 130 }
129 131
132 #ifdef HAVE_XWAYLAND
130 if (criteria->id) { // X11 window ID 133 if (criteria->id) { // X11 window ID
131 uint32_t x11_window_id = view_get_x11_window_id(view); 134 uint32_t x11_window_id = view_get_x11_window_id(view);
132 if (!x11_window_id || x11_window_id != criteria->id) { 135 if (!x11_window_id || x11_window_id != criteria->id) {
133 return false; 136 return false;
134 } 137 }
135 } 138 }
139 #endif
136 140
137 if (criteria->window_role) { 141 if (criteria->window_role) {
138 // TODO 142 // TODO
@@ -265,7 +269,9 @@ enum criteria_token {
265 T_CON_ID, 269 T_CON_ID,
266 T_CON_MARK, 270 T_CON_MARK,
267 T_FLOATING, 271 T_FLOATING,
272 #ifdef HAVE_XWAYLAND
268 T_ID, 273 T_ID,
274 #endif
269 T_INSTANCE, 275 T_INSTANCE,
270 T_SHELL, 276 T_SHELL,
271 T_TILING, 277 T_TILING,
@@ -287,8 +293,10 @@ static enum criteria_token token_from_name(char *name) {
287 return T_CON_ID; 293 return T_CON_ID;
288 } else if (strcmp(name, "con_mark") == 0) { 294 } else if (strcmp(name, "con_mark") == 0) {
289 return T_CON_MARK; 295 return T_CON_MARK;
296 #ifdef HAVE_XWAYLAND
290 } else if (strcmp(name, "id") == 0) { 297 } else if (strcmp(name, "id") == 0) {
291 return T_ID; 298 return T_ID;
299 #endif
292 } else if (strcmp(name, "instance") == 0) { 300 } else if (strcmp(name, "instance") == 0) {
293 return T_INSTANCE; 301 return T_INSTANCE;
294 } else if (strcmp(name, "shell") == 0) { 302 } else if (strcmp(name, "shell") == 0) {
@@ -355,7 +363,9 @@ static char *get_focused_prop(enum criteria_token token) {
355 case T_CON_ID: // These do not support __focused__ 363 case T_CON_ID: // These do not support __focused__
356 case T_CON_MARK: 364 case T_CON_MARK:
357 case T_FLOATING: 365 case T_FLOATING:
366 #ifdef HAVE_XWAYLAND
358 case T_ID: 367 case T_ID:
368 #endif
359 case T_TILING: 369 case T_TILING:
360 case T_URGENT: 370 case T_URGENT:
361 case T_WINDOW_TYPE: 371 case T_WINDOW_TYPE:
@@ -426,12 +436,14 @@ static bool parse_token(struct criteria *criteria, char *name, char *value) {
426 case T_WINDOW_TYPE: 436 case T_WINDOW_TYPE:
427 // TODO: This is a string but will be stored as an enum or integer 437 // TODO: This is a string but will be stored as an enum or integer
428 break; 438 break;
439 #ifdef HAVE_XWAYLAND
429 case T_ID: 440 case T_ID:
430 criteria->id = strtoul(effective_value, &endptr, 10); 441 criteria->id = strtoul(effective_value, &endptr, 10);
431 if (*endptr != 0) { 442 if (*endptr != 0) {
432 error = strdup("The value for 'id' should be numeric"); 443 error = strdup("The value for 'id' should be numeric");
433 } 444 }
434 break; 445 break;
446 #endif
435 case T_FLOATING: 447 case T_FLOATING:
436 criteria->floating = true; 448 criteria->floating = true;
437 break; 449 break;