Sync OpenBSD patchset 511:

Key flags are only used for initialisation so they are not needed in the main
tty_key struct.
This commit is contained in:
Tiago Cunha 2009-11-08 23:29:34 +00:00
parent fb22aaf87f
commit 7d288e7fd8
2 changed files with 8 additions and 11 deletions

6
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.509 2009-11-08 23:27:58 tcunha Exp $ */ /* $Id: tmux.h,v 1.510 2009-11-08 23:29:34 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -938,10 +938,6 @@ struct tty_key {
int key; int key;
char *string; char *string;
int flags;
#define TTYKEY_CTRL 0x1
#define TTYKEY_RAW 0x2
RB_ENTRY(tty_key) entry; RB_ENTRY(tty_key) entry;
}; };

View File

@ -1,4 +1,4 @@
/* $Id: tty-keys.c,v 1.40 2009-11-08 23:26:56 tcunha Exp $ */ /* $Id: tty-keys.c,v 1.41 2009-11-08 23:29:34 tcunha Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -29,7 +29,7 @@
* Handle keys input from the outside terminal. * 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 *); void tty_keys_callback(int, short, void *);
int tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *); int tty_keys_mouse(char *, size_t, size_t *, struct mouse_event *);
@ -39,6 +39,8 @@ struct tty_key_ent {
int key; int key;
int flags; int flags;
#define TTYKEY_CTRL 0x1
#define TTYKEY_RAW 0x2
}; };
struct tty_key_ent tty_keys[] = { struct tty_key_ent tty_keys[] = {
@ -195,14 +197,13 @@ tty_keys_cmp(struct tty_key *k1, struct tty_key *k2)
} }
void 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; struct tty_key *tk, *tl;
tk = xmalloc(sizeof *tk); tk = xmalloc(sizeof *tk);
tk->string = xstrdup(s); tk->string = xstrdup(s);
tk->key = key; tk->key = key;
tk->flags = flags;
if ((tl = RB_INSERT(tty_keys, &tty->ktree, tk)) != NULL) { if ((tl = RB_INSERT(tty_keys, &tty->ktree, tk)) != NULL) {
xfree(tk->string); xfree(tk->string);
@ -240,12 +241,12 @@ tty_keys_init(struct tty *tty)
continue; 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 (tke->flags & TTYKEY_CTRL) {
if (strlcpy(tmp, s, sizeof tmp) >= sizeof tmp) if (strlcpy(tmp, s, sizeof tmp) >= sizeof tmp)
continue; continue;
tmp[strlen(tmp) - 1] ^= 0x20; 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);
} }
} }
} }