summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2016-10-03 14:42:34 +0000
committerokan <okan>2016-10-03 14:42:34 +0000
commit03f5dc219e20edbcf4b7eac1f733a188ab8f7c29 (patch)
treef0bde6dbe80ee735314c5a1136c8011d6bda14b0
parent792f85cde97742d0c580ee2354044870d0f8754f (diff)
downloadcwm-03f5dc219e20edbcf4b7eac1f733a188ab8f7c29.tar.gz
cwm-03f5dc219e20edbcf4b7eac1f733a188ab8f7c29.tar.xz
cwm-03f5dc219e20edbcf4b7eac1f733a188ab8f7c29.zip
Defaults are split between defines and conf_init(); normalize these, as
well as give 'sticky' groups its own variable.
-rw-r--r--calmwm.h17
-rw-r--r--client.c2
-rw-r--r--conf.c9
-rw-r--r--parse.y5
4 files changed, 13 insertions, 20 deletions
diff --git a/calmwm.h b/calmwm.h
index 98eb064..f69eab9 100644
--- a/calmwm.h
+++ b/calmwm.h
@@ -284,34 +284,26 @@ struct conf {
 	struct autogroupwin_q	 autogroupq;
 	struct ignore_q		 ignoreq;
 	struct cmd_q		 cmdq;
-#define	CONF_STICKY_GROUPS		0x0001
-	int			 flags;
-#define CONF_BWIDTH			1
+	int			 stickygroups;
 	int			 bwidth;
-#define	CONF_MAMOUNT			1
 	int			 mamount;
-#define	CONF_SNAPDIST			0
 	int			 snapdist;
 	struct gap		 gap;
 	char			*color[CWM_COLOR_NITEMS];
 	char			 known_hosts[PATH_MAX];
-#define	CONF_FONT			"sans-serif:pixelsize=14:bold"
 	char			*font;
 	Cursor			 cursor[CF_NITEMS];
 };
 
 /* MWM hints */
 struct mwm_hints {
-	unsigned long	flags;
-	unsigned long	functions;
-	unsigned long	decorations;
-};
 #define MWM_HINTS_ELEMENTS	3L
+#define MWM_FLAGS_STATUS	(1<<3)
 
 #define MWM_FLAGS_FUNCTIONS	(1<<0)
 #define MWM_FLAGS_DECORATIONS	(1<<1)
 #define MWM_FLAGS_INPUT_MODE	(1<<2)
-#define MWM_FLAGS_STATUS	(1<<3)
+	unsigned long	flags;
 
 #define MWM_FUNCS_ALL		(1<<0)
 #define MWM_FUNCS_RESIZE	(1<<1)
@@ -319,6 +311,7 @@ struct mwm_hints {
 #define MWM_FUNCS_MINIMIZE	(1<<3)
 #define MWM_FUNCS_MAXIMIZE	(1<<4)
 #define MWM_FUNCS_CLOSE		(1<<5)
+	unsigned long	functions;
 
 #define	MWM_DECOR_ALL		(1<<0)
 #define	MWM_DECOR_BORDER	(1<<1)
@@ -327,6 +320,8 @@ struct mwm_hints {
 #define MWM_DECOR_MENU		(1<<4)
 #define MWM_DECOR_MINIMIZE	(1<<5)
 #define MWM_DECOR_MAXIMIZE	(1<<6)
+	unsigned long	decorations;
+};
 
 extern Display				*X_Dpy;
 extern Time				 Last_Event_Time;
diff --git a/client.c b/client.c
index 4aa69b9..1de9290 100644
--- a/client.c
+++ b/client.c
@@ -133,7 +133,7 @@ client_init(Window win, struct screen_ctx *sc, int active)
 			goto out;
 		if (group_autogroup(cc))
 			goto out;
-		if (Conf.flags & CONF_STICKY_GROUPS)
+		if (Conf.stickygroups)
 			group_assign(sc->group_active, cc);
 		else
 			group_assign(NULL, cc);
diff --git a/conf.c b/conf.c
index e03b337..47a9566 100644
--- a/conf.c
+++ b/conf.c
@@ -254,9 +254,10 @@ conf_init(struct conf *c)
 {
 	unsigned int	i;
 
-	c->bwidth = CONF_BWIDTH;
-	c->mamount = CONF_MAMOUNT;
-	c->snapdist = CONF_SNAPDIST;
+	c->stickygroups = 0;
+	c->bwidth = 1;
+	c->mamount = 1;
+	c->snapdist = 0;
 
 	TAILQ_INIT(&c->ignoreq);
 	TAILQ_INIT(&c->cmdq);
@@ -279,7 +280,7 @@ conf_init(struct conf *c)
 	(void)snprintf(c->known_hosts, sizeof(c->known_hosts), "%s/%s",
 	    homedir, ".ssh/known_hosts");
 
-	c->font = xstrdup(CONF_FONT);
+	c->font = xstrdup("sans-serif:pixelsize=14:bold");
 }
 
 void
diff --git a/parse.y b/parse.y
index dd0714e..c035e4e 100644
--- a/parse.y
+++ b/parse.y
@@ -112,10 +112,7 @@ main		: FONTNAME STRING		{
 			conf->font = $2;
 		}
 		| STICKY yesno {
-			if ($2 == 0)
-				conf->flags &= ~CONF_STICKY_GROUPS;
-			else
-				conf->flags |= CONF_STICKY_GROUPS;
+			conf->stickygroups = $2;
 		}
 		| BORDERWIDTH NUMBER {
 			if ($2 < 0 || $2 > UINT_MAX) {