* 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

@@ -17,6 +17,7 @@ details. */
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#include <cygwin/kd.h>
#include "cygerrno.h"
#include "security.h"
#include "path.h"
@@ -435,9 +436,12 @@ process_ioctl (void *)
{
WaitForSingleObject (tty_master->ioctl_request_event, INFINITE);
termios_printf ("ioctl() request");
tty_master->get_ttyp ()->ioctl_retval =
tty_master->console->ioctl (tty_master->get_ttyp ()->cmd,
(void *) &tty_master->get_ttyp ()->arg);
tty *ttyp = tty_master->get_ttyp ();
ttyp->ioctl_retval =
tty_master->console->ioctl (ttyp->cmd,
(ttyp->cmd == KDSKBMETA)
? (void *) ttyp->arg.value
: (void *) &ttyp->arg);
SetEvent (tty_master->ioctl_done_event);
}
}
@@ -1001,6 +1005,8 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
case TIOCGWINSZ:
case TIOCSWINSZ:
case TIOCLINUX:
case KDGKBMETA:
case KDSKBMETA:
break;
case FIONBIO:
set_nonblocking (*(int *) arg);
@@ -1057,6 +1063,28 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
*(unsigned char *) arg = get_ttyp ()->arg.value & 0xFF;
}
break;
case KDGKBMETA:
if (ioctl_request_event)
{
SetEvent (ioctl_request_event);
if (ioctl_done_event)
WaitForSingleObject (ioctl_done_event, INFINITE);
*(int *) arg = get_ttyp ()->arg.value;
}
else
get_ttyp ()->ioctl_retval = -EINVAL;
break;
case KDSKBMETA:
if (ioctl_request_event)
{
get_ttyp ()->arg.value = (int) arg;
SetEvent (ioctl_request_event);
if (ioctl_done_event)
WaitForSingleObject (ioctl_done_event, INFINITE);
}
else
get_ttyp ()->ioctl_retval = -EINVAL;
break;
}
release_output_mutex ();