Add user-keys option to allow user-defined keys to be set, from Dan

Aloni.
This commit is contained in:
nicm
2017-06-23 15:36:52 +00:00
parent a67df17763
commit 95ed7d48c8
6 changed files with 50 additions and 3 deletions

View File

@ -110,12 +110,16 @@ static const struct {
static key_code
key_string_search_table(const char *string)
{
u_int i;
u_int i, user;
for (i = 0; i < nitems(key_string_table); i++) {
if (strcasecmp(string, key_string_table[i].string) == 0)
return (key_string_table[i].key);
}
if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER)
return (KEYC_USER + user);
return (KEYC_UNKNOWN);
}
@ -265,6 +269,10 @@ key_string_lookup_key(key_code key)
return ("MouseMoveStatus");
if (key == KEYC_MOUSEMOVE_BORDER)
return ("MouseMoveBorder");
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {
snprintf(out, sizeof out, "User%u", (u_int)(key - KEYC_USER));
return (out);
}
/*
* Special case: display C-@ as C-Space. Could do this below in