From 579afe49d863e8a91655b6ab8a2c42a380c7129e Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 17 Apr 2013 13:30:38 +0000 Subject: add conf_ignore and move group_make_autogroup to conf_autogroup to match. --- calmwm.h | 5 +++-- conf.c | 35 ++++++++++++++++++++++++++++++++++- group.c | 23 +---------------------- parse.y | 11 +++-------- 4 files changed, 41 insertions(+), 33 deletions(-) diff --git a/calmwm.h b/calmwm.h index ef1c256..694ec7d 100644 --- a/calmwm.h +++ b/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.188 2013/04/14 16:13:17 okan Exp $ + * $OpenBSD: calmwm.h,v 1.189 2013/04/17 13:30:38 okan Exp $ */ #ifndef _CALMWM_H_ @@ -352,7 +352,6 @@ void group_client_delete(struct client_ctx *); void group_cycle(struct screen_ctx *, int); void group_hidetoggle(struct screen_ctx *, int); void group_init(struct screen_ctx *); -void group_make_autogroup(struct conf *, char *, int); void group_menu(XButtonEvent *); void group_movetogroup(struct client_ctx *, int); void group_only(struct screen_ctx *, int); @@ -436,6 +435,7 @@ void menuq_clear(struct menu_q *); int parse_config(const char *, struct conf *); +void conf_autogroup(struct conf *, int, char *); void conf_bindname(struct conf *, char *, char *); void conf_clear(struct conf *); void conf_client(struct client_ctx *); @@ -446,6 +446,7 @@ void conf_gap(struct conf *, struct screen_ctx *); void conf_grab(struct conf *, struct keybinding *); void conf_grab_mouse(struct client_ctx *); void conf_init(struct conf *); +void conf_ignore(struct conf *, char *); void conf_mousebind(struct conf *, char *, char *); void conf_ungrab(struct conf *, struct keybinding *); diff --git a/conf.c b/conf.c index 24d7623..ece45e5 100644 --- a/conf.c +++ b/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.121 2013/01/08 15:16:05 okan Exp $ + * $OpenBSD: conf.c,v 1.122 2013/04/17 13:30:38 okan Exp $ */ #include @@ -52,6 +52,39 @@ conf_cmd_add(struct conf *c, char *image, char *label) } } +void +conf_autogroup(struct conf *c, int no, char *val) +{ + struct autogroupwin *aw; + char *p; + + aw = xcalloc(1, sizeof(*aw)); + + if ((p = strchr(val, ',')) == NULL) { + aw->name = NULL; + aw->class = xstrdup(val); + } else { + *(p++) = '\0'; + aw->name = xstrdup(val); + aw->class = xstrdup(p); + } + aw->num = no; + + TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry); +} + +void +conf_ignore(struct conf *c, char *val) +{ + struct winmatch *wm; + + wm = xcalloc(1, sizeof(*wm)); + + (void)strlcpy(wm->title, val, sizeof(wm->title)); + + TAILQ_INSERT_TAIL(&c->ignoreq, wm, entry); +} + void conf_gap(struct conf *c, struct screen_ctx *sc) { diff --git a/group.c b/group.c index 011ae8f..46312f0 100644 --- a/group.c +++ b/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.73 2013/04/08 13:05:27 okan Exp $ + * $OpenBSD: group.c,v 1.74 2013/04/17 13:30:38 okan Exp $ */ #include @@ -163,27 +163,6 @@ group_init(struct screen_ctx *sc) group_setactive(sc, 1); } -void -group_make_autogroup(struct conf *conf, char *val, int no) -{ - struct autogroupwin *aw; - char *p; - - aw = xcalloc(1, sizeof(*aw)); - - if ((p = strchr(val, ',')) == NULL) { - aw->name = NULL; - aw->class = xstrdup(val); - } else { - *(p++) = '\0'; - aw->name = xstrdup(val); - aw->class = xstrdup(p); - } - aw->num = no; - - TAILQ_INSERT_TAIL(&conf->autogroupq, aw, entry); -} - static void group_setactive(struct screen_ctx *sc, long idx) { diff --git a/parse.y b/parse.y index d93d080..8dc1dd0 100644 --- a/parse.y +++ b/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.39 2013/01/04 16:27:58 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.40 2013/04/17 13:30:38 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -137,16 +137,11 @@ main : FONTNAME STRING { YYERROR; } - group_make_autogroup(conf, $3, $2); + conf_autogroup(conf, $2, $3); free($3); } | IGNORE STRING { - struct winmatch *wm; - - wm = xcalloc(1, sizeof(*wm)); - (void)strlcpy(wm->title, $2, sizeof(wm->title)); - TAILQ_INSERT_TAIL(&conf->ignoreq, wm, entry); - + conf_ignore(conf, $2); free($2); } | BIND STRING string { -- cgit v1.2.3-2-gb3c3