--- cygwin-1.5.12-1/winsup/cygwin/fhandler_console.cc.old 2004-10-28 17:33:04.000000000 +0200 +++ cygwin-1.5.12-1/winsup/cygwin/fhandler_console.cc 2004-11-26 16:24:51.000000000 +0100 @@ -422,10 +422,25 @@ if (mouse_event.dwEventFlags) continue; - /* If the mouse event occurred out of the area we can handle, - ignore it. */ + /* Retrieve reported mouse position */ int x = mouse_event.dwMousePosition.X; int y = mouse_event.dwMousePosition.Y; + + /* Adjust mouse position by scroll buffer offset */ + CONSOLE_SCREEN_BUFFER_INFO now; + if (GetConsoleScreenBufferInfo (get_output_handle (), &now)) + { + y -= now.srWindow.Top; + x -= now.srWindow.Left; + } + else + { + syscall_printf ("mouse: cannot adjust position by scroll buffer offset"); + continue; + } + + /* If the mouse event occurred out of the area we can handle, + ignore it. */ if ((x + ' ' + 1 > 0xFF) || (y + ' ' + 1 > 0xFF)) { syscall_printf ("mouse: position out of range"); @@ -921,14 +936,32 @@ if (dev_state->reverse) { WORD save_fg = win_fg; +#define reverse_bright +#ifdef reverse_bright + /* This way, a bright foreground will reverse to a bright background. + */ + win_fg = (win_bg & BACKGROUND_RED ? FOREGROUND_RED : 0) | + (win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0) | + (win_bg & BACKGROUND_BLUE ? FOREGROUND_BLUE : 0) | + (win_bg & BACKGROUND_INTENSITY ? FOREGROUND_INTENSITY : 0); + win_bg = (save_fg & FOREGROUND_RED ? BACKGROUND_RED : 0) | + (save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0) | + (save_fg & FOREGROUND_BLUE ? BACKGROUND_BLUE : 0) | + (save_fg & FOREGROUND_INTENSITY ? BACKGROUND_INTENSITY : 0); +#else + /* This way, a bright foreground will reverse to a dim background. + But the background will no longer reverse to a bright foreground + (which used to render reverse output unreadable). + */ win_fg = (win_bg & BACKGROUND_RED ? FOREGROUND_RED : 0) | (win_bg & BACKGROUND_GREEN ? FOREGROUND_GREEN : 0) | (win_bg & BACKGROUND_BLUE ? FOREGROUND_BLUE : 0) | - (win_fg & FOREGROUND_INTENSITY); + (win_bg & FOREGROUND_INTENSITY); win_bg = (save_fg & FOREGROUND_RED ? BACKGROUND_RED : 0) | (save_fg & FOREGROUND_GREEN ? BACKGROUND_GREEN : 0) | (save_fg & FOREGROUND_BLUE ? BACKGROUND_BLUE : 0) | - (win_bg & BACKGROUND_INTENSITY); + (save_fg & BACKGROUND_INTENSITY); +#endif } if (dev_state->underline) win_fg = dev_state->underline_color;