On Fri 2012.10.26 at 11:25 -0500, Kent R. Spillner wrote:
> Merhaba-

Hi,

> Below is a new diff which only sets no if class matches and name is NULL or
> if class and name both match.
> 
> Since we must explicitly check for name == NULL I decided to also go ahead
> and skip setting no if any previous class-only matches were found.

It's too bad the explicit class+name match is backwards in the config
grammar;  I suppose we could reverse it and may make more sense going
generic to specific matches...but that's another topic.

However, in general, I do prefer last matching when it comes to the
matching options in the config.  So the below allows for specific
matches of class+name or just class matches, but last matching in both
cases.

I use autogroup'ing only a little, so I used the following bits to test

autogroup 4 XTerm
autogroup 6 "YYY,XTerm"
autogroup 3 XTerm
autogroup 4 "XXX,XTerm"
autogroup 5 "YYY,XTerm"

...re-ordered them and got the autogrouping results I expect from just
reading the config.

Hopefully this is more clear and expected behavior.

Cheers,
Okan

Index: group.c
===================================================================
RCS file: /home/open/cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.60
diff -u -p -r1.60 group.c
--- group.c     9 Sep 2012 20:52:57 -0000       1.60
+++ group.c     28 Oct 2012 21:05:47 -0000
@@ -429,11 +429,12 @@ 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;
+                               else if (aw->name == NULL)
+                                       no = aw->num;
                        }
                }
        }

Reply via email to