Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2012-04-25 11:25:00 +0400
committerCorinna Vinschen <corinna@vinschen.de>2012-04-25 11:25:00 +0400
commit8ee7527dc2c29a58d083c958e6db766db451a09a (patch)
tree0bde62762d9e4ae2914afc13fc111ba851b51216 /winsup
parentf1ce77295ddb6bcb71b17cf9383d78f86298adc0 (diff)
* fhandler.h (class dev_console): Add member ext_mouse_mode5.
* fhandler_console.cc (fhandler_console::read): Implement extended mouse mode 1005 (xterm, mintty). Fix actual mouse reporting for large coordinates.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog7
-rw-r--r--winsup/cygwin/fhandler.h1
-rw-r--r--winsup/cygwin/fhandler_console.cc39
3 files changed, 37 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 62e2e0780..1300321f5 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,10 @@
+2012-04-25 Thomas Wolff <towo@towo.net>
+
+ * fhandler.h (class dev_console): Add member ext_mouse_mode5.
+ * fhandler_console.cc (fhandler_console::read): Implement extended
+ mouse mode 1005 (xterm, mintty).
+ Fix actual mouse reporting for large coordinates.
+
2012-04-24 Corinna Vinschen <corinna@vinschen.de>
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 15.
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
index 9868a190a..fcb460e9e 100644
--- a/winsup/cygwin/fhandler.h
+++ b/winsup/cygwin/fhandler.h
@@ -1288,6 +1288,7 @@ class dev_console
bool insert_mode;
int use_mouse;
+ bool ext_mouse_mode5;
bool ext_mouse_mode6;
bool ext_mouse_mode15;
bool use_focus;
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
index 9a074f056..e54f11f2a 100644
--- a/winsup/cygwin/fhandler_console.cc
+++ b/winsup/cygwin/fhandler_console.cc
@@ -307,14 +307,6 @@ fhandler_console::mouse_aware (MOUSE_EVENT_RECORD& mouse_event)
return 0;
}
- /* Check whether adjusted mouse position can be reported */
- if (dev_state.dwMousePosition.X > 0xFF - ' ' - 1
- || dev_state.dwMousePosition.Y > 0xFF - ' ' - 1)
- {
- /* Mouse position out of reporting range */
- return 0;
- }
-
return ((mouse_event.dwEventFlags == 0 || mouse_event.dwEventFlags == DOUBLE_CLICK)
&& mouse_event.dwButtonState != dev_state.dwLastButtonState)
|| mouse_event.dwEventFlags == MOUSE_WHEELED
@@ -646,7 +638,34 @@ fhandler_console::read (void *pv, size_t& buflen)
dev_state.dwMousePosition.Y + 1);
nread = strlen (tmp);
}
- /* else if (dev_state.ext_mouse_mode5) not implemented */
+ else if (dev_state.ext_mouse_mode5)
+ {
+ unsigned int xcode = dev_state.dwMousePosition.X + ' ' + 1;
+ unsigned int ycode = dev_state.dwMousePosition.Y + ' ' + 1;
+
+ __small_sprintf (tmp, "\033[M%c", b + ' ');
+ nread = 4;
+ /* the neat nested encoding function of mintty
+ does not compile in g++, so let's unfold it: */
+ if (xcode < 0x80)
+ tmp [nread++] = xcode;
+ else if (xcode < 0x800)
+ {
+ tmp [nread++] = 0xC0 + (xcode >> 6);
+ tmp [nread++] = 0x80 + (xcode & 0x3F);
+ }
+ else
+ tmp [nread++] = 0;
+ if (ycode < 0x80)
+ tmp [nread++] = ycode;
+ else if (ycode < 0x800)
+ {
+ tmp [nread++] = 0xC0 + (ycode >> 6);
+ tmp [nread++] = 0x80 + (ycode & 0x3F);
+ }
+ else
+ tmp [nread++] = 0;
+ }
else
{
unsigned int xcode = dev_state.dwMousePosition.X + ' ' + 1;
@@ -1566,7 +1585,7 @@ fhandler_console::char_command (char c)
break;
case 1005: /* Extended mouse mode */
- syscall_printf ("ignored h/l command for extended mouse mode");
+ dev_state.ext_mouse_mode5 = c == 'h';
break;
case 1006: /* SGR extended mouse mode */