about summary refs log tree commit diff
diff options
context:
space:
mode:
authorokan <okan>2013-11-27 16:24:17 +0000
committerokan <okan>2013-11-27 16:24:17 +0000
commitabf52049b9e93e026c9299f65f326b975fd2f2cc (patch)
tree0215ae8c3bb9d0a994bd78d435e94fd888f25506
parent250f98bf1552ebbff28ff4d9c7b853687065d476 (diff)
downloadcwm-abf52049b9e93e026c9299f65f326b975fd2f2cc.tar.gz
cwm-abf52049b9e93e026c9299f65f326b975fd2f2cc.tar.xz
cwm-abf52049b9e93e026c9299f65f326b975fd2f2cc.zip
Remove the option to bind a key by keycode with brackets; it never
worked (and no one complained!).  While it's fairly easy to fix, users
should be using keysym names and not keycodes.

Discussed at length months ago with todd@, matthieu@ and Owain.
-rw-r--r--conf.c17
-rw-r--r--cwmrc.58
-rw-r--r--xevents.c4
3 files changed, 7 insertions, 22 deletions
diff --git a/conf.c b/conf.c
index 68a5351..895b681 100644
--- a/conf.c
+++ b/conf.c
@@ -479,17 +479,8 @@ conf_bind_kbd(struct conf *c, char *name, char *binding)
 	substring = conf_bind_getmask(name, &mask);
 	current_binding->modmask |= mask;
 
-	if (substring[0] == '[' &&
-	    substring[strlen(substring)-1] == ']') {
-		sscanf(substring, "[%d]", &current_binding->keycode);
-		current_binding->keysym = NoSymbol;
-	} else {
-		current_binding->keycode = 0;
-		current_binding->keysym = XStringToKeysym(substring);
-	}
-
-	if (current_binding->keysym == NoSymbol &&
-	    current_binding->keycode == 0) {
+	current_binding->keysym = XStringToKeysym(substring);
+	if (current_binding->keysym == NoSymbol) {
 		free(current_binding);
 		return;
 	}
@@ -530,9 +521,7 @@ conf_unbind_kbd(struct conf *c, struct keybinding *unbind)
 		if (key->modmask != unbind->modmask)
 			continue;
 
-		if ((key->keycode != 0 && key->keysym == NoSymbol &&
-		    key->keycode == unbind->keycode) ||
-		    key->keysym == unbind->keysym) {
+		if (key->keysym == unbind->keysym) {
 			TAILQ_REMOVE(&c->keybindingq, key, entry);
 			if (key->argtype & ARG_CHAR)
 				free(key->argument.c);
diff --git a/cwmrc.5 b/cwmrc.5
index 9f75dbd..2d00e73 100644
--- a/cwmrc.5
+++ b/cwmrc.5
@@ -14,7 +14,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 17 2013 $
+.Dd $Mdocdate: July 8 2013 $
 .Dt CWMRC 5
 .Os
 .Sh NAME
@@ -84,10 +84,8 @@ The Mod4 key (normally the windows key).
 .Pp
 The
 .Sq -
-should be followed by either a keysym name, taken from
-.Pa /usr/X11R6/include/X11/keysymdef.h ,
-or a numerical keycode value enclosed in
-.Dq [] .
+should be followed by a keysym name, taken from
+.Pa /usr/X11R6/include/X11/keysymdef.h .
 The
 .Ar command
 may either be one from the
diff --git a/xevents.c b/xevents.c
index a1fe019..f89198c 100644
--- a/xevents.c
+++ b/xevents.c
@@ -275,9 +275,7 @@ xev_handle_keypress(XEvent *ee)
 		if ((kb->modmask | modshift) != e->state)
 			continue;
 
-		if ((kb->keycode != 0 && kb->keysym == NoSymbol &&
-		    kb->keycode == e->keycode) || kb->keysym ==
-		    (modshift == 0 ? keysym : skeysym))
+		if (kb->keysym == (modshift == 0 ? keysym : skeysym))
 			break;
 	}