mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-20 07:51:35 +08:00
* 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:
parent
61aea27d90
commit
6258d96af8
@ -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
|
||||
|
@ -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];
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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 ();
|
||||
|
20
winsup/cygwin/include/cygwin/kd.h
Normal file
20
winsup/cygwin/include/cygwin/kd.h
Normal file
@ -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_ */
|
20
winsup/cygwin/include/sys/kd.h
Normal file
20
winsup/cygwin/include/sys/kd.h
Normal file
@ -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 */
|
Loading…
x
Reference in New Issue
Block a user