added function 'con_by_mark' to look up a con holding the given mark

This commit is contained in:
Ingo Bürk 2015-04-14 17:51:28 +02:00
parent 9613a0744d
commit c4a84385d6
2 changed files with 22 additions and 0 deletions

View File

@ -126,6 +126,13 @@ Con *con_by_window_id(xcb_window_t window);
*/
Con *con_by_frame_id(xcb_window_t frame);
/**
* Returns the container with the given mark or NULL if no such container
* exists.
*
*/
Con *con_by_mark(const char *mark);
/**
* Returns the first container below 'con' which wants to swallow this window
* TODO: priority

View File

@ -460,6 +460,21 @@ Con *con_by_frame_id(xcb_window_t frame) {
return NULL;
}
/*
* Returns the container with the given mark or NULL if no such container
* exists.
*
*/
Con *con_by_mark(const char *mark) {
Con *con;
TAILQ_FOREACH(con, &all_cons, all_cons) {
if (con->mark != NULL && strcmp(con->mark, mark) == 0)
return con;
}
return NULL;
}
/*
* Returns the first container below 'con' which wants to swallow this window
* TODO: priority