From f5d76afe37f50bb81599da0530aed1d78475680e Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 23 Feb 2003 05:36:49 +0000 Subject: [PATCH] * key.c (get_modifier): Add support for QNX Neutrino console. --- src/ChangeLog | 4 ++++ src/key.c | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index ae5551d93..cbc54c078 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-02-23 Dmitry Alexeyev + + * key.c (get_modifier): Add support for QNX Neutrino console. + 2003-02-23 Pavel Roskin * key.c (init_key_x11): Don't try to use X11 if DISPLAY is not diff --git a/src/key.c b/src/key.c index f1220877d..aa1c817b6 100644 --- a/src/key.c +++ b/src/key.c @@ -56,6 +56,10 @@ # include #endif +#ifdef __QNXNTO__ +# include +#endif + #define GET_TIME(tv) (gettimeofday(&tv, (struct timezone *)NULL)) #define DIF_TIME(t1,t2) ((t2.tv_sec -t1.tv_sec) *1000+ \ (t2.tv_usec-t1.tv_usec)/1000) @@ -1092,6 +1096,9 @@ static int get_modifier (void) { int result = 0; +#ifdef __QNXNTO__ + int mod_status, shift_ext_status; +#endif #ifdef HAVE_TEXTMODE_X11_SUPPORT if (x11_window) { @@ -1106,7 +1113,7 @@ get_modifier (void) #else XQueryPointer (x11_display, x11_window, &root, &child, &root_x, &root_y, &win_x, &win_y, &mask); -#endif /* HAVE_GMODULE */ +#endif /* HAVE_GMODULE */ if (mask & ShiftMask) result |= KEY_M_SHIFT; @@ -1115,6 +1122,22 @@ get_modifier (void) return result; } #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__ { unsigned char modifiers = 6;