summaryrefslogtreecommitdiffstats
path: root/tty-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-05 10:44:36 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-05 10:44:36 +0000
commita790e16fa25e0fce4fc0f8ac6e83147a83ede3e8 (patch)
tree59e8edeae8cdf96c61cac9b09359657ccebf15ca /tty-keys.c
parent25c604fb1c3806fdcb230b0eaac0c3120685f8a8 (diff)
Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
Diffstat (limited to 'tty-keys.c')
-rw-r--r--tty-keys.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/tty-keys.c b/tty-keys.c
index c5c14541..21d52091 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -29,7 +29,7 @@
* Handle keys input from the outside terminal.
*/
-void tty_keys_add(struct tty *, const char *, int, int);
+void tty_keys_add(struct tty *, const char *, int);
void tty_keys_callback(int, short, void *);
int tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *);
@@ -39,6 +39,8 @@ struct tty_key_ent {
int key;
int flags;
+#define TTYKEY_CTRL 0x1
+#define TTYKEY_RAW 0x2
};
struct tty_key_ent tty_keys[] = {
@@ -195,14 +197,13 @@ tty_keys_cmp(struct tty_key *k1, struct tty_key *k2)
}
void
-tty_keys_add(struct tty *tty, const char *s, int key, int flags)
+tty_keys_add(struct tty *tty, const char *s, int key)
{
struct tty_key *tk, *tl;
tk = xmalloc(sizeof *tk);
tk->string = xstrdup(s);
tk->key = key;
- tk->flags = flags;
if ((tl = RB_INSERT(tty_keys, &tty->ktree, tk)) != NULL) {
xfree(tk->string);
@@ -240,12 +241,12 @@ tty_keys_init(struct tty *tty)
continue;
}
- tty_keys_add(tty, s + 1, tke->key, tke->flags);
+ tty_keys_add(tty, s + 1, tke->key);
if (tke->flags & TTYKEY_CTRL) {
if (strlcpy(tmp, s, sizeof tmp) >= sizeof tmp)
continue;
tmp[strlen(tmp) - 1] ^= 0x20;
- tty_keys_add(tty, tmp + 1, tke->key | KEYC_CTRL, 0);
+ tty_keys_add(tty, tmp + 1, tke->key | KEYC_CTRL);
}
}
}