diff options
author | okan | 2012-11-29 04:25:49 +0000 |
---|---|---|
committer | okan | 2012-11-29 04:25:49 +0000 |
commit | 5f295213b64406c170ea8f209280cb61fedbb5ce (patch) | |
tree | 79e99d2b5dd7cd862e6c7b463c67405aa778b06a | |
parent | a5c5711a5b97f23fdadc0e00875c7757be6ae622 (diff) | |
download | cwm-5f295213b64406c170ea8f209280cb61fedbb5ce.tar.gz |
specific last match for autogroup; few iterations with Kent Spillner.
-rw-r--r-- | cwmrc.5 | 5 | ||||
-rw-r--r-- | group.c | 16 |
2 files changed, 12 insertions, 9 deletions
@@ -1,4 +1,4 @@ -.\" $OpenBSD: cwmrc.5,v 1.48 2012/11/07 14:59:07 okan Exp $ +.\" $OpenBSD: cwmrc.5,v 1.49 2012/11/29 04:25:49 okan Exp $ .\" .\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 7 2012 $ +.Dd $Mdocdate: November 29 2012 $ .Dt CWMRC 5 .Os .Sh NAME @@ -50,6 +50,7 @@ or if their name and class properties match and .Ar windowclass , respectively. +The more specific last match wins. .Ar group is a number between 0 and 9. If @@ -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.63 2012/11/09 03:52:02 okan Exp $ + * $OpenBSD: group.c,v 1.64 2012/11/29 04:25:49 okan Exp $ */ #include <sys/param.h> @@ -412,7 +412,7 @@ group_autogroup(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct autogroupwin *aw; struct group_ctx *gc; - int no = -1; + int no = -1, both_match = 0; long *grpno; if (cc->app_class == NULL || cc->app_name == NULL) @@ -429,11 +429,13 @@ group_autogroup(struct client_ctx *cc) XFree(grpno); } else { TAILQ_FOREACH(aw, &Conf.autogroupq, entry) { - if (strcmp(aw->class, cc->app_class) == 0 && - (aw->name == NULL || - strcmp(aw->name, cc->app_name) == 0)) { - no = aw->num; - break; + if (strcmp(aw->class, cc->app_class) == 0) { + if ((aw->name != NULL) && + (strcmp(aw->name, cc->app_name) == 0)) { + no = aw->num; + both_match = 1; + } else if (aw->name == NULL && !both_match) + no = aw->num; } } } |