* [PATCH] Extended mouse coordinates
@ 2012-04-22 19:08 Thomas Wolff
2012-04-24 14:44 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Wolff @ 2012-04-22 19:08 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 482 bytes --]
This patch replaces my previous proposal
(http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
modifications:
* Fixed a bug that suppressed mouse reporting at large coordinates (in
all modes actually:-\ )
* Added mouse mode 1005 (total of 3 three new modes, so all reporting
modes run by current terminal emulators would be implemented)
I would appreciate the patch to be applied this time, planned to be my
last mouse patch :)
Kind regards,
Thomas
[-- Attachment #2: mouse-modes-6-16.changelog --]
[-- Type: text/plain, Size: 498 bytes --]
2012-04-03 Thomas Wolff <towo@towo.net>
* fhandler.h (class dev_console): Two flags for extended mouse modes.
* fhandler_console.cc (fhandler_console::read): Implemented
extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
Not implemented extended mouse mode 1005 (xterm, mintty).
Supporting mouse coordinates greater than 222 (each axis).
Also: two { wrap formatting consistency fixes.
(fhandler_console::char_command) Initialization of enhanced
mouse reporting modes.
[-- Attachment #3: mouse-modes-6-16.patch --]
[-- Type: text/plain, Size: 4760 bytes --]
diff -rup sav/fhandler.h ./fhandler.h
--- sav/fhandler.h 2012-04-01 19:46:04.000000000 +0200
+++ ./fhandler.h 2012-04-03 15:52:07.893561600 +0200
@@ -1282,6 +1282,8 @@ class dev_console
bool insert_mode;
int use_mouse;
+ bool ext_mouse_mode6;
+ bool ext_mouse_mode15;
bool use_focus;
bool raw_win32_keyboard_mode;
diff -rup sav/fhandler_console.cc ./fhandler_console.cc
--- sav/fhandler_console.cc 2012-04-02 00:28:55.000000000 +0200
+++ ./fhandler_console.cc 2012-04-03 15:56:13.993152400 +0200
@@ -452,12 +452,13 @@ fhandler_console::read (void *pv, size_t
{
char c = dev_state.backspace_keycode;
nread = 0;
- if (control_key_state & ALT_PRESSED) {
- if (dev_state.metabit)
- c |= 0x80;
- else
- tmp[nread++] = '\e';
- }
+ if (control_key_state & ALT_PRESSED)
+ {
+ if (dev_state.metabit)
+ c |= 0x80;
+ else
+ tmp[nread++] = '\e';
+ }
tmp[nread++] = c;
tmp[nread] = 0;
toadd = tmp;
@@ -550,6 +551,7 @@ fhandler_console::read (void *pv, size_t
events at the same time. */
int b = 0;
char sz[32];
+ char mode6_term = 'M';
if (mouse_event.dwEventFlags == MOUSE_WHEELED)
{
@@ -573,7 +575,7 @@ fhandler_console::read (void *pv, size_t
{
b = dev_state.last_button_code;
}
- else if (mouse_event.dwButtonState < dev_state.dwLastButtonState)
+ else if (mouse_event.dwButtonState < dev_state.dwLastButtonState && !dev_state.ext_mouse_mode6)
{
b = 3;
strcpy (sz, "btn up");
@@ -594,6 +596,10 @@ fhandler_console::read (void *pv, size_t
strcpy (sz, "btn3 down");
}
+ if (dev_state.ext_mouse_mode6) /* distinguish release */
+ if (mouse_event.dwButtonState < dev_state.dwLastButtonState)
+ mode6_term = 'm';
+
dev_state.last_button_code = b;
if (mouse_event.dwEventFlags == MOUSE_MOVED)
@@ -625,25 +631,46 @@ fhandler_console::read (void *pv, size_t
b |= dev_state.nModifiers;
/* We can now create the code. */
- sprintf (tmp, "\033[M%c%c%c", b + ' ', dev_state.dwMousePosition.X + ' ' + 1, dev_state.dwMousePosition.Y + ' ' + 1);
+ if (dev_state.ext_mouse_mode6)
+ {
+ sprintf (tmp, "\033[<%d;%d;%d%c", b, dev_state.dwMousePosition.X + 1, dev_state.dwMousePosition.Y + 1, mode6_term);
+ nread = strlen (tmp);
+ }
+ else if (dev_state.ext_mouse_mode15)
+ {
+ sprintf (tmp, "\033[%d;%d;%dM", b + 32, dev_state.dwMousePosition.X + 1, dev_state.dwMousePosition.Y + 1);
+ nread = strlen (tmp);
+ }
+ /* else if (dev_state.ext_mouse_mode5) not implemented */
+ else
+ {
+ unsigned int xcode = dev_state.dwMousePosition.X + ' ' + 1;
+ unsigned int ycode = dev_state.dwMousePosition.Y + ' ' + 1;
+ if (xcode >= 256)
+ xcode = 0;
+ if (ycode >= 256)
+ ycode = 0;
+ sprintf (tmp, "\033[M%c%c%c", b + ' ', xcode, ycode);
+ nread = 6; /* tmp may contain NUL bytes */
+ }
syscall_printf ("mouse: %s at (%d,%d)", sz, dev_state.dwMousePosition.X, dev_state.dwMousePosition.Y);
toadd = tmp;
- nread = 6;
}
}
break;
case FOCUS_EVENT:
- if (dev_state.use_focus) {
- if (input_rec.Event.FocusEvent.bSetFocus)
- sprintf (tmp, "\033[I");
- else
- sprintf (tmp, "\033[O");
+ if (dev_state.use_focus)
+ {
+ if (input_rec.Event.FocusEvent.bSetFocus)
+ sprintf (tmp, "\033[I");
+ else
+ sprintf (tmp, "\033[O");
- toadd = tmp;
- nread = 3;
- }
+ toadd = tmp;
+ nread = 3;
+ }
break;
case WINDOW_BUFFER_SIZE_EVENT:
@@ -1516,22 +1543,30 @@ fhandler_console::char_command (char c)
case 1000: /* Mouse tracking */
dev_state.use_mouse = (c == 'h') ? 1 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1002: /* Mouse button event tracking */
dev_state.use_mouse = (c == 'h') ? 2 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1003: /* Mouse any event tracking */
dev_state.use_mouse = (c == 'h') ? 3 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1004: /* Focus in/out event reporting */
dev_state.use_focus = (c == 'h') ? true : false;
- syscall_printf ("focus reporting set to %d", dev_state.use_focus);
+ break;
+
+ case 1005: /* Extended mouse mode */
+ syscall_printf ("ignored h/l command for extended mouse mode");
+ break;
+
+ case 1006: /* SGR extended mouse mode */
+ dev_state.ext_mouse_mode6 = c == 'h';
+ break;
+
+ case 1015: /* Urxvt extended mouse mode */
+ dev_state.ext_mouse_mode15 = c == 'h';
break;
case 2000: /* Raw keyboard mode */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-22 19:08 [PATCH] Extended mouse coordinates Thomas Wolff
@ 2012-04-24 14:44 ` Corinna Vinschen
2012-04-24 19:35 ` Thomas Wolff
0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2012-04-24 14:44 UTC (permalink / raw)
To: cygwin-patches
On Apr 22 21:07, Thomas Wolff wrote:
> This patch replaces my previous proposal
> (http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
> modifications:
>
> * Fixed a bug that suppressed mouse reporting at large coordinates (in
> all modes actually:-\ )
> * Added mouse mode 1005 (total of 3 three new modes, so all reporting
> modes run by current terminal emulators would be implemented)
>
> I would appreciate the patch to be applied this time, planned to be
> my last mouse patch :)
>
> Kind regards,
> Thomas
> 2012-04-03 Thomas Wolff <towo@towo.net>
>
> * fhandler.h (class dev_console): Two flags for extended mouse modes.
> * fhandler_console.cc (fhandler_console::read): Implemented
> extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
> Not implemented extended mouse mode 1005 (xterm, mintty).
> Supporting mouse coordinates greater than 222 (each axis).
> Also: two { wrap formatting consistency fixes.
> (fhandler_console::char_command) Initialization of enhanced
> mouse reporting modes.
>
Patch applied with changes. Please use __small_sprintf rather than
sprintf. I also changed the CHangeLog entry slightly. Keep it short
and in present tense.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 14:44 ` Corinna Vinschen
@ 2012-04-24 19:35 ` Thomas Wolff
2012-04-24 19:45 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Wolff @ 2012-04-24 19:35 UTC (permalink / raw)
To: cygwin-patches
Am 24.04.2012 16:44, schrieb Corinna Vinschen:
> On Apr 22 21:07, Thomas Wolff wrote:
>> This patch replaces my previous proposal
>> (http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
>> modifications:
>>
>> * Fixed a bug that suppressed mouse reporting at large coordinates (in
>> all modes actually:-\ )
>> * Added mouse mode 1005 (total of 3 three new modes, so all reporting
>> modes run by current terminal emulators would be implemented)
>>
>> I would appreciate the patch to be applied this time, planned to be
>> my last mouse patch :)
>>
>> Kind regards,
>> Thomas
>> 2012-04-03 Thomas Wolff<towo@towo.net>
>>
>> * fhandler.h (class dev_console): Two flags for extended mouse modes.
>> * fhandler_console.cc (fhandler_console::read): Implemented
>> extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
>> Not implemented extended mouse mode 1005 (xterm, mintty).
>> Supporting mouse coordinates greater than 222 (each axis).
>> Also: two { wrap formatting consistency fixes.
>> (fhandler_console::char_command) Initialization of enhanced
>> mouse reporting modes.
>>
> Patch applied with changes. Please use __small_sprintf rather than
> sprintf. I also changed the CHangeLog entry slightly. Keep it short
> and in present tense.
>
>
> Thanks,
> Corinna
>
Hmm, thanks but I'm afraid this went wrong. You quote (and probably
applied) my first patch which is missing mouse mode 1005 and
unfortunately also has a bug which effectively makes the extended
coordinates unusable (because the reports are suppressed in that case as
they were before :( ).
The mail you responded to contained an updated patch.
Thomas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 19:35 ` Thomas Wolff
@ 2012-04-24 19:45 ` Corinna Vinschen
2012-04-24 19:48 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2012-04-24 19:45 UTC (permalink / raw)
To: cygwin-patches
On Apr 24 21:35, Thomas Wolff wrote:
> Am 24.04.2012 16:44, schrieb Corinna Vinschen:
> >On Apr 22 21:07, Thomas Wolff wrote:
> >>This patch replaces my previous proposal
> >>(http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
> >>modifications:
> >>
> >> * Fixed a bug that suppressed mouse reporting at large coordinates (in
> >> all modes actually:-\ )
> >> * Added mouse mode 1005 (total of 3 three new modes, so all reporting
> >> modes run by current terminal emulators would be implemented)
> >>
> >>I would appreciate the patch to be applied this time, planned to be
> >>my last mouse patch :)
> >>
> >>Kind regards,
> >>Thomas
> >>2012-04-03 Thomas Wolff<towo@towo.net>
> >>
> >> * fhandler.h (class dev_console): Two flags for extended mouse modes.
> >> * fhandler_console.cc (fhandler_console::read): Implemented
> >> extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
> >> Not implemented extended mouse mode 1005 (xterm, mintty).
> >> Supporting mouse coordinates greater than 222 (each axis).
> >> Also: two { wrap formatting consistency fixes.
> >> (fhandler_console::char_command) Initialization of enhanced
> >> mouse reporting modes.
> >>
> >Patch applied with changes. Please use __small_sprintf rather than
> >sprintf. I also changed the CHangeLog entry slightly. Keep it short
> >and in present tense.
> >
> >
> >Thanks,
> >Corinna
> >
> Hmm, thanks but I'm afraid this went wrong. You quote (and probably
> applied) my first patch which is missing mouse mode 1005 and
> unfortunately also has a bug which effectively makes the extended
> coordinates unusable (because the reports are suppressed in that
> case as they were before :( ).
> The mail you responded to contained an updated patch.
That was exactly the patch I applied. I only chnaged the formatting
and changed sprintf to __small_sprintf.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 19:45 ` Corinna Vinschen
@ 2012-04-24 19:48 ` Corinna Vinschen
2012-04-24 20:00 ` Thomas Wolff
0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2012-04-24 19:48 UTC (permalink / raw)
To: cygwin-patches
On Apr 24 21:45, Corinna Vinschen wrote:
> On Apr 24 21:35, Thomas Wolff wrote:
> > Am 24.04.2012 16:44, schrieb Corinna Vinschen:
> > >On Apr 22 21:07, Thomas Wolff wrote:
> > >>This patch replaces my previous proposal
> > >>(http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
> > >>modifications:
> > >>
> > >> * Fixed a bug that suppressed mouse reporting at large coordinates (in
> > >> all modes actually:-\ )
> > >> * Added mouse mode 1005 (total of 3 three new modes, so all reporting
> > >> modes run by current terminal emulators would be implemented)
> > >>
> > >>I would appreciate the patch to be applied this time, planned to be
> > >>my last mouse patch :)
> > >>
> > >>Kind regards,
> > >>Thomas
> > >>2012-04-03 Thomas Wolff<towo@towo.net>
> > >>
> > >> * fhandler.h (class dev_console): Two flags for extended mouse modes.
> > >> * fhandler_console.cc (fhandler_console::read): Implemented
> > >> extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
> > >> Not implemented extended mouse mode 1005 (xterm, mintty).
> > >> Supporting mouse coordinates greater than 222 (each axis).
> > >> Also: two { wrap formatting consistency fixes.
> > >> (fhandler_console::char_command) Initialization of enhanced
> > >> mouse reporting modes.
> > >>
> > >Patch applied with changes. Please use __small_sprintf rather than
> > >sprintf. I also changed the CHangeLog entry slightly. Keep it short
> > >and in present tense.
> > >
> > >
> > >Thanks,
> > >Corinna
> > >
> > Hmm, thanks but I'm afraid this went wrong. You quote (and probably
> > applied) my first patch which is missing mouse mode 1005 and
> > unfortunately also has a bug which effectively makes the extended
> > coordinates unusable (because the reports are suppressed in that
> > case as they were before :( ).
> > The mail you responded to contained an updated patch.
>
> 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.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 19:48 ` Corinna Vinschen
@ 2012-04-24 20:00 ` Thomas Wolff
2012-04-24 20:23 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Wolff @ 2012-04-24 20:00 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 2294 bytes --]
Am 24.04.2012 21:47, schrieb Corinna Vinschen:
> On Apr 24 21:45, Corinna Vinschen wrote:
>> On Apr 24 21:35, Thomas Wolff wrote:
>>> Am 24.04.2012 16:44, schrieb Corinna Vinschen:
>>>> On Apr 22 21:07, Thomas Wolff wrote:
>>>>> This patch replaces my previous proposal
>>>>> (http://cygwin.com/ml/cygwin-patches/2012-q2/msg00005.html) with two
>>>>> modifications:
>>>>>
>>>>> * Fixed a bug that suppressed mouse reporting at large coordinates (in
>>>>> all modes actually:-\ )
>>>>> * Added mouse mode 1005 (total of 3 three new modes, so all reporting
>>>>> modes run by current terminal emulators would be implemented)
>>>>>
>>>>> I would appreciate the patch to be applied this time, planned to be
>>>>> my last mouse patch :)
>>>>>
>>>>> Kind regards,
>>>>> Thomas
>>>>> 2012-04-03 Thomas Wolff<towo@towo.net>
>>>>>
>>>>> * fhandler.h (class dev_console): Two flags for extended mouse modes.
>>>>> * fhandler_console.cc (fhandler_console::read): Implemented
>>>>> extended mouse modes 1015 (urxvt, mintty, xterm) and 1006 (xterm).
>>>>> Not implemented extended mouse mode 1005 (xterm, mintty).
>>>>> Supporting mouse coordinates greater than 222 (each axis).
>>>>> Also: two { wrap formatting consistency fixes.
>>>>> (fhandler_console::char_command) Initialization of enhanced
>>>>> mouse reporting modes.
>>>>>
>>>> Patch applied with changes. Please use __small_sprintf rather than
>>>> sprintf. I also changed the CHangeLog entry slightly. Keep it short
>>>> and in present tense.
>>>>
>>>>
>>>> Thanks,
>>>> Corinna
>>>>
>>> Hmm, thanks but I'm afraid this went wrong. You quote (and probably
>>> applied) my first patch which is missing mouse mode 1005 and
>>> unfortunately also has a bug which effectively makes the extended
>>> coordinates unusable (because the reports are suppressed in that
>>> case as they were before :( ).
>>> The mail you responded to contained an updated patch.
>> 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
[-- Attachment #2: mouse-modes-5-6-16.changelog --]
[-- Type: text/plain, Size: 581 bytes --]
2012-04-20 Thomas Wolff <towo@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.
[-- Attachment #3: mouse-modes-5-6-16.patch --]
[-- Type: text/plain, Size: 6072 bytes --]
diff -rup sav/fhandler.h ./fhandler.h
--- sav/fhandler.h 2012-04-18 07:58:04.000000000 +0200
+++ ./fhandler.h 2012-04-20 13:59:02.265328800 +0200
@@ -1288,6 +1288,9 @@ class dev_console
bool insert_mode;
int use_mouse;
+ bool ext_mouse_mode5;
+ bool ext_mouse_mode6;
+ bool ext_mouse_mode15;
bool use_focus;
bool raw_win32_keyboard_mode;
diff -rup sav/fhandler_console.cc ./fhandler_console.cc
--- sav/fhandler_console.cc 2012-04-15 19:51:49.000000000 +0200
+++ ./fhandler_console.cc 2012-04-20 13:59:02.296579200 +0200
@@ -304,14 +304,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
@@ -453,12 +445,13 @@ fhandler_console::read (void *pv, size_t
{
char c = dev_state.backspace_keycode;
nread = 0;
- if (control_key_state & ALT_PRESSED) {
- if (dev_state.metabit)
- c |= 0x80;
- else
- tmp[nread++] = '\e';
- }
+ if (control_key_state & ALT_PRESSED)
+ {
+ if (dev_state.metabit)
+ c |= 0x80;
+ else
+ tmp[nread++] = '\e';
+ }
tmp[nread++] = c;
tmp[nread] = 0;
toadd = tmp;
@@ -551,6 +544,7 @@ fhandler_console::read (void *pv, size_t
events at the same time. */
int b = 0;
char sz[32];
+ char mode6_term = 'M';
if (mouse_event.dwEventFlags == MOUSE_WHEELED)
{
@@ -574,7 +568,7 @@ fhandler_console::read (void *pv, size_t
{
b = dev_state.last_button_code;
}
- else if (mouse_event.dwButtonState < dev_state.dwLastButtonState)
+ else if (mouse_event.dwButtonState < dev_state.dwLastButtonState && !dev_state.ext_mouse_mode6)
{
b = 3;
strcpy (sz, "btn up");
@@ -595,6 +589,10 @@ fhandler_console::read (void *pv, size_t
strcpy (sz, "btn3 down");
}
+ if (dev_state.ext_mouse_mode6) /* distinguish release */
+ if (mouse_event.dwButtonState < dev_state.dwLastButtonState)
+ mode6_term = 'm';
+
dev_state.last_button_code = b;
if (mouse_event.dwEventFlags == MOUSE_MOVED)
@@ -626,25 +624,73 @@ fhandler_console::read (void *pv, size_t
b |= dev_state.nModifiers;
/* We can now create the code. */
- sprintf (tmp, "\033[M%c%c%c", b + ' ', dev_state.dwMousePosition.X + ' ' + 1, dev_state.dwMousePosition.Y + ' ' + 1);
+ if (dev_state.ext_mouse_mode6)
+ {
+ sprintf (tmp, "\033[<%d;%d;%d%c", b, dev_state.dwMousePosition.X + 1, dev_state.dwMousePosition.Y + 1, mode6_term);
+ nread = strlen (tmp);
+ }
+ else if (dev_state.ext_mouse_mode15)
+ {
+ sprintf (tmp, "\033[%d;%d;%dM", b + 32, dev_state.dwMousePosition.X + 1, dev_state.dwMousePosition.Y + 1);
+ nread = strlen (tmp);
+ }
+ else if (dev_state.ext_mouse_mode5)
+ {
+ unsigned int xcode = dev_state.dwMousePosition.X + ' ' + 1;
+ unsigned int ycode = dev_state.dwMousePosition.Y + ' ' + 1;
+
+ 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;
+ unsigned int ycode = dev_state.dwMousePosition.Y + ' ' + 1;
+ if (xcode >= 256)
+ xcode = 0;
+ if (ycode >= 256)
+ ycode = 0;
+ sprintf (tmp, "\033[M%c%c%c", b + ' ', xcode, ycode);
+ nread = 6; /* tmp may contain NUL bytes */
+ }
syscall_printf ("mouse: %s at (%d,%d)", sz, dev_state.dwMousePosition.X, dev_state.dwMousePosition.Y);
toadd = tmp;
- nread = 6;
}
}
break;
case FOCUS_EVENT:
- if (dev_state.use_focus) {
- if (input_rec.Event.FocusEvent.bSetFocus)
- sprintf (tmp, "\033[I");
- else
- sprintf (tmp, "\033[O");
+ if (dev_state.use_focus)
+ {
+ if (input_rec.Event.FocusEvent.bSetFocus)
+ sprintf (tmp, "\033[I");
+ else
+ sprintf (tmp, "\033[O");
- toadd = tmp;
- nread = 3;
- }
+ toadd = tmp;
+ nread = 3;
+ }
break;
case WINDOW_BUFFER_SIZE_EVENT:
@@ -1517,22 +1563,30 @@ fhandler_console::char_command (char c)
case 1000: /* Mouse tracking */
dev_state.use_mouse = (c == 'h') ? 1 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1002: /* Mouse button event tracking */
dev_state.use_mouse = (c == 'h') ? 2 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1003: /* Mouse any event tracking */
dev_state.use_mouse = (c == 'h') ? 3 : 0;
- syscall_printf ("mouse support set to mode %d", dev_state.use_mouse);
break;
case 1004: /* Focus in/out event reporting */
dev_state.use_focus = (c == 'h') ? true : false;
- syscall_printf ("focus reporting set to %d", dev_state.use_focus);
+ break;
+
+ case 1005: /* Extended mouse mode */
+ dev_state.ext_mouse_mode5 = c == 'h';
+ break;
+
+ case 1006: /* SGR extended mouse mode */
+ dev_state.ext_mouse_mode6 = c == 'h';
+ break;
+
+ case 1015: /* Urxvt extended mouse mode */
+ dev_state.ext_mouse_mode15 = c == 'h';
break;
case 2000: /* Raw keyboard mode */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 20:00 ` Thomas Wolff
@ 2012-04-24 20:23 ` Corinna Vinschen
2012-04-24 21:58 ` Thomas Wolff
0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2012-04-24 20:23 UTC (permalink / raw)
To: cygwin-patches
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 <towo@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.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 20:23 ` Corinna Vinschen
@ 2012-04-24 21:58 ` Thomas Wolff
2012-04-25 8:23 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Wolff @ 2012-04-24 21:58 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]
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<towo@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
[-- Attachment #2: mouse-mode-5.changelog --]
[-- Type: text/plain, Size: 260 bytes --]
2012-04-24 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.
[-- Attachment #3: mouse-mode-5.patch --]
[-- Type: text/plain, Size: 2451 bytes --]
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 */
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] Extended mouse coordinates
2012-04-24 21:58 ` Thomas Wolff
@ 2012-04-25 8:23 ` Corinna Vinschen
0 siblings, 0 replies; 9+ messages in thread
From: Corinna Vinschen @ 2012-04-25 8:23 UTC (permalink / raw)
To: cygwin-patches
On Apr 24 23:58, Thomas Wolff wrote:
> 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<towo@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
Patch applied and rigged into 1.7.14.
Thanks,
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-04-25 8:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-22 19:08 [PATCH] Extended mouse coordinates Thomas Wolff
2012-04-24 14:44 ` Corinna Vinschen
2012-04-24 19:35 ` Thomas Wolff
2012-04-24 19:45 ` Corinna Vinschen
2012-04-24 19:48 ` Corinna Vinschen
2012-04-24 20:00 ` Thomas Wolff
2012-04-24 20:23 ` Corinna Vinschen
2012-04-24 21:58 ` Thomas Wolff
2012-04-25 8:23 ` Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).