diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-07-03 15:29:10 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-07-03 15:29:10 +0000 |
commit | 6258d96af8a0181b81d5466d78fb4255f94de009 (patch) | |
tree | 9b9b6d456b8abd4653817a6dcc5f8c0c9588f768 /winsup/cygwin | |
parent | 61aea27d9002e491db5ea54a35cf3141843edcb9 (diff) | |
download | cygnal-6258d96af8a0181b81d5466d78fb4255f94de009.tar.gz cygnal-6258d96af8a0181b81d5466d78fb4255f94de009.tar.bz2 cygnal-6258d96af8a0181b81d5466d78fb4255f94de009.zip |
* 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.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r-- | winsup/cygwin/ChangeLog | 14 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 1 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 20 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 34 | ||||
-rw-r--r-- | winsup/cygwin/include/cygwin/kd.h | 20 | ||||
-rw-r--r-- | winsup/cygwin/include/sys/kd.h | 20 |
6 files changed, 106 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index c9d4f68b0..f158ada06 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,17 @@ +2006-07-03 Kazuhiro Fujieda <fujieda@jaist.ac.jp> + + * 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. + 2006-07-03 Eric Blake <ebb9@byu.net> * include/stdint.h (UINT8_C, UINT16_C): Unsigned types smaller diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index cd0ee570c..313a655dd 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -821,6 +821,7 @@ class dev_console unsigned rarg; bool saw_question_mark; bool alternate_charset_active; + bool metabit; char my_title_buf [TITLESIZE + 1]; 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 <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) { 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 <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 (); diff --git a/winsup/cygwin/include/cygwin/kd.h b/winsup/cygwin/include/cygwin/kd.h new file mode 100644 index 000000000..b4ec7c523 --- /dev/null +++ b/winsup/cygwin/include/cygwin/kd.h @@ -0,0 +1,20 @@ +/* cygwin/kd.h + + Copyright 2006 Red Hat Inc. + Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp> + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN_KD_H_ +#define _CYGWIN_KD_H_ + +#define KDGKBMETA 0x4b62 +#define KDSKBMETA 0x4b63 +#define K_METABIT 0x03 +#define K_ESCPREFIX 0x04 + +#endif /* _CYGWIN_KD_H_ */ diff --git a/winsup/cygwin/include/sys/kd.h b/winsup/cygwin/include/sys/kd.h new file mode 100644 index 000000000..5900efdd7 --- /dev/null +++ b/winsup/cygwin/include/sys/kd.h @@ -0,0 +1,20 @@ +/* sys/kd.h + + Copyright 2006 Red Hat, Inc. + + Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp> + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +/* sys/kd.h header file for Cygwin. */ + +#ifndef _SYS_KD_H +#define _SYS_KD_H + +#include <cygwin/kd.h> + +#endif /* _SYS_KD_H */ |