Support more mouse buttons when the terminal sends them, GitHub issue

3055.
This commit is contained in:
nicm 2022-02-16 18:55:05 +00:00 committed by Nicholas Marriott
parent 7f40c5b647
commit 6a0a783c26
7 changed files with 728 additions and 44 deletions

View File

@ -577,13 +577,13 @@ input_key_get_mouse(struct screen *s, struct mouse_event *m, u_int x, u_int y,
*/
if (m->sgr_type != ' ') {
if (MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3 &&
MOUSE_RELEASE(m->sgr_b) &&
(~s->mode & MODE_MOUSE_ALL))
return (0);
} else {
if (MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3 &&
MOUSE_RELEASE(m->b) &&
MOUSE_RELEASE(m->lb) &&
(~s->mode & MODE_MOUSE_ALL))
return (0);
}

View File

@ -91,26 +91,68 @@ static const struct {
KEYC_MOUSE_STRING(MOUSEDOWN1, MouseDown1),
KEYC_MOUSE_STRING(MOUSEDOWN2, MouseDown2),
KEYC_MOUSE_STRING(MOUSEDOWN3, MouseDown3),
KEYC_MOUSE_STRING(MOUSEDOWN6, MouseDown6),
KEYC_MOUSE_STRING(MOUSEDOWN7, MouseDown7),
KEYC_MOUSE_STRING(MOUSEDOWN8, MouseDown8),
KEYC_MOUSE_STRING(MOUSEDOWN9, MouseDown9),
KEYC_MOUSE_STRING(MOUSEDOWN10, MouseDown10),
KEYC_MOUSE_STRING(MOUSEDOWN11, MouseDown11),
KEYC_MOUSE_STRING(MOUSEUP1, MouseUp1),
KEYC_MOUSE_STRING(MOUSEUP2, MouseUp2),
KEYC_MOUSE_STRING(MOUSEUP3, MouseUp3),
KEYC_MOUSE_STRING(MOUSEUP6, MouseUp6),
KEYC_MOUSE_STRING(MOUSEUP7, MouseUp7),
KEYC_MOUSE_STRING(MOUSEUP8, MouseUp8),
KEYC_MOUSE_STRING(MOUSEUP9, MouseUp9),
KEYC_MOUSE_STRING(MOUSEUP10, MouseUp10),
KEYC_MOUSE_STRING(MOUSEUP11, MouseUp11),
KEYC_MOUSE_STRING(MOUSEDRAG1, MouseDrag1),
KEYC_MOUSE_STRING(MOUSEDRAG2, MouseDrag2),
KEYC_MOUSE_STRING(MOUSEDRAG3, MouseDrag3),
KEYC_MOUSE_STRING(MOUSEDRAG6, MouseDrag6),
KEYC_MOUSE_STRING(MOUSEDRAG7, MouseDrag7),
KEYC_MOUSE_STRING(MOUSEDRAG8, MouseDrag8),
KEYC_MOUSE_STRING(MOUSEDRAG9, MouseDrag9),
KEYC_MOUSE_STRING(MOUSEDRAG10, MouseDrag10),
KEYC_MOUSE_STRING(MOUSEDRAG11, MouseDrag11),
KEYC_MOUSE_STRING(MOUSEDRAGEND1, MouseDragEnd1),
KEYC_MOUSE_STRING(MOUSEDRAGEND2, MouseDragEnd2),
KEYC_MOUSE_STRING(MOUSEDRAGEND3, MouseDragEnd3),
KEYC_MOUSE_STRING(MOUSEDRAGEND6, MouseDragEnd6),
KEYC_MOUSE_STRING(MOUSEDRAGEND7, MouseDragEnd7),
KEYC_MOUSE_STRING(MOUSEDRAGEND8, MouseDragEnd8),
KEYC_MOUSE_STRING(MOUSEDRAGEND9, MouseDragEnd9),
KEYC_MOUSE_STRING(MOUSEDRAGEND10, MouseDragEnd10),
KEYC_MOUSE_STRING(MOUSEDRAGEND11, MouseDragEnd11),
KEYC_MOUSE_STRING(WHEELUP, WheelUp),
KEYC_MOUSE_STRING(WHEELDOWN, WheelDown),
KEYC_MOUSE_STRING(SECONDCLICK1, SecondClick1),
KEYC_MOUSE_STRING(SECONDCLICK2, SecondClick2),
KEYC_MOUSE_STRING(SECONDCLICK3, SecondClick3),
KEYC_MOUSE_STRING(SECONDCLICK6, SecondClick6),
KEYC_MOUSE_STRING(SECONDCLICK7, SecondClick7),
KEYC_MOUSE_STRING(SECONDCLICK8, SecondClick8),
KEYC_MOUSE_STRING(SECONDCLICK9, SecondClick9),
KEYC_MOUSE_STRING(SECONDCLICK10, SecondClick10),
KEYC_MOUSE_STRING(SECONDCLICK11, SecondClick11),
KEYC_MOUSE_STRING(DOUBLECLICK1, DoubleClick1),
KEYC_MOUSE_STRING(DOUBLECLICK2, DoubleClick2),
KEYC_MOUSE_STRING(DOUBLECLICK3, DoubleClick3),
KEYC_MOUSE_STRING(DOUBLECLICK6, DoubleClick6),
KEYC_MOUSE_STRING(DOUBLECLICK7, DoubleClick7),
KEYC_MOUSE_STRING(DOUBLECLICK8, DoubleClick8),
KEYC_MOUSE_STRING(DOUBLECLICK9, DoubleClick9),
KEYC_MOUSE_STRING(DOUBLECLICK10, DoubleClick10),
KEYC_MOUSE_STRING(DOUBLECLICK11, DoubleClick11),
KEYC_MOUSE_STRING(TRIPLECLICK1, TripleClick1),
KEYC_MOUSE_STRING(TRIPLECLICK2, TripleClick2),
KEYC_MOUSE_STRING(TRIPLECLICK3, TripleClick3),
KEYC_MOUSE_STRING(TRIPLECLICK6, TripleClick6),
KEYC_MOUSE_STRING(TRIPLECLICK7, TripleClick7),
KEYC_MOUSE_STRING(TRIPLECLICK8, TripleClick8),
KEYC_MOUSE_STRING(TRIPLECLICK9, TripleClick9),
KEYC_MOUSE_STRING(TRIPLECLICK10, TripleClick10),
KEYC_MOUSE_STRING(TRIPLECLICK11, TripleClick11)
};
/* Find key string in table. */

6
menu.c
View File

@ -235,7 +235,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
if (KEYC_IS_MOUSE(event->key)) {
if (md->flags & MENU_NOMOUSE) {
if (MOUSE_BUTTONS(m->b) != 0)
if (MOUSE_BUTTONS(m->b) != MOUSE_BUTTON_1)
return (1);
return (0);
}
@ -248,7 +248,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
return (1);
} else {
if (!MOUSE_RELEASE(m->b) &&
MOUSE_WHEEL(m->b) == 0 &&
!MOUSE_WHEEL(m->b) &&
!MOUSE_DRAG(m->b))
return (1);
}
@ -262,7 +262,7 @@ menu_key_cb(struct client *c, void *data, struct key_event *event)
if (MOUSE_RELEASE(m->b))
goto chosen;
} else {
if (MOUSE_WHEEL(m->b) == 0 && !MOUSE_DRAG(m->b))
if (!MOUSE_WHEEL(m->b) && !MOUSE_DRAG(m->b))
goto chosen;
}
md->choice = m->y - (md->py + 1);

