Make group number the second parameter to match the autogroup
configuration syntax. Split val into class and name, respectively.
No functional change, but this paves the way for some future
changes.
Index: cwm/group.c
===================================================================
--- cwm.orig/group.c 2012-10-31 11:53:18.368666000 -0500
+++ cwm/group.c 2012-11-02 10:16:09.027939517 -0500
@@ -164,19 +164,25 @@
}
void
-group_make_autogroup(struct conf *conf, char *val, int no)
+group_make_autogroup(struct conf *conf, int no, char *class, char *name)
{
struct autogroupwin *aw;
- char *p;
+ char *p, *tmp;
aw = xcalloc(1, sizeof(*aw));
- if ((p = strchr(val, ',')) == NULL) {
+ if ((p = strchr(class, ',')) == NULL) {
aw->name = NULL;
- aw->class = xstrdup(val);
+ aw->class = xstrdup(class);
} else {
+ /*
+ * Avoid the awkwardness of aw->name = xstrdup(class)
+ * below.
+ */
+ tmp = class;
+
*(p++) = '\0';
- aw->name = xstrdup(val);
+ aw->name = xstrdup(tmp);
aw->class = xstrdup(p);
}
aw->num = no;
Index: cwm/parse.y
===================================================================
--- cwm.orig/parse.y 2012-10-31 17:12:11.880577000 -0500
+++ cwm/parse.y 2012-11-02 10:14:41.427202533 -0500
@@ -136,7 +136,7 @@
YYERROR;
}
- group_make_autogroup(conf, $3, $2);
+ group_make_autogroup(conf, $2, $3, NULL);
free($3);
}
| IGNORE STRING {
Index: cwm/calmwm.h
===================================================================
--- cwm.orig/calmwm.h 2012-10-31 17:12:11.530584000 -0500
+++ cwm/calmwm.h 2012-11-02 09:50:19.294848431 -0500
@@ -342,7 +342,7 @@
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_make_autogroup(struct conf *, int, char *, char
*);
void group_menu(XButtonEvent *);
void group_movetogroup(struct client_ctx *, int);
void group_only(struct screen_ctx *, int);