Am 24.04.2012 22:22, schrieb Corinna Vinschen:
On Apr 24 22:00, Thomas Wolff wrote:
Am 24.04.2012 21:47, schrieb Corinna Vinschen:
On Apr 24 21:45, Corinna Vinschen wrote:
That was exactly the patch I applied.  I only chnaged the formatting
and changed sprintf to  __small_sprintf.
...and as far as quoting goes, the above is the ChangeLog you provided
with your updated patch.
Sh.. I see. My deep apologies, I must have been confused. Here is
the actual updated patch which should be used instead.
Sorry for the trouble.
Thomas
2012-04-20  Thomas Wolff<t...@towo.net>

        * fhandler.h (class dev_console): Flags for extended mouse modes.
        * fhandler_console.cc: Supporting mouse coordinates greater than 222.
        (fhandler_console::read) Implemented extended mouse modes
        1015 (urxvt, mintty, xterm), 1006 (xterm), and 1005 (xterm, mintty).
        Also: two { wrap formatting consistency fixes.
        (fhandler_console::mouse_aware) Removed limitation of not sending
        anything at exceeded coordinates; sending 0 byte instead (xterm).
        (fhandler_console::char_command) Initialization of enhanced
        mouse reporting modes.

Please recreate the patch against current CVS.  And please use
__small_sprintf instead of sprintf.

Here's the missing patch and changelog. Sorry again for previous mix-up.
Thomas
2012-04-24  Thomas Wolff  <t...@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.

diff -rup sav/fhandler.h ./fhandler.h
--- sav/fhandler.h      2012-04-24 16:29:37.000000000 +0200
+++ ./fhandler.h        2012-04-24 23:48:29.453125000 +0200
@@ -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 -rup sav/fhandler_console.cc ./fhandler_console.cc
--- sav/fhandler_console.cc     2012-04-24 16:39:22.000000000 +0200
+++ ./fhandler_console.cc       2012-04-24 23:52:00.265625000 +0200
@@ -307,14 +307,6 @@ fhandler_console::mouse_aware (MOUSE_EVE
       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
                                     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 */

Reply via email to