summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2009-07-22 16:24:59 +0000
committerTiago Cunha <tcunha@gmx.com>2009-07-22 16:24:59 +0000
commita734488a4b84752000ee511b57f07d91ddc28a6d (patch)
tree091cec0e80ba02bc776c3ae1263c37dd2c9e670f /key-string.c
parent94e2339842b813b608fa7726f67b985eb8592712 (diff)
Sync OpenBSD patchset 151:
Tidy up keys: use an enum for the key codes, and remove the macros which just wrap flag sets/clears/tests.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/key-string.c b/key-string.c
index da82c9fb..c83b9236 100644
--- a/key-string.c
+++ b/key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c,v 1.18 2009-07-14 06:38:14 nicm Exp $ */
+/* $Id: key-string.c,v 1.19 2009-07-22 16:24:59 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -126,7 +126,7 @@ key_string_lookup_string(const char *string)
}
key = key_string_search_table(ptr);
if (key != KEYC_NONE)
- return (KEYC_ADDCTL(key));
+ return (key | KEYC_CTRL);
return (KEYC_NONE);
}
@@ -137,11 +137,11 @@ key_string_lookup_string(const char *string)
if (ptr[1] == '\0') {
if (ptr[0] < 32 || ptr[0] > 127)
return (KEYC_NONE);
- return (KEYC_ADDESC(ptr[0]));
+ return (ptr[0] | KEYC_ESCAPE);
}
key = key_string_lookup_string(ptr);
if (key != KEYC_NONE)
- return (KEYC_ADDESC(key));
+ return (key | KEYC_ESCAPE);
return (KEYC_NONE);
}
@@ -158,20 +158,20 @@ key_string_lookup_key(int key)
if (key == 127)
return (NULL);
- if (KEYC_ISESC(key)) {
- if ((s = key_string_lookup_key(KEYC_REMOVEESC(key))) == NULL)
+ if (key & KEYC_ESCAPE) {
+ if ((s = key_string_lookup_key(key & ~KEYC_ESCAPE)) == NULL)
return (NULL);
xsnprintf(tmp2, sizeof tmp2, "M-%s", s);
return (tmp2);
}
- if (KEYC_ISCTL(key)) {
- if ((s = key_string_lookup_key(KEYC_REMOVECTL(key))) == NULL)
+ if (key & KEYC_CTRL) {
+ if ((s = key_string_lookup_key(key & ~KEYC_CTRL)) == NULL)
return (NULL);
xsnprintf(tmp2, sizeof tmp2, "C-%s", s);
return (tmp2);
}
- if (KEYC_ISSFT(key)) {
- if ((s = key_string_lookup_key(KEYC_REMOVESFT(key))) == NULL)
+ if (key & KEYC_SHIFT) {
+ if ((s = key_string_lookup_key(key & ~KEYC_SHIFT)) == NULL)
return (NULL);
xsnprintf(tmp2, sizeof tmp2, "S-%s", s);
return (tmp2);