diff options
author | sobomax <sobomax@FreeBSD.org> | 2001-01-24 09:05:35 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2001-01-24 09:05:35 +0000 |
commit | 367aa44ae5aaa751693a35fe7f0a2c5408d31e64 (patch) | |
tree | 20a923c69676324d5e95905ea23307e0dd96dc10 /lib/libvgl | |
parent | 558ee819ee22139e74db04b28800c9fbedca91f1 (diff) | |
download | FreeBSD-src-367aa44ae5aaa751693a35fe7f0a2c5408d31e64.zip FreeBSD-src-367aa44ae5aaa751693a35fe7f0a2c5408d31e64.tar.gz |
Minor fixes:
- Use "OPOST | ONLCR" as a c_oflag in the raw mode instead of 0, which should
make debug output mode readable;
- flush input buffer when switching to/from raw mode. This should prevent
leaking raw scancodes into your shell prompt when program called
VGLKeyboardEnd() w/o processing all scancodes in the buffer.
Diffstat (limited to 'lib/libvgl')
-rw-r--r-- | lib/libvgl/keyboard.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libvgl/keyboard.c b/lib/libvgl/keyboard.c index 85850f5..fe1286a 100644 --- a/lib/libvgl/keyboard.c +++ b/lib/libvgl/keyboard.c @@ -51,14 +51,14 @@ VGLKeyboardInit(int mode) term = VGLKeyboardTty; cfmakeraw(&term); term.c_iflag = IGNPAR | IGNBRK; - term.c_oflag = 0; + term.c_oflag = OPOST | ONLCR; term.c_cflag = CREAD | CS8; term.c_lflag &= ~(ICANON | ECHO | ISIG); term.c_cc[VTIME] = 0; term.c_cc[VMIN] = 0; cfsetispeed(&term, 9600); cfsetospeed(&term, 9600); - tcsetattr(0, TCSANOW, &term); + tcsetattr(0, TCSANOW | TCSAFLUSH, &term); switch (mode) { case VGL_RAWKEYS: @@ -79,7 +79,7 @@ VGLKeyboardEnd() { if (VGLKeyboardMode != -1) { ioctl(0, KDSKBMODE, VGLKeyboardMode); - tcsetattr(0, TCSANOW, &VGLKeyboardTty); + tcsetattr(0, TCSANOW | TCSAFLUSH, &VGLKeyboardTty); } } |