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_console.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'winsup/cygwin/fhandler_console.cc') diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index 7248e1747..82ede58cd 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -20,6 +20,7 @@ details. */ #include #include #include +#include #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) { -- cgit v1.2.3