View File

@ -508,7 +508,7 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
m->x > pd->px + pd->sx - 1 ||
m->y < pd->py ||
m->y > pd->py + pd->sy - 1) {
if (MOUSE_BUTTONS(m->b) == 2)
if (MOUSE_BUTTONS(m->b) == MOUSE_BUTTON_3)
goto menu;
return (0);
}
@ -523,16 +523,16 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
border = BOTTOM;
}
if ((m->b & MOUSE_MASK_MODIFIERS) == 0 &&
MOUSE_BUTTONS(m->b) == 2 &&
MOUSE_BUTTONS(m->b) == MOUSE_BUTTON_3 &&
(border == LEFT || border == TOP))
goto menu;
if (((m->b & MOUSE_MASK_MODIFIERS) == MOUSE_MASK_META) ||
border != NONE) {
if (!MOUSE_DRAG(m->b))
goto out;
if (MOUSE_BUTTONS(m->lb) == 0)
if (MOUSE_BUTTONS(m->lb) == MOUSE_BUTTON_1)
pd->dragging = MOVE;
else if (MOUSE_BUTTONS(m->lb) == 2)
else if (MOUSE_BUTTONS(m->lb) == MOUSE_BUTTON_3)
pd->dragging = SIZE;
pd->dx = m->lx - pd->px;
pd->dy = m->ly - pd->py;

View File

@ -593,11 +593,11 @@ server_client_check_mouse(struct client *c, struct key_event *event)
log_debug("double-click at %u,%u", x, y);
} else if ((m->sgr_type != ' ' &&
MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3) ||
MOUSE_RELEASE(m->sgr_b)) ||
(m->sgr_type == ' ' &&
MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3)) {
MOUSE_RELEASE(m->b) &&
MOUSE_RELEASE(m->lb))) {
type = MOVE;
x = m->x, y = m->y, b = 0;
log_debug("move at %u,%u", x, y);
@ -750,7 +750,7 @@ have_event:
m->wp = -1;
/* Stop dragging if needed. */
if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag) {
if (type != DRAG && type != WHEEL && c->tty.mouse_drag_flag != 0) {
if (c->tty.mouse_drag_release != NULL)
c->tty.mouse_drag_release(c, m);
@ -761,8 +761,8 @@ have_event:
* End a mouse drag by passing a MouseDragEnd key corresponding
* to the button that started the drag.
*/
switch (c->tty.mouse_drag_flag) {
case 1:
switch (c->tty.mouse_drag_flag - 1) {
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_MOUSEDRAGEND1_PANE;
if (where == STATUS)
@ -776,7 +776,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAGEND1_BORDER;
break;
case 2:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_MOUSEDRAGEND2_PANE;
if (where == STATUS)
@ -790,7 +790,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAGEND2_BORDER;
break;
case 3:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_MOUSEDRAGEND3_PANE;
if (where == STATUS)
@ -804,6 +804,90 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAGEND3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_MOUSEDRAGEND6_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_MOUSEDRAGEND7_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_MOUSEDRAGEND8_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_MOUSEDRAGEND9_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_MOUSEDRAGEND10_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_MOUSEDRAGEND11_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAGEND11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAGEND11_BORDER;
break;
default:
key = KEYC_MOUSE;
break;
@ -836,7 +920,7 @@ have_event:
key = KEYC_DRAGGING;
else {
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_MOUSEDRAG1_PANE;
if (where == STATUS)
@ -850,7 +934,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAG1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_MOUSEDRAG2_PANE;
if (where == STATUS)
@ -864,7 +948,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAG2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_MOUSEDRAG3_PANE;
if (where == STATUS)
@ -878,6 +962,90 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDRAG3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_MOUSEDRAG6_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_MOUSEDRAG7_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_MOUSEDRAG8_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_MOUSEDRAG9_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_MOUSEDRAG10_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_MOUSEDRAG11_PANE;
if (where == STATUS)
key = KEYC_MOUSEDRAG11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDRAG11_BORDER;
break;
}
}
@ -918,7 +1086,7 @@ have_event:
break;
case UP:
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_MOUSEUP1_PANE;
if (where == STATUS)
@ -932,7 +1100,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_MOUSEUP2_PANE;
if (where == STATUS)
@ -946,7 +1114,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEUP2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_MOUSEUP3_PANE;
if (where == STATUS)
@ -960,11 +1128,95 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEUP3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_MOUSEUP6_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_MOUSEUP7_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_MOUSEUP8_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_MOUSEUP9_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_MOUSEUP1_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_MOUSEUP11_PANE;
if (where == STATUS)
key = KEYC_MOUSEUP11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEUP11_BORDER;
break;
}
break;
case DOWN:
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_MOUSEDOWN1_PANE;
if (where == STATUS)
@ -978,7 +1230,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDOWN1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_MOUSEDOWN2_PANE;
if (where == STATUS)
@ -992,7 +1244,7 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDOWN2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_MOUSEDOWN3_PANE;
if (where == STATUS)
@ -1006,11 +1258,95 @@ have_event:
if (where == BORDER)
key = KEYC_MOUSEDOWN3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_MOUSEDOWN6_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_MOUSEDOWN7_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_MOUSEDOWN8_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_MOUSEDOWN9_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_MOUSEDOWN10_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_MOUSEDOWN11_PANE;
if (where == STATUS)
key = KEYC_MOUSEDOWN11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_MOUSEDOWN11_BORDER;
break;
}
break;
case SECOND:
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_SECONDCLICK1_PANE;
if (where == STATUS)
@ -1024,7 +1360,7 @@ have_event:
if (where == BORDER)
key = KEYC_SECONDCLICK1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_SECONDCLICK2_PANE;
if (where == STATUS)
@ -1038,7 +1374,7 @@ have_event:
if (where == BORDER)
key = KEYC_SECONDCLICK2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_SECONDCLICK3_PANE;
if (where == STATUS)
@ -1052,11 +1388,95 @@ have_event:
if (where == BORDER)
key = KEYC_SECONDCLICK3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_SECONDCLICK6_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_SECONDCLICK7_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_SECONDCLICK8_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_SECONDCLICK9_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_SECONDCLICK10_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_SECONDCLICK11_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK11_BORDER;
break;
}
break;
case DOUBLE:
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_DOUBLECLICK1_PANE;
if (where == STATUS)
@ -1070,7 +1490,7 @@ have_event:
if (where == BORDER)
key = KEYC_DOUBLECLICK1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_DOUBLECLICK2_PANE;
if (where == STATUS)
@ -1084,7 +1504,7 @@ have_event:
if (where == BORDER)
key = KEYC_DOUBLECLICK2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_DOUBLECLICK3_PANE;
if (where == STATUS)
@ -1098,11 +1518,95 @@ have_event:
if (where == BORDER)
key = KEYC_DOUBLECLICK3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_DOUBLECLICK6_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_DOUBLECLICK7_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_DOUBLECLICK8_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_DOUBLECLICK9_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_DOUBLECLICK10_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_DOUBLECLICK11_PANE;
if (where == STATUS)
key = KEYC_DOUBLECLICK11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_DOUBLECLICK11_BORDER;
break;
}
break;
case TRIPLE:
switch (MOUSE_BUTTONS(b)) {
case 0:
case MOUSE_BUTTON_1:
if (where == PANE)
key = KEYC_TRIPLECLICK1_PANE;
if (where == STATUS)
@ -1116,7 +1620,7 @@ have_event:
if (where == BORDER)
key = KEYC_TRIPLECLICK1_BORDER;
break;
case 1:
case MOUSE_BUTTON_2:
if (where == PANE)
key = KEYC_TRIPLECLICK2_PANE;
if (where == STATUS)
@ -1130,7 +1634,7 @@ have_event:
if (where == BORDER)
key = KEYC_TRIPLECLICK2_BORDER;
break;
case 2:
case MOUSE_BUTTON_3:
if (where == PANE)
key = KEYC_TRIPLECLICK3_PANE;
if (where == STATUS)
@ -1144,6 +1648,90 @@ have_event:
if (where == BORDER)
key = KEYC_TRIPLECLICK3_BORDER;
break;
case MOUSE_BUTTON_6:
if (where == PANE)
key = KEYC_TRIPLECLICK6_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK6_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK6_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK6_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK6_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK6_BORDER;
break;
case MOUSE_BUTTON_7:
if (where == PANE)
key = KEYC_TRIPLECLICK7_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK7_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK7_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK7_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK7_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK7_BORDER;
break;
case MOUSE_BUTTON_8:
if (where == PANE)
key = KEYC_TRIPLECLICK8_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK8_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK8_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK8_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK8_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK8_BORDER;
break;
case MOUSE_BUTTON_9:
if (where == PANE)
key = KEYC_TRIPLECLICK9_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK9_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK9_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK9_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK9_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK9_BORDER;
break;
case MOUSE_BUTTON_10:
if (where == PANE)
key = KEYC_TRIPLECLICK10_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK10_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK10_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK10_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK10_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK10_BORDER;
break;
case MOUSE_BUTTON_11:
if (where == PANE)
key = KEYC_TRIPLECLICK11_PANE;
if (where == STATUS)
key = KEYC_TRIPLECLICK11_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK11_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK11_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK11_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_TRIPLECLICK11_BORDER;
break;
}
break;
}

