mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 16:26:12 +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>
|
2006-07-03 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
* include/stdint.h (UINT8_C, UINT16_C): Unsigned types smaller
|
* include/stdint.h (UINT8_C, UINT16_C): Unsigned types smaller
|
||||||
|
@ -821,6 +821,7 @@ class dev_console
|
|||||||
unsigned rarg;
|
unsigned rarg;
|
||||||
bool saw_question_mark;
|
bool saw_question_mark;
|
||||||
bool alternate_charset_active;
|
bool alternate_charset_active;
|
||||||
|
bool metabit;
|
||||||
|
|
||||||
char my_title_buf [TITLESIZE + 1];
|
char my_title_buf [TITLESIZE + 1];
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ details. */
|
|||||||
#include <winnls.h>
|
#include <winnls.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <sys/cygwin.h>
|
#include <sys/cygwin.h>
|
||||||
|
#include <cygwin/kd.h>
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
#include "path.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;
|
meta = (control_key_state & dev_state->meta_mask) != 0;
|
||||||
if (!meta)
|
if (!meta)
|
||||||
toadd = tmp + 1;
|
toadd = tmp + 1;
|
||||||
|
else if (dev_state->metabit)
|
||||||
|
{
|
||||||
|
tmp[1] |= 0x80;
|
||||||
|
toadd = tmp + 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp[0] = '\033';
|
tmp[0] = '\033';
|
||||||
@ -745,6 +751,20 @@ fhandler_console::ioctl (unsigned int cmd, void *buf)
|
|||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
bg_check (SIGTTOU);
|
bg_check (SIGTTOU);
|
||||||
return 0;
|
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:
|
case TIOCLINUX:
|
||||||
if (* (int *) buf == 6)
|
if (* (int *) buf == 6)
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@ details. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <cygwin/kd.h>
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "security.h"
|
#include "security.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
@ -435,9 +436,12 @@ process_ioctl (void *)
|
|||||||
{
|
{
|
||||||
WaitForSingleObject (tty_master->ioctl_request_event, INFINITE);
|
WaitForSingleObject (tty_master->ioctl_request_event, INFINITE);
|
||||||
termios_printf ("ioctl() request");
|
termios_printf ("ioctl() request");
|
||||||
tty_master->get_ttyp ()->ioctl_retval =
|
tty *ttyp = tty_master->get_ttyp ();
|
||||||
tty_master->console->ioctl (tty_master->get_ttyp ()->cmd,
|
ttyp->ioctl_retval =
|
||||||
(void *) &tty_master->get_ttyp ()->arg);
|
tty_master->console->ioctl (ttyp->cmd,
|
||||||
|
(ttyp->cmd == KDSKBMETA)
|
||||||
|
? (void *) ttyp->arg.value
|
||||||
|
: (void *) &ttyp->arg);
|
||||||
SetEvent (tty_master->ioctl_done_event);
|
SetEvent (tty_master->ioctl_done_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1001,6 +1005,8 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
|
|||||||
case TIOCGWINSZ:
|
case TIOCGWINSZ:
|
||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
case TIOCLINUX:
|
case TIOCLINUX:
|
||||||
|
case KDGKBMETA:
|
||||||
|
case KDSKBMETA:
|
||||||
break;
|
break;
|
||||||
case FIONBIO:
|
case FIONBIO:
|
||||||
set_nonblocking (*(int *) arg);
|
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;
|
*(unsigned char *) arg = get_ttyp ()->arg.value & 0xFF;
|
||||||
}
|
}
|
||||||
break;
|
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 ();
|
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