2 * vim:ts=4:sw=4:expandtab
4 * i3 - an improved dynamic tiling window manager
5 * © 2009-2010 Michael Stapelberg and contributors (see also: LICENSE)
11 bool match_is_empty(Match *match) {
12 /* we cannot simply use memcmp() because the structure is part of a
13 * TAILQ and I don’t want to start with things like assuming that the
14 * last member of a struct really is at the end in memory… */
15 return (match->title == NULL &&
16 match->application == NULL &&
17 match->class == NULL &&
18 match->instance == NULL &&
19 match->id == XCB_NONE &&
20 match->con_id == NULL &&
21 match->floating == M_ANY);
24 bool match_matches_window(Match *match, i3Window *window) {
25 /* TODO: pcre, full matching, … */
26 if (match->class != NULL && window->class_class != NULL && strcasecmp(match->class, window->class_class) == 0) {
27 LOG("match made by window class (%s)\n", window->class_class);
31 if (match->instance != NULL && window->class_instance != NULL && strcasecmp(match->instance, window->class_instance) == 0) {
32 LOG("match made by window instance (%s)\n", window->class_instance);
37 if (match->id != XCB_NONE && window->id == match->id) {
38 LOG("match made by window id (%d)\n", window->id);
42 LOG("window %d (%s) could not be matched\n", window->id, window->class_class);