Merhaba-

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.

Best,
Kent


Index: group.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.60
diff -N -p -u group.c
--- group.c     9 Sep 2012 20:52:57 -0000       1.60
+++ group.c     26 Oct 2012 16:08:28 -0000
@@ -412,7 +412,8 @@ group_autogroup(struct client_ctx *cc)
        struct screen_ctx       *sc = cc->sc;
        struct autogroupwin     *aw;
        struct group_ctx        *gc;
-       int                      no = -1;
+#define AUTOGROUP_NO_MATCH      -1
+       int                      no = AUTOGROUP_NO_MATCH;
        long                    *grpno;
 
        if (cc->app_class == NULL || cc->app_name == NULL)
@@ -429,11 +430,14 @@ 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 &&
+                                   no == AUTOGROUP_NO_MATCH)
+                                       no = aw->num;
+                               else if (strcmp(aw->name, cc->app_name) == 0) {
+                                       no = aw->num;
+                                       break;
+                               }
                        }
                }
        }

Reply via email to