terminology: fix mouse button release handling

Need to send 3 to indicate Release instead of the button number.

SVN revision: 78472
This commit is contained in:
Boris Faure 2012-10-25 20:27:11 +00:00
parent f5184b4364
commit d9e70cefbc
1 changed files with 5 additions and 11 deletions

View File

@ -1262,7 +1262,6 @@ _rep_mouse_down(Termio *sd, Evas_Event_Mouse_Down *ev, int cx, int cy)
case MOUSE_EXT_NONE: case MOUSE_EXT_NONE:
if ((cx < (0xff - ' ')) && (cy < (0xff - ' '))) if ((cx < (0xff - ' ')) && (cy < (0xff - ' ')))
{ {
if (sd->pty->mouse_mode == MOUSE_X10) if (sd->pty->mouse_mode == MOUSE_X10)
{ {
if (btn <= 2) if (btn <= 2)
@ -1366,7 +1365,7 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
{ {
char buf[64]; char buf[64];
Eina_Bool ret = EINA_FALSE; Eina_Bool ret = EINA_FALSE;
int btn, shift, meta, ctrl; int shift, meta, ctrl;
if ((sd->pty->mouse_mode == MOUSE_OFF) || if ((sd->pty->mouse_mode == MOUSE_OFF) ||
(sd->pty->mouse_mode == MOUSE_X10)) (sd->pty->mouse_mode == MOUSE_X10))
@ -1374,7 +1373,6 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
if (sd->mouse.button == ev->button) if (sd->mouse.button == ev->button)
sd->mouse.button = 0; sd->mouse.button = 0;
btn = ev->button - 1;
shift = evas_key_modifier_is_set(ev->modifiers, "Shift") ? 4 : 0; shift = evas_key_modifier_is_set(ev->modifiers, "Shift") ? 4 : 0;
meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0; meta = evas_key_modifier_is_set(ev->modifiers, "Alt") ? 8 : 0;
ctrl = evas_key_modifier_is_set(ev->modifiers, "Control") ? 16 : 0; ctrl = evas_key_modifier_is_set(ev->modifiers, "Control") ? 16 : 0;
@ -1384,11 +1382,10 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
case MOUSE_EXT_NONE: case MOUSE_EXT_NONE:
if ((cx < (0xff - ' ')) && (cy < (0xff - ' '))) if ((cx < (0xff - ' ')) && (cy < (0xff - ' ')))
{ {
if (btn > 2) btn = 0;
buf[0] = 0x1b; buf[0] = 0x1b;
buf[1] = '['; buf[1] = '[';
buf[2] = 'M'; buf[2] = 'M';
buf[3] = (btn | shift | meta | ctrl) + ' '; buf[3] = (3 | shift | meta | ctrl) + ' ';
buf[4] = cx + 1 + ' '; buf[4] = cx + 1 + ' ';
buf[5] = cy + 1 + ' '; buf[5] = cy + 1 + ' ';
buf[6] = 0; buf[6] = 0;
@ -1400,11 +1397,10 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
{ {
int v, i; int v, i;
if (btn > 2) btn = 0;
buf[0] = 0x1b; buf[0] = 0x1b;
buf[1] = '['; buf[1] = '[';
buf[2] = 'M'; buf[2] = 'M';
buf[3] = (btn | shift | meta | ctrl) + ' '; buf[3] = (3 | shift | meta | ctrl) + ' ';
i = 4; i = 4;
v = cx + 1 + ' '; v = cx + 1 + ' ';
if (v <= 127) buf[i++] = v; if (v <= 127) buf[i++] = v;
@ -1428,16 +1424,15 @@ _rep_mouse_up(Termio *sd, Evas_Event_Mouse_Up *ev, int cx, int cy)
case MOUSE_EXT_SGR: // ESC.[.<.NUM.;.NUM.;.NUM.m case MOUSE_EXT_SGR: // ESC.[.<.NUM.;.NUM.;.NUM.m
{ {
snprintf(buf, sizeof(buf), "%c[<%i;%i;%im", 0x1b, snprintf(buf, sizeof(buf), "%c[<%i;%i;%im", 0x1b,
(btn | shift | meta | ctrl), cx + 1, cy + 1); (3 | shift | meta | ctrl), cx + 1, cy + 1);
termpty_write(sd->pty, buf, strlen(buf)); termpty_write(sd->pty, buf, strlen(buf));
ret = EINA_TRUE; ret = EINA_TRUE;
} }
break; break;
case MOUSE_EXT_URXVT: // ESC.[.NUM.;.NUM.;.NUM.M case MOUSE_EXT_URXVT: // ESC.[.NUM.;.NUM.;.NUM.M
{ {
if (btn > 2) btn = 0;
snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b, snprintf(buf, sizeof(buf), "%c[%i;%i;%iM", 0x1b,
(btn | shift | meta | ctrl) + ' ', (3 | shift | meta | ctrl) + ' ',
cx + 1 + ' ', cy + 1 + ' '); cx + 1 + ' ', cy + 1 + ' ');
termpty_write(sd->pty, buf, strlen(buf)); termpty_write(sd->pty, buf, strlen(buf));
ret = EINA_TRUE; ret = EINA_TRUE;
@ -1476,7 +1471,6 @@ _rep_mouse_move(Termio *sd, Evas_Event_Mouse_Move *ev, int cx __UNUSED__, int cy
case MOUSE_EXT_NONE: case MOUSE_EXT_NONE:
if ((cx < (0xff - ' ')) && (cy < (0xff - ' '))) if ((cx < (0xff - ' ')) && (cy < (0xff - ' ')))
{ {
if (btn > 2) btn = 0; if (btn > 2) btn = 0;
buf[0] = 0x1b; buf[0] = 0x1b;
buf[1] = '['; buf[1] = '[';