From 6258d96af8a0181b81d5466d78fb4255f94de009 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 3 Jul 2006 15:29:10 +0000 Subject: * 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. --- winsup/cygwin/fhandler_tty.cc | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/fhandler_tty.cc') diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index c623c872a..9ecba14d9 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -17,6 +17,7 @@ details. */ #include #include #include +#include #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 (); -- cgit v1.2.3