summary refs log tree commit diff
path: root/parse.y
diff options
context:
space:
mode:
authorokan <okan>2008-06-14 21:48:54 +0000
committerokan <okan>2008-06-14 21:48:54 +0000
commitbdcbbe7f53ce140df98f06a31dfe5cb19a40d708 (patch)
tree58a64d48acdfbaca8ec894b89909da5c6d8880f1 /parse.y
parentb4ae492b7ba7bf40147c1ad4b8d036aa32053f58 (diff)
downloadcwm-bdcbbe7f53ce140df98f06a31dfe5cb19a40d708.tar.gz
cwm-bdcbbe7f53ce140df98f06a31dfe5cb19a40d708.tar.xz
cwm-bdcbbe7f53ce140df98f06a31dfe5cb19a40d708.zip
confable menu and window mouse bindings from rivo nurges (thanks!) with
some minor fixups, man page bits and knf.

ok oga@
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y20
1 files changed, 19 insertions, 1 deletions
diff --git a/parse.y b/parse.y
index bcdd4b1..1b054bf 100644
--- a/parse.y
+++ b/parse.y
@@ -66,7 +66,7 @@ typedef struct {
 
 %}
 
-%token	FONTNAME STICKY GAP
+%token	FONTNAME STICKY GAP MOUSEBIND
 %token	AUTOGROUP BIND COMMAND IGNORE
 %token	YES NO
 %token	ERROR
@@ -167,6 +167,11 @@ main		: FONTNAME STRING		{
 			conf->gap_left = $4;
 			conf->gap_right = $5;
 		}
+		| MOUSEBIND STRING string	{
+			conf_mousebind(conf, $2, $3);
+			free($2);
+			free($3);
+		}
 		;
 %%
 
@@ -206,6 +211,7 @@ lookup(char *s)
 		{ "fontname",		FONTNAME},
 		{ "gap",		GAP},
 		{ "ignore",		IGNORE},
+		{ "mousebind",		MOUSEBIND},
 		{ "no",			NO},
 		{ "sticky",		STICKY},
 		{ "yes",		YES}
@@ -469,6 +475,7 @@ conf_clear(struct conf *c)
 	struct keybinding	*kb;
 	struct winmatch		*wm;
 	struct cmd		*cmd;
+	struct mousebinding	*mb;
 
 	while (cmd = TAILQ_FIRST(&c->cmdq)) {
 		TAILQ_REMOVE(&c->cmdq, cmd, entry);
@@ -494,6 +501,11 @@ conf_clear(struct conf *c)
 		free(wm);
 	}
 
+	while (mb = TAILQ_FIRST(&c->mousebindingq)) {
+		TAILQ_REMOVE(&c->mousebindingq, mb, entry);
+		free(mb);
+	}
+
 	if (c->DefaultFontName != NULL &&
 	    c->DefaultFontName != DEFAULTFONTNAME)
 		free(c->DefaultFontName);
@@ -529,6 +541,7 @@ parse_config(const char *filename, struct conf *xconf)
 		struct keybinding	*kb;
 		struct winmatch		*wm;
 		struct cmd		*cmd;
+		struct mousebinding	*mb;
 
 		conf_clear(xconf);
 
@@ -554,6 +567,11 @@ parse_config(const char *filename, struct conf *xconf)
 			TAILQ_INSERT_TAIL(&xconf->ignoreq, wm, entry);
 		}
 
+		while (mb = TAILQ_FIRST(&conf->mousebindingq)) {
+			TAILQ_REMOVE(&conf->mousebindingq, mb, entry);
+			TAILQ_INSERT_TAIL(&xconf->mousebindingq, mb, entry);
+		}
+
 		strlcpy(xconf->termpath, conf->termpath,
 		    sizeof(xconf->termpath));
 		strlcpy(xconf->lockpath, conf->lockpath,