* fhandler_console.cc (read): Consider offset within scrolling

region of the console window.
This commit is contained in:
Corinna Vinschen 2004-12-14 12:09:51 +00:00
parent 82673116e1
commit 988566db0c
2 changed files with 22 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2004-12-14 Thomas Wolff <towo@computer.org>
* fhandler_console.cc (read): Consider offset within scrolling
region of the console window.
2004-12-13 Corinna Vinschen <corinna@vinschen.de>
* cygheap.h (cwdstuff::get_drive): Release cwd_lock.

View File

@ -421,10 +421,25 @@ fhandler_console::read (void *pv, size_t& buflen)
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");