- if (match->title != NULL) {
- if (window->name == NULL)
- return false;
-
- const char *title = i3string_as_utf8(window->name);
- if (strcmp(match->title->pattern, "__focused__") == 0 &&
- strcmp(title, i3string_as_utf8(focused->window->name)) == 0) {
- LOG("window title matches focused window\n");
- } else if (regex_matches(match->title, title)) {
- LOG("title matches (%s)\n", title);
- } else {
- return false;
- }
- }
-
- if (match->window_role != NULL) {
- if (window->role == NULL)
- return false;
- if (strcmp(match->window_role->pattern, "__focused__") == 0 &&
- strcmp(window->role, focused->window->role) == 0) {
- LOG("window role matches focused window\n");
- } else if (regex_matches(match->window_role, window->role)) {
- LOG("window_role matches (%s)\n", window->role);
- } else {
- return false;
- }
- }
+ CHECK_WINDOW_FIELD(title, name, i3string);
+ CHECK_WINDOW_FIELD(window_role, role, str);