* key.c (get_modifier): Add support for QNX Neutrino console.

This commit is contained in:
Pavel Roskin 2003-02-23 05:36:49 +00:00
parent 03c475c4b7
commit f5d76afe37
2 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2003-02-23 Dmitry Alexeyev <dmi_a@qnx.org.ru>
* key.c (get_modifier): Add support for QNX Neutrino console.
2003-02-23 Pavel Roskin <proski@gnu.org> 2003-02-23 Pavel Roskin <proski@gnu.org>
* key.c (init_key_x11): Don't try to use X11 if DISPLAY is not * key.c (init_key_x11): Don't try to use X11 if DISPLAY is not

View File

@ -56,6 +56,10 @@
# include <sys/ioctl.h> # include <sys/ioctl.h>
#endif #endif
#ifdef __QNXNTO__
# include <sys/dcmd_chr.h>
#endif
#define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL)) #define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL))
#define DIF_TIME(t1,t2) ((t2.tv_sec -t1.tv_sec) *1000+ \ #define DIF_TIME(t1,t2) ((t2.tv_sec -t1.tv_sec) *1000+ \
(t2.tv_usec-t1.tv_usec)/1000) (t2.tv_usec-t1.tv_usec)/1000)
@ -1092,6 +1096,9 @@ static int
get_modifier (void) get_modifier (void)
{ {
int result = 0; int result = 0;
#ifdef __QNXNTO__
int mod_status, shift_ext_status;
#endif
#ifdef HAVE_TEXTMODE_X11_SUPPORT #ifdef HAVE_TEXTMODE_X11_SUPPORT
if (x11_window) { if (x11_window) {
@ -1106,7 +1113,7 @@ get_modifier (void)
#else #else
XQueryPointer (x11_display, x11_window, &root, &child, &root_x, XQueryPointer (x11_display, x11_window, &root, &child, &root_x,
&root_y, &win_x, &win_y, &mask); &root_y, &win_x, &win_y, &mask);
#endif /* HAVE_GMODULE */ #endif /* HAVE_GMODULE */
if (mask & ShiftMask) if (mask & ShiftMask)
result |= KEY_M_SHIFT; result |= KEY_M_SHIFT;
@ -1115,6 +1122,22 @@ get_modifier (void)
return result; return result;
} }
#endif #endif
#ifdef __QNXNTO__
/* This code doesn't work under Photon */
if (devctl
(fileno (stdin), DCMD_CHR_LINESTATUS, &mod_status, sizeof (int),
NULL) == -1)
return 0;
shift_ext_status = mod_status & 0xffffff00UL;
mod_status &= 0x7f;
if (mod_status & _LINESTATUS_CON_ALT)
result |= KEY_M_ALT;
if (mod_status & _LINESTATUS_CON_CTRL)
result |= KEY_M_CTRL;
if ((mod_status & _LINESTATUS_CON_SHIFT)
|| (shift_ext_status & 0x00000800UL))
result |= KEY_M_SHIFT;
#endif
#ifdef __linux__ #ifdef __linux__
{ {
unsigned char modifiers = 6; unsigned char modifiers = 6;