diff options
author | Richard Grenville <[email protected]> | 2013-05-21 09:18:41 +0800 |
---|---|---|
committer | Richard Grenville <[email protected]> | 2013-05-21 09:26:18 +0800 |
commit | d800a62b878fa152c94253b2c0f60ef4f5b9b9d1 (patch) | |
tree | ed2ae824aee66bd3ec4adcd78cf6a93c2b94813b /c2.c | |
parent | 1bdd035974a0166434cdb2dd5d34405d6ddf184d (diff) | |
download | tdebase-d800a62b878fa152c94253b2c0f60ef4f5b9b9d1.tar.gz tdebase-d800a62b878fa152c94253b2c0f60ef4f5b9b9d1.zip |
Feature #113: Set opacity based on conditions
- Add --opacity-rule, which sets opacity based on conditions, as
requested by zabbal. (#113)
- Add a data field for each condition.
- Correct the FAQ link in README.md. Silly me.
- Code clean-up.
Diffstat (limited to 'c2.c')
-rw-r--r-- | c2.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -14,7 +14,8 @@ * Parse a condition string. */ c2_lptr_t * -c2_parse(session_t *ps, c2_lptr_t **pcondlst, const char *pattern) { +c2_parsed(session_t *ps, c2_lptr_t **pcondlst, const char *pattern, + void *data) { if (!pattern) return NULL; @@ -41,6 +42,7 @@ c2_parse(session_t *ps, c2_lptr_t **pcondlst, const char *pattern) { " list element."); memcpy(plptr, &lptr_def, sizeof(c2_lptr_t)); plptr->ptr = result; + plptr->data = data; if (pcondlst) { plptr->next = *pcondlst; *pcondlst = plptr; @@ -1274,20 +1276,26 @@ c2_match_once(session_t *ps, win *w, const c2_ptr_t cond) { * Match a window against a condition linked list. * * @param cache a place to cache the last matched condition + * @param pdata a place to return the data * @return true if matched, false otherwise. */ bool -c2_match(session_t *ps, win *w, const c2_lptr_t *condlst, - const c2_lptr_t **cache) { +c2_matchd(session_t *ps, win *w, const c2_lptr_t *condlst, + const c2_lptr_t **cache, void **pdata) { // Check if the cached entry matches firstly - if (cache && *cache && c2_match_once(ps, w, (*cache)->ptr)) + if (cache && *cache && c2_match_once(ps, w, (*cache)->ptr)) { + if (pdata) + *pdata = (*cache)->data; return true; + } // Then go through the whole linked list for (; condlst; condlst = condlst->next) { if (c2_match_once(ps, w, condlst->ptr)) { if (cache) *cache = condlst; + if (pdata) + *pdata = condlst->data; return true; } } |