summary refs log tree commit diff
path: root/parse.y
diff options
context:
space:
mode:
authorokan <okan>2016-12-01 17:17:27 +0000
committerokan <okan>2016-12-01 17:17:27 +0000
commitd968a6c1bf1115fe261e979ac1d58ab5c12cd176 (patch)
tree4971e3f0345d797749f4ee81c2c1e9cc1a3cc832 /parse.y
parentae9f900b91373f744fda7540cb42f281533fb7e4 (diff)
downloadcwm-d968a6c1bf1115fe261e979ac1d58ab5c12cd176.tar.gz
cwm-d968a6c1bf1115fe261e979ac1d58ab5c12cd176.tar.xz
cwm-d968a6c1bf1115fe261e979ac1d58ab5c12cd176.zip
Normalize bind function names, based on a few categories: window, group, menu
and pointer.

Replace 'bind' and 'mousebind' options with 'bind-key' and 'bind-mouse',
respectively, replace special 'unmap' keyword with 'unbind-key' and
'unbind-mouse', and additionally allow unbinding all with 'all' keyword.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y51
1 files changed, 35 insertions, 16 deletions
diff --git a/parse.y b/parse.y
index a925873..2c358ea 100644
--- a/parse.y
+++ b/parse.y
@@ -68,8 +68,9 @@ typedef struct {
 
 %}
 
-%token	FONTNAME STICKY GAP MOUSEBIND
-%token	AUTOGROUP BIND COMMAND IGNORE
+%token	BINDKEY UNBINDKEY BINDMOUSE UNBINDMOUSE
+%token	FONTNAME STICKY GAP
+%token	AUTOGROUP COMMAND IGNORE
 %token	YES NO BORDERWIDTH MOVEAMOUNT
 %token	COLOR SNAPDIST
 %token	ACTIVEBORDER INACTIVEBORDER URGENCYBORDER
@@ -169,16 +170,6 @@ main		: FONTNAME STRING		{
 			conf_ignore(conf, $2);
 			free($2);
 		}
-		| BIND STRING string		{
-			if (!conf_bind_key(conf, $2, $3)) {
-				yyerror("invalid bind: %s %s", $2, $3);
-				free($2);
-				free($3);
-				YYERROR;
-			}
-			free($2);
-			free($3);
-		}
 		| GAP NUMBER NUMBER NUMBER NUMBER {
 			if ($2 < 0 || $2 > INT_MAX ||
 			    $3 < 0 || $3 > INT_MAX ||
@@ -192,9 +183,27 @@ main		: FONTNAME STRING		{
 			conf->gap.left = $4;
 			conf->gap.right = $5;
 		}
-		| MOUSEBIND STRING string	{
+		| BINDKEY STRING string {
+			if (!conf_bind_key(conf, $2, $3)) {
+				yyerror("invalid bind-key: %s %s", $2, $3);
+				free($2);
+				free($3);
+				YYERROR;
+			}
+			free($2);
+			free($3);
+		}
+		| UNBINDKEY STRING {
+			if (!conf_bind_key(conf, $2, NULL)) {
+				yyerror("invalid unbind-key: %s", $2);
+				free($2);
+				YYERROR;
+			}
+			free($2);
+		}
+		| BINDMOUSE STRING string {
 			if (!conf_bind_mouse(conf, $2, $3)) {
-				yyerror("invalid mousebind: %s %s", $2, $3);
+				yyerror("invalid bind-mouse: %s %s", $2, $3);
 				free($2);
 				free($3);
 				YYERROR;
@@ -202,6 +211,14 @@ main		: FONTNAME STRING		{
 			free($2);
 			free($3);
 		}
+		| UNBINDMOUSE STRING {
+			if (!conf_bind_mouse(conf, $2, NULL)) {
+				yyerror("invalid unbind-mouse: %s", $2);
+				free($2);
+				YYERROR;
+			}
+			free($2);
+		}
 		;
 
 color		: COLOR colors
@@ -278,7 +295,8 @@ lookup(char *s)
 	static const struct keywords keywords[] = {
 		{ "activeborder",	ACTIVEBORDER},
 		{ "autogroup",		AUTOGROUP},
-		{ "bind",		BIND},
+		{ "bind-key",		BINDKEY},
+		{ "bind-mouse",		BINDMOUSE},
 		{ "borderwidth",	BORDERWIDTH},
 		{ "color",		COLOR},
 		{ "command",		COMMAND},
@@ -290,12 +308,13 @@ lookup(char *s)
 		{ "inactiveborder",	INACTIVEBORDER},
 		{ "menubg",		MENUBG},
 		{ "menufg",		MENUFG},
-		{ "mousebind",		MOUSEBIND},
 		{ "moveamount",		MOVEAMOUNT},
 		{ "no",			NO},
 		{ "selfont", 		FONTSELCOLOR},
 		{ "snapdist",		SNAPDIST},
 		{ "sticky",		STICKY},
+		{ "unbind-key",		UNBINDKEY},
+		{ "unbind-mouse",	UNBINDMOUSE},
 		{ "ungroupborder",	UNGROUPBORDER},
 		{ "urgencyborder",	URGENCYBORDER},
 		{ "yes",		YES}