summary refs log tree commit diff
path: root/parse.y
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-12-16 13:42:52 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2016-12-16 13:48:38 +0100
commit775ba78311768b7a944db95273822c0a567dc171 (patch)
tree13ea9cb9db8e9121cc80e9cce4186a925fb889e2 /parse.y
parentdcb741d2b1378432e226bbeea274c2e5e2508c2d (diff)
parent8b4666cb926121481905b68bf93d6e81c307e9e3 (diff)
downloadcwm-775ba78311768b7a944db95273822c0a567dc171.tar.gz
cwm-775ba78311768b7a944db95273822c0a567dc171.tar.xz
cwm-775ba78311768b7a944db95273822c0a567dc171.zip
cvsimport
* refs/heads/master:
  stray newlines
  Add search_print_text(), a default callback for mi->print in menu_filter(). While here, normalize the remaining search_print_* argument paramters.
  Consistent use of menuq_add for ssh menu.
  Now that dim.{x,y} are available early, use them before requiring a MotionNotify event.
  Set dim.{x,y} during client_init and update on resize, instead of (re)calculating only when applying hints.
  'window-search' is spelled 'menu-window'; the former snuck in during the conversion('menu-window' already existed and was properlly documented); found the hard way by sthen@ while trying to convert.
  Fold unbinding functions into one for each, key and mouse; plugs a leak when unbinding a mouse button bound to a command.
  use the correct type
  Tame the number of 'exec' and 'path' search_match wrappers. No functional change now, though more can likely go later, losing the (paritally complete or incomplete/broken) argument completion bits.
  Switch ssh menu to search_match_text; like group/window/cmd menus, use only a substring match. The previous matching is only intended for the exec menus.
  Change 'menu-window' to display all windows; then add 'menu-window-hidden' for the previous behaviour of 'menu-window'.  'menu-window' becomes the default binding; use 'bind-mouse "1" menu-window-hidden' to restore old behaviour for those who prefer.
  Normalize bind function names, based on a few categories: window, group, menu and pointer.
  Use an additional check with lstat(2) when d_type is unknown.
  revert previous; upcoming changes will hopefully deal with these more naturally.
  Add a wrapper based upon xevent handlers around client move/resize for key and mouse bindings.
  Define callbacks, then default bindings.
  Reorganize for upcoming changes.
  Remove the (8) default bindings for pointer move since they conflict with default bindings for emacs, which wins; the feature remains and can be bound to whatever users wish with cwmrc(5).
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 abd3224..c8942d9 100644
--- a/parse.y
+++ b/parse.y
@@ -70,8 +70,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
@@ -171,16 +172,6 @@ main		: FONTNAME STRING		{
 			conf_ignore(conf, $2);
 			free($2);
 		}
-		| BIND STRING string		{
-			if (!conf_bind_kbd(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 ||
@@ -194,9 +185,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;
@@ -204,6 +213,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
@@ -280,7 +297,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},
@@ -292,12 +310,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}