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.
This commit is contained in:
okan 2013-11-27 16:24:17 +00:00
parent 250f98bf15
commit abf52049b9
3 changed files with 7 additions and 22 deletions

15
conf.c
View File

@ -479,17 +479,8 @@ conf_bind_kbd(struct conf *c, char *name, char *binding)
substring = conf_bind_getmask(name, &mask); substring = conf_bind_getmask(name, &mask);
current_binding->modmask |= 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); current_binding->keysym = XStringToKeysym(substring);
} if (current_binding->keysym == NoSymbol) {
if (current_binding->keysym == NoSymbol &&
current_binding->keycode == 0) {
free(current_binding); free(current_binding);
return; return;
} }
@ -530,9 +521,7 @@ conf_unbind_kbd(struct conf *c, struct keybinding *unbind)
if (key->modmask != unbind->modmask) if (key->modmask != unbind->modmask)
continue; continue;
if ((key->keycode != 0 && key->keysym == NoSymbol && if (key->keysym == unbind->keysym) {
key->keycode == unbind->keycode) ||
key->keysym == unbind->keysym) {
TAILQ_REMOVE(&c->keybindingq, key, entry); TAILQ_REMOVE(&c->keybindingq, key, entry);
if (key->argtype & ARG_CHAR) if (key->argtype & ARG_CHAR)
free(key->argument.c); free(key->argument.c);

View File

@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: June 17 2013 $ .Dd $Mdocdate: July 8 2013 $
.Dt CWMRC 5 .Dt CWMRC 5
.Os .Os
.Sh NAME .Sh NAME
@ -84,10 +84,8 @@ The Mod4 key (normally the windows key).
.Pp .Pp
The The
.Sq - .Sq -
should be followed by either a keysym name, taken from should be followed by a keysym name, taken from
.Pa /usr/X11R6/include/X11/keysymdef.h , .Pa /usr/X11R6/include/X11/keysymdef.h .
or a numerical keycode value enclosed in
.Dq [] .
The The
.Ar command .Ar command
may either be one from the may either be one from the

View File

@ -275,9 +275,7 @@ xev_handle_keypress(XEvent *ee)
if ((kb->modmask | modshift) != e->state) if ((kb->modmask | modshift) != e->state)
continue; continue;
if ((kb->keycode != 0 && kb->keysym == NoSymbol && if (kb->keysym == (modshift == 0 ? keysym : skeysym))
kb->keycode == e->keycode) || kb->keysym ==
(modshift == 0 ? keysym : skeysym))
break; break;
} }