diff options
| author | newman <empty> | 1987-09-08 14:32:21 +0000 |
|---|---|---|
| committer | newman <empty> | 1987-09-08 14:32:21 +0000 |
| commit | 0aecc4f21449050657ce34f7599d383e14fcdf40 (patch) | |
| tree | 91cb766ece00331d99b0001d2c09ff85dc27cbd8 /xc/lib/X11/KeyBind.c | |
| parent | bca4cc7929a5dbe88455e4dfe3ed191368575c57 (diff) | |
check for legal control character
Diffstat (limited to 'xc/lib/X11/KeyBind.c')
| -rw-r--r-- | xc/lib/X11/KeyBind.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/xc/lib/X11/KeyBind.c b/xc/lib/X11/KeyBind.c index d0dfd0204..122b6f3a4 100644 --- a/xc/lib/X11/KeyBind.c +++ b/xc/lib/X11/KeyBind.c @@ -1,6 +1,6 @@ #include "copyright.h" -/* $Header: XKeyBind.c,v 11.32 87/09/03 21:01:27 toddb Locked $ */ +/* $Header: XKeyBind.c,v 11.33 87/09/04 16:59:43 newman Locked $ */ /* Copyright 1985, 1987, Massachusetts Institute of Technology */ /* Beware, here be monsters (still under construction... - JG */ @@ -12,6 +12,8 @@ #include "keysym.h" #include <stdio.h> +#define HAS_CTRL(c) ((c) >= '@' && (c) <= '\0177') + struct XKeytrans { struct XKeytrans *next;/* next on list */ char *string; /* string to return when the time comes */ @@ -235,7 +237,9 @@ int XLookupString (event, buffer, nbytes, keysym, status) buf[0] = byte4; /* if X keysym, convert to ascii by grabbing low 7 bits */ if (byte3 == 0xFF) buf[0] &= 0x7F; - if (event->state & ControlMask) buf[0] = buf[0] & 0x1F; + /* only apply Control key if it makes sense, else ignore it */ + if ((event->state & ControlMask) && HAS_CTRL(buf[0])) + buf[0] = buf[0] & 0x1F; length = 1; } if (length > nbytes) length = nbytes; |
