* fhandler.h (class dev_console): Add `metabit' indicating the

current meta key mode.
	* fhandler_console.cc (fhandler_console::read): Set the top bit of
	the character if metabit is true.
	* fhandler_console.cc (fhandler_console::ioctl): Implement
	KDGKBMETA and KDSKBMETA commands.
	* fhandler_tty.cc (process_ioctl): Support KDSKBMETA.
	(fhandler_tty_slave::ioctl): Send KDGKBMETA and KDSKBMETA to the
	master.
	* include/cygwin/kd.h: New file for the meta key mode.
	* include/sys/kd.h: New file.
This commit is contained in:
Corinna Vinschen
2006-07-03 15:29:10 +00:00
parent 61aea27d90
commit 6258d96af8
6 changed files with 106 additions and 3 deletions

View File

@ -20,6 +20,7 @@ details. */
#include <winnls.h>
#include <ctype.h>
#include <sys/cygwin.h>
#include <cygwin/kd.h>
#include "cygerrno.h"
#include "security.h"
#include "path.h"
@ -397,6 +398,11 @@ fhandler_console::read (void *pv, size_t& buflen)
meta = (control_key_state & dev_state->meta_mask) != 0;
if (!meta)
toadd = tmp + 1;
else if (dev_state->metabit)
{
tmp[1] |= 0x80;
toadd = tmp + 1;
}
else
{
tmp[0] = '\033';
@ -745,6 +751,20 @@ fhandler_console::ioctl (unsigned int cmd, void *buf)
case TIOCSWINSZ:
bg_check (SIGTTOU);
return 0;
case KDGKBMETA:
*(int *) buf = (dev_state->metabit) ? K_METABIT : K_ESCPREFIX;
return 0;
case KDSKBMETA:
if ((int) buf == K_METABIT)
dev_state->metabit = TRUE;
else if ((int) buf == K_ESCPREFIX)
dev_state->metabit = FALSE;
else
{
set_errno (EINVAL);
return -1;
}
return 0;
case TIOCLINUX:
if (* (int *) buf == 6)
{