diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2012-04-24 14:39:22 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2012-04-24 14:39:22 +0000 |
commit | d581bbfa8e8ac82c11e9bf771e77e5dac0334464 (patch) | |
tree | 6efef58ca8a4bba90ff13084022e3c2ffcdea940 | |
parent | 503a59c70bc185575be7316bbcd45f9e7a68ca7c (diff) | |
download | newlib-d581bbfa8e8ac82c11e9bf771e77e5dac0334464.zip newlib-d581bbfa8e8ac82c11e9bf771e77e5dac0334464.tar.gz newlib-d581bbfa8e8ac82c11e9bf771e77e5dac0334464.tar.bz2 |
* fhandler_console.cc (ALT_PRESSED): Define earlier, never undefine.
(CTRL_PRESSED): Ditto.
(fhandler_console::read): Simplify expressions testing for pressed ALT
or CTRL modifier keys.
(get_nonascii_key): Ditto.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_console.cc | 17 |
2 files changed, 15 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f5ca0e0..01d71bd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2012-04-24 Corinna Vinschen <corinna@vinschen.de> + + * fhandler_console.cc (ALT_PRESSED): Define earlier, never undefine. + (CTRL_PRESSED): Ditto. + (fhandler_console::read): Simplify expressions testing for pressed ALT + or CTRL modifier keys. + (get_nonascii_key): Ditto. + 2012-04-24 Thomas Wolff <towo@towo.net> * fhandler.h (class dev_console): Add members ext_mouse_mode6 and diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc index e81cc23..9a074f0 100644 --- a/winsup/cygwin/fhandler_console.cc +++ b/winsup/cygwin/fhandler_console.cc @@ -41,6 +41,9 @@ details. */ is allocated using tmp_pathbuf!!! */ #define CONVERT_LIMIT NT_MAX_PATH +#define ALT_PRESSED (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED) +#define CTRL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) + /* * Scroll the screen context. * x1, y1 - ul corner @@ -421,8 +424,6 @@ fhandler_console::read (void *pv, size_t& buflen) #define ich (input_rec.Event.KeyEvent.uChar.AsciiChar) #define wch (input_rec.Event.KeyEvent.uChar.UnicodeChar) -#define ALT_PRESSED (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED) -#define CTRL_PRESSED (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED) /* Ignore key up events, except for left alt events with non-zero character */ @@ -523,8 +524,6 @@ fhandler_console::read (void *pv, size_t& buflen) } #undef ich #undef wch -#undef ALT_PRESSED -#undef CTRL_PRESSED break; case MOUSE_EVENT: @@ -623,9 +622,9 @@ fhandler_console::read (void *pv, size_t& buflen) dev_state.nModifiers = 0; if (mouse_event.dwControlKeyState & SHIFT_PRESSED) dev_state.nModifiers |= 0x4; - if (mouse_event.dwControlKeyState & (RIGHT_ALT_PRESSED|LEFT_ALT_PRESSED)) + if (mouse_event.dwControlKeyState & ALT_PRESSED) dev_state.nModifiers |= 0x8; - if (mouse_event.dwControlKeyState & (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)) + if (mouse_event.dwControlKeyState & CTRL_PRESSED) dev_state.nModifiers |= 0x10; /* Indicate the modifiers */ @@ -2205,15 +2204,13 @@ get_nonascii_key (INPUT_RECORD& input_rec, char *tmp) int modifier_index = NORMAL; if (input_rec.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED) modifier_index = SHIFT; - if (input_rec.Event.KeyEvent.dwControlKeyState & - (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) + if (input_rec.Event.KeyEvent.dwControlKeyState & CTRL_PRESSED) modifier_index += CONTROL; for (int i = 0; keytable[i].vk; i++) if (input_rec.Event.KeyEvent.wVirtualKeyCode == keytable[i].vk) { - if ((input_rec.Event.KeyEvent.dwControlKeyState & - (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) + if ((input_rec.Event.KeyEvent.dwControlKeyState & ALT_PRESSED) && keytable[i].val[modifier_index] != NULL) { /* Generic ESC prefixing if Alt is pressed */ tmp[0] = '\033'; |