* fhandler_console.c (fhandler_console::read): Record the state of the SHIFT,
CTRL and ALT keys at the time of the last keyboard input event. (fhandler_console::ioctl): Handle requests to retrieve the keyboard modifiers via the TIOCLINUX command. * fhandler_tty.c (fhandler_tty_slave::read): Ditto. * include/sys/termios.h (TIOCLINUX): New macro definition.
This commit is contained in:
parent
ecc28ff8db
commit
63726a5eb4
|
@ -1,3 +1,12 @@
|
||||||
|
2003-09-26 Pavel Tsekov <ptsekov@gmx.net>
|
||||||
|
|
||||||
|
* fhandler_console.c (fhandler_console::read): Record the state of the
|
||||||
|
SHIFT, CTRL and ALT keys at the time of the last keyboard input event.
|
||||||
|
(fhandler_console::ioctl): Handle requests to retrieve the keyboard
|
||||||
|
modifiers via the TIOCLINUX command.
|
||||||
|
* fhandler_tty.c (fhandler_tty_slave::read): Ditto.
|
||||||
|
* include/sys/termios.h (TIOCLINUX): New macro definition.
|
||||||
|
|
||||||
2003-09-26 Pierre Humblet <pierre.humblet@ieee.org>
|
2003-09-26 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* pinfo.cc (pinfo::init): Do not give FILE_MAP_WRITE access to Everybody.
|
* pinfo.cc (pinfo::init): Do not give FILE_MAP_WRITE access to Everybody.
|
||||||
|
@ -16,7 +25,7 @@
|
||||||
2003-09-26 Pierre Humblet <pierre.humblet@ieee.org>
|
2003-09-26 Pierre Humblet <pierre.humblet@ieee.org>
|
||||||
|
|
||||||
* uinfo.cc (cygheap_user::init): Make sure the current user appears
|
* uinfo.cc (cygheap_user::init): Make sure the current user appears
|
||||||
in the default DACL. Rearrange to decrease the indentation levels.
|
in the default DACL. Rearrange to decrease the indentation levels.
|
||||||
Initialize the effec_cygsid directly.
|
Initialize the effec_cygsid directly.
|
||||||
(internal_getlogin): Do not reinitialize myself->gid. Open the process
|
(internal_getlogin): Do not reinitialize myself->gid. Open the process
|
||||||
token with the required access.
|
token with the required access.
|
||||||
|
|
|
@ -294,6 +294,8 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
#define virtual_key_code (input_rec.Event.KeyEvent.wVirtualKeyCode)
|
#define virtual_key_code (input_rec.Event.KeyEvent.wVirtualKeyCode)
|
||||||
#define control_key_state (input_rec.Event.KeyEvent.dwControlKeyState)
|
#define control_key_state (input_rec.Event.KeyEvent.dwControlKeyState)
|
||||||
|
|
||||||
|
dev_state->nModifiers = 0;
|
||||||
|
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
|
/* allow manual switching to/from raw mode via ctrl-alt-scrolllock */
|
||||||
if (input_rec.Event.KeyEvent.bKeyDown &&
|
if (input_rec.Event.KeyEvent.bKeyDown &&
|
||||||
|
@ -340,13 +342,25 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
&& input_rec.Event.KeyEvent.wVirtualScanCode == 0x38))
|
&& input_rec.Event.KeyEvent.wVirtualScanCode == 0x38))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (control_key_state & SHIFT_PRESSED)
|
||||||
|
dev_state->nModifiers |= 1;
|
||||||
|
if (control_key_state & RIGHT_ALT_PRESSED)
|
||||||
|
dev_state->nModifiers |= 2;
|
||||||
|
if (control_key_state & CTRL_PRESSED)
|
||||||
|
dev_state->nModifiers |= 4;
|
||||||
|
if (control_key_state & LEFT_ALT_PRESSED)
|
||||||
|
dev_state->nModifiers |= 8;
|
||||||
|
|
||||||
if (wch == 0 ||
|
if (wch == 0 ||
|
||||||
/* arrow/function keys */
|
/* arrow/function keys */
|
||||||
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
(input_rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY))
|
||||||
{
|
{
|
||||||
toadd = get_nonascii_key (input_rec, tmp);
|
toadd = get_nonascii_key (input_rec, tmp);
|
||||||
if (!toadd)
|
if (!toadd)
|
||||||
continue;
|
{
|
||||||
|
dev_state->nModifiers = 0;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
nread = strlen (toadd);
|
nread = strlen (toadd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -379,6 +393,7 @@ fhandler_console::read (void *pv, size_t& buflen)
|
||||||
tmp[1] = cyg_tolower (tmp[1]);
|
tmp[1] = cyg_tolower (tmp[1]);
|
||||||
toadd = tmp;
|
toadd = tmp;
|
||||||
nread++;
|
nread++;
|
||||||
|
dev_state->nModifiers &= ~4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef ich
|
#undef ich
|
||||||
|
@ -715,6 +730,17 @@ fhandler_console::ioctl (unsigned int cmd, void *buf)
|
||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
(void) bg_check (SIGTTOU);
|
(void) bg_check (SIGTTOU);
|
||||||
return 0;
|
return 0;
|
||||||
|
case TIOCLINUX:
|
||||||
|
if (* (int *) buf == 6)
|
||||||
|
{
|
||||||
|
* (int *) buf = dev_state->nModifiers;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_errno (EINVAL);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return fhandler_base::ioctl (cmd, buf);
|
return fhandler_base::ioctl (cmd, buf);
|
||||||
|
|
|
@ -1028,6 +1028,7 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
|
||||||
{
|
{
|
||||||
case TIOCGWINSZ:
|
case TIOCGWINSZ:
|
||||||
case TIOCSWINSZ:
|
case TIOCSWINSZ:
|
||||||
|
case TIOCLINUX:
|
||||||
break;
|
break;
|
||||||
case FIONBIO:
|
case FIONBIO:
|
||||||
set_nonblocking (*(int *) arg);
|
set_nonblocking (*(int *) arg);
|
||||||
|
@ -1071,6 +1072,21 @@ fhandler_tty_slave::ioctl (unsigned int cmd, void *arg)
|
||||||
WaitForSingleObject (ioctl_done_event, INFINITE);
|
WaitForSingleObject (ioctl_done_event, INFINITE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case TIOCLINUX:
|
||||||
|
int val = * (unsigned char *) arg;
|
||||||
|
if (val == 6 && ioctl_request_event && ioctl_done_event)
|
||||||
|
{
|
||||||
|
get_ttyp ()->arg.value = val;
|
||||||
|
SetEvent (ioctl_request_event);
|
||||||
|
WaitForSingleObject (ioctl_done_event, INFINITE);
|
||||||
|
* (unsigned char *) arg = get_ttyp ()->arg.value & 0xFF;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
get_ttyp ()->ioctl_retval = -1;
|
||||||
|
set_errno (EINVAL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
release_output_mutex ();
|
release_output_mutex ();
|
||||||
|
|
|
@ -330,5 +330,6 @@ struct winsize
|
||||||
|
|
||||||
#define TIOCGWINSZ (('T' << 8) | 1)
|
#define TIOCGWINSZ (('T' << 8) | 1)
|
||||||
#define TIOCSWINSZ (('T' << 8) | 2)
|
#define TIOCSWINSZ (('T' << 8) | 2)
|
||||||
|
#define TIOCLINUX (('T' << 8) | 3)
|
||||||
|
|
||||||
#endif /* _SYS_TERMIOS_H */
|
#endif /* _SYS_TERMIOS_H */
|
||||||
|
|
Loading…
Reference in New Issue