recognize dock windows (and support matching them)

This commit is contained in:
Michael Stapelberg
2010-08-15 12:18:27 +02:00
parent 0411299e4c
commit 160c12ed9a
6 changed files with 49 additions and 5 deletions

View File

@ -14,6 +14,17 @@
#include "all.h"
/*
* Initializes the Match data structure. This function is necessary because the
* members representing boolean values (like dock) need to be initialized with
* -1 instead of 0.
*
*/
void match_init(Match *match) {
memset(match, 0, sizeof(Match));
match->dock = -1;
}
/*
* Check if a match is empty. This is necessary while parsing commands to see
* whether the user specified a match at all.
@ -30,6 +41,7 @@ bool match_is_empty(Match *match) {
match->instance == NULL &&
match->id == XCB_NONE &&
match->con_id == NULL &&
match->dock == -1 &&
match->floating == M_ANY);
}
@ -54,6 +66,12 @@ bool match_matches_window(Match *match, i3Window *window) {
return true;
}
LOG("match->dock = %d, window->dock = %d\n", match->dock, window->dock);
if (match->dock != -1 && window->dock == match->dock) {
LOG("match made by dock\n");
return true;
}
LOG("window %d (%s) could not be matched\n", window->id, window->class_class);
return false;