Re: [dev] [st] [PATCH] Fix some bugs in mouse tracking logic

From: Michael Forney <mforney_AT_mforney.org>
Date: Fri, 13 Sep 2013 03:00:33 -0700

On Thu, 01 Aug 2013 10:10:23 +0200, "Roberto E. Vargas Caballero" <k0ga_AT_shike2.com> wrote:
> > This suggests that we should still add 32 to the button value when in
> > MODE_MOUSEX10.
>
> It is no clear for me if we have to add it or not, did you test it with
> other emulators?

Hi,

I apologize for the delay in getting back to you (I've been distracted
by other projects).

I'm fairly certain that we are supposed to always add 32 unless in SGR
mode. I've just now confirmed with the xterm (version 296) source code:

button.c:4254
> static unsigned
> EmitButtonCode(TScreen * screen,
> Char * line,
> unsigned count,
> XButtonEvent * event,
> int button)
> {
> int value;
>
> if (screen->send_mouse_pos == X10_MOUSE) {
> value = CharOf(' ' + button);
> } else {
> value = BtnCode(event, button);
> }
>
> switch (screen->extend_coords) {
> default:
> line[count++] = CharOf(value);
> break;
> case SET_SGR_EXT_MODE_MOUSE:
> value -= 32; /* encoding starts at zero */
> /* FALLTHRU */
> case SET_URXVT_EXT_MODE_MOUSE:
> count += (unsigned) sprintf((char *) line + count, "%d", value);
> break;
> case SET_EXT_MODE_MOUSE:
> if (value < 128) {
> line[count++] = CharOf(value);
> } else {
> line[count++] = CharOf(0xC0 + (value >> 6));
> line[count++] = CharOf(0x80 + (value & 0x3F));
> }
> break;
> }
> return count;
> }

As you can see, value begins as ' ' (== 32) + the button value (BtnCode
also adds 32), and then 32 is subtracted only when in SGR mode.

-- 
Michael Forney <mforney_AT_mforney.org>
Received on Fri Sep 13 2013 - 12:00:33 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 13 2013 - 12:12:07 CEST