66
tmux.h
View File

@ -202,26 +202,68 @@ enum {
KEYC_MOUSE_KEY(MOUSEDOWN1),
KEYC_MOUSE_KEY(MOUSEDOWN2),
KEYC_MOUSE_KEY(MOUSEDOWN3),
KEYC_MOUSE_KEY(MOUSEDOWN6),
KEYC_MOUSE_KEY(MOUSEDOWN7),
KEYC_MOUSE_KEY(MOUSEDOWN8),
KEYC_MOUSE_KEY(MOUSEDOWN9),
KEYC_MOUSE_KEY(MOUSEDOWN10),
KEYC_MOUSE_KEY(MOUSEDOWN11),
KEYC_MOUSE_KEY(MOUSEUP1),
KEYC_MOUSE_KEY(MOUSEUP2),
KEYC_MOUSE_KEY(MOUSEUP3),
KEYC_MOUSE_KEY(MOUSEUP6),
KEYC_MOUSE_KEY(MOUSEUP7),
KEYC_MOUSE_KEY(MOUSEUP8),
KEYC_MOUSE_KEY(MOUSEUP9),
KEYC_MOUSE_KEY(MOUSEUP10),
KEYC_MOUSE_KEY(MOUSEUP11),
KEYC_MOUSE_KEY(MOUSEDRAG1),
KEYC_MOUSE_KEY(MOUSEDRAG2),
KEYC_MOUSE_KEY(MOUSEDRAG3),
KEYC_MOUSE_KEY(MOUSEDRAG6),
KEYC_MOUSE_KEY(MOUSEDRAG7),
KEYC_MOUSE_KEY(MOUSEDRAG8),
KEYC_MOUSE_KEY(MOUSEDRAG9),
KEYC_MOUSE_KEY(MOUSEDRAG10),
KEYC_MOUSE_KEY(MOUSEDRAG11),
KEYC_MOUSE_KEY(MOUSEDRAGEND1),
KEYC_MOUSE_KEY(MOUSEDRAGEND2),
KEYC_MOUSE_KEY(MOUSEDRAGEND3),
KEYC_MOUSE_KEY(MOUSEDRAGEND6),
KEYC_MOUSE_KEY(MOUSEDRAGEND7),
KEYC_MOUSE_KEY(MOUSEDRAGEND8),
KEYC_MOUSE_KEY(MOUSEDRAGEND9),
KEYC_MOUSE_KEY(MOUSEDRAGEND10),
KEYC_MOUSE_KEY(MOUSEDRAGEND11),
KEYC_MOUSE_KEY(WHEELUP),
KEYC_MOUSE_KEY(WHEELDOWN),
KEYC_MOUSE_KEY(SECONDCLICK1),
KEYC_MOUSE_KEY(SECONDCLICK2),
KEYC_MOUSE_KEY(SECONDCLICK3),
KEYC_MOUSE_KEY(SECONDCLICK6),
KEYC_MOUSE_KEY(SECONDCLICK7),
KEYC_MOUSE_KEY(SECONDCLICK8),
KEYC_MOUSE_KEY(SECONDCLICK9),
KEYC_MOUSE_KEY(SECONDCLICK10),
KEYC_MOUSE_KEY(SECONDCLICK11),
KEYC_MOUSE_KEY(DOUBLECLICK1),
KEYC_MOUSE_KEY(DOUBLECLICK2),
KEYC_MOUSE_KEY(DOUBLECLICK3),
KEYC_MOUSE_KEY(DOUBLECLICK6),
KEYC_MOUSE_KEY(DOUBLECLICK7),
KEYC_MOUSE_KEY(DOUBLECLICK8),
KEYC_MOUSE_KEY(DOUBLECLICK9),
KEYC_MOUSE_KEY(DOUBLECLICK10),
KEYC_MOUSE_KEY(DOUBLECLICK11),
KEYC_MOUSE_KEY(TRIPLECLICK1),
KEYC_MOUSE_KEY(TRIPLECLICK2),
KEYC_MOUSE_KEY(TRIPLECLICK3),
KEYC_MOUSE_KEY(TRIPLECLICK6),
KEYC_MOUSE_KEY(TRIPLECLICK7),
KEYC_MOUSE_KEY(TRIPLECLICK8),
KEYC_MOUSE_KEY(TRIPLECLICK9),
KEYC_MOUSE_KEY(TRIPLECLICK10),
KEYC_MOUSE_KEY(TRIPLECLICK11),
/* Backspace key. */
KEYC_BSPACE,
@ -1199,21 +1241,33 @@ struct session {
RB_HEAD(sessions, session);
/* Mouse button masks. */
#define MOUSE_MASK_BUTTONS 3
#define MOUSE_MASK_BUTTONS 195
#define MOUSE_MASK_SHIFT 4
#define MOUSE_MASK_META 8
#define MOUSE_MASK_CTRL 16
#define MOUSE_MASK_DRAG 32
#define MOUSE_MASK_WHEEL 64
#define MOUSE_MASK_MODIFIERS (MOUSE_MASK_SHIFT|MOUSE_MASK_META|MOUSE_MASK_CTRL)
/* Mouse wheel states. */
#define MOUSE_WHEEL_UP 0
#define MOUSE_WHEEL_DOWN 1
/* Mouse wheel type. */
#define MOUSE_WHEEL_UP 64
#define MOUSE_WHEEL_DOWN 65
/* Mouse button type. */
#define MOUSE_BUTTON_1 0
#define MOUSE_BUTTON_2 1
#define MOUSE_BUTTON_3 2
#define MOUSE_BUTTON_6 66
#define MOUSE_BUTTON_7 67
#define MOUSE_BUTTON_8 128
#define MOUSE_BUTTON_9 129
#define MOUSE_BUTTON_10 130
#define MOUSE_BUTTON_11 131
/* Mouse helpers. */
#define MOUSE_BUTTONS(b) ((b) & MOUSE_MASK_BUTTONS)
#define MOUSE_WHEEL(b) ((b) & MOUSE_MASK_WHEEL)
#define MOUSE_WHEEL(b) \
(((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_UP || \
((b) & MOUSE_MASK_BUTTONS) == MOUSE_WHEEL_DOWN)
#define MOUSE_DRAG(b) ((b) & MOUSE_MASK_DRAG)
#define MOUSE_RELEASE(b) (((b) & MOUSE_MASK_BUTTONS) == 3)

View File

@ -1118,7 +1118,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
/* Type is M for press, m for release. */
sgr_type = ch;
if (sgr_type == 'm')
b |= 3;
b = 3;
/*
* Some terminals (like PuTTY 0.63) mistakenly send
@ -1126,7 +1126,7 @@ tty_keys_mouse(struct tty *tty, const char *buf, size_t len, size_t *size,
* Discard it before it reaches any program running inside
* tmux.
*/
if (sgr_type == 'm' && (sgr_b & 64))
if (sgr_type == 'm' && MOUSE_WHEEL(sgr_b))
return (-2);
} else
return (-1);