[Patch] bug # 512 (cygwin console handling)
Thomas Wolff
towo@computer.org
Tue Nov 30 21:31:00 GMT 2004
This is a small patch that fixes
http://sourceware.org/bugzilla/show_bug.cgi?id=512
Please integrate it into the cygwin DLL.
2004-11-26 Thomas Wolff <towo@computer.org>
* fhandler_console.cc (read) <mouse position detection>:
Considering offset within scrolling region of the DOS box window.
See http://sourceware.org/bugzilla/show_bug.cgi?id=512
-------------- next part --------------
--- cygwin-1.5.12-1/winsup/cygwin/fhandler_console.cc 2004-10-28 17:33:04.000000000 +0200
+++ cygwin-1.5.12-1/winsup/cygwin/fhandler_console.cc.fix512 2004-11-30 12:42:40.172503500 +0100
@@ -422,10 +422,25 @@ fhandler_console::read (void *pv, size_t
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");
More information about the Cygwin-patches
mailing list