Refactor callbacks to take a void * so as to not try and generalize into

client_ctx in keypress and buttonpress event handlers; pass appropriate *ctx's
based on context.

While here, limit some globals, replace defines with appropriate variables and
fix some naming.
This commit is contained in:
okan
2016-10-18 17:03:30 +00:00
parent 38eac7d7e9
commit 0bb1be86c6
10 changed files with 512 additions and 509 deletions

22
group.c
View File

@ -265,7 +265,7 @@ group_cycle(struct screen_ctx *sc, int flags)
newgc = oldgc;
for (;;) {
newgc = (flags & CWM_CLIENT_RCYCLE) ? group_prev(newgc) :
newgc = (flags & CWM_CYCLE_REVERSE) ? group_prev(newgc) :
group_next(newgc);
if (newgc == oldgc)
@ -304,8 +304,8 @@ group_prev(struct group_ctx *gc)
struct screen_ctx *sc = gc->sc;
struct group_ctx *newgc;
return(((newgc = TAILQ_PREV(gc, group_ctx_q, entry)) != NULL) ?
newgc : TAILQ_LAST(&sc->groupq, group_ctx_q));
return(((newgc = TAILQ_PREV(gc, group_q, entry)) != NULL) ?
newgc : TAILQ_LAST(&sc->groupq, group_q));
}
void
@ -351,21 +351,21 @@ int
group_autogroup(struct client_ctx *cc)
{
struct screen_ctx *sc = cc->sc;
struct autogroupwin *aw;
struct autogroup *ag;
struct group_ctx *gc;
int num = -1, both_match = 0;
if (cc->ch.res_class == NULL || cc->ch.res_name == NULL)
return(0);
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
if (strcmp(aw->class, cc->ch.res_class) == 0) {
if ((aw->name != NULL) &&
(strcmp(aw->name, cc->ch.res_name) == 0)) {
num = aw->num;
TAILQ_FOREACH(ag, &Conf.autogroupq, entry) {
if (strcmp(ag->class, cc->ch.res_class) == 0) {
if ((ag->name != NULL) &&
(strcmp(ag->name, cc->ch.res_name) == 0)) {
num = ag->num;
both_match = 1;
} else if (aw->name == NULL && !both_match)
num = aw->num;
} else if (ag->name == NULL && !both_match)
num = ag->num;
}
}