1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-04 07:08:50 +00:00

Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2019-03-25 20:02:38 +00:00
commit 6ac84585e6
3 changed files with 82 additions and 28 deletions

View File

@ -417,7 +417,7 @@ server_client_check_mouse(struct client *c)
struct timeval tv; struct timeval tv;
struct style_range *sr; struct style_range *sr;
enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type;
enum { NOWHERE, PANE, STATUS, STATUS_LEFT, STATUS_RIGHT, BORDER } where; enum { NOWHERE, PANE, STATUS, STATUS_LEFT, STATUS_RIGHT, STATUS_DEFAULT, BORDER } where;
type = NOTYPE; type = NOTYPE;
where = NOWHERE; where = NOWHERE;
@ -506,25 +506,27 @@ have_event:
y >= (u_int)m->statusat && y >= (u_int)m->statusat &&
y < m->statusat + status_line_size(c)) { y < m->statusat + status_line_size(c)) {
sr = status_get_range(c, x, y - m->statusat); sr = status_get_range(c, x, y - m->statusat);
if (sr == NULL) if (sr == NULL) {
return (KEYC_UNKNOWN); where = STATUS_DEFAULT;
switch (sr->type) { } else {
case STYLE_RANGE_NONE: switch (sr->type) {
return (KEYC_UNKNOWN); case STYLE_RANGE_NONE:
case STYLE_RANGE_LEFT:
where = STATUS_LEFT;
break;
case STYLE_RANGE_RIGHT:
where = STATUS_RIGHT;
break;
case STYLE_RANGE_WINDOW:
wl = winlink_find_by_index(&s->windows, sr->argument);
if (wl == NULL)
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
m->w = wl->window->id; case STYLE_RANGE_LEFT:
where = STATUS_LEFT;
break;
case STYLE_RANGE_RIGHT:
where = STATUS_RIGHT;
break;
case STYLE_RANGE_WINDOW:
wl = winlink_find_by_index(&s->windows, sr->argument);
if (wl == NULL)
return (KEYC_UNKNOWN);
m->w = wl->window->id;
where = STATUS; where = STATUS;
break; break;
}
} }
} }
@ -603,6 +605,8 @@ have_event:
key = KEYC_MOUSEDRAGEND1_STATUS_LEFT; key = KEYC_MOUSEDRAGEND1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT; key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND1_BORDER; key = KEYC_MOUSEDRAGEND1_BORDER;
break; break;
@ -615,6 +619,8 @@ have_event:
key = KEYC_MOUSEDRAGEND2_STATUS_LEFT; key = KEYC_MOUSEDRAGEND2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT; key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND2_BORDER; key = KEYC_MOUSEDRAGEND2_BORDER;
break; break;
@ -627,6 +633,8 @@ have_event:
key = KEYC_MOUSEDRAGEND3_STATUS_LEFT; key = KEYC_MOUSEDRAGEND3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT; key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAGEND3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND3_BORDER; key = KEYC_MOUSEDRAGEND3_BORDER;
break; break;
@ -649,6 +657,12 @@ have_event:
key = KEYC_MOUSEMOVE_PANE; key = KEYC_MOUSEMOVE_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEMOVE_STATUS; key = KEYC_MOUSEMOVE_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEMOVE_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEMOVE_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEMOVE_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEMOVE_BORDER; key = KEYC_MOUSEMOVE_BORDER;
break; break;
@ -666,6 +680,8 @@ have_event:
key = KEYC_MOUSEDRAG1_STATUS_LEFT; key = KEYC_MOUSEDRAG1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG1_STATUS_RIGHT; key = KEYC_MOUSEDRAG1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG1_BORDER; key = KEYC_MOUSEDRAG1_BORDER;
break; break;
@ -678,6 +694,8 @@ have_event:
key = KEYC_MOUSEDRAG2_STATUS_LEFT; key = KEYC_MOUSEDRAG2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG2_STATUS_RIGHT; key = KEYC_MOUSEDRAG2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG2_BORDER; key = KEYC_MOUSEDRAG2_BORDER;
break; break;
@ -690,6 +708,8 @@ have_event:
key = KEYC_MOUSEDRAG3_STATUS_LEFT; key = KEYC_MOUSEDRAG3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG3_STATUS_RIGHT; key = KEYC_MOUSEDRAG3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDRAG3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG3_BORDER; key = KEYC_MOUSEDRAG3_BORDER;
break; break;
@ -712,6 +732,8 @@ have_event:
key = KEYC_WHEELUP_STATUS_LEFT; key = KEYC_WHEELUP_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_WHEELUP_STATUS_RIGHT; key = KEYC_WHEELUP_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_WHEELUP_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_WHEELUP_BORDER; key = KEYC_WHEELUP_BORDER;
} else { } else {
@ -719,6 +741,12 @@ have_event:
key = KEYC_WHEELDOWN_PANE; key = KEYC_WHEELDOWN_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_WHEELDOWN_STATUS; key = KEYC_WHEELDOWN_STATUS;
if (where == STATUS_LEFT)
key = KEYC_WHEELDOWN_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_WHEELDOWN_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_WHEELDOWN_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_WHEELDOWN_BORDER; key = KEYC_WHEELDOWN_BORDER;
} }
@ -734,6 +762,8 @@ have_event:
key = KEYC_MOUSEUP1_STATUS_LEFT; key = KEYC_MOUSEUP1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP1_STATUS_RIGHT; key = KEYC_MOUSEUP1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER; key = KEYC_MOUSEUP1_BORDER;
break; break;
@ -746,6 +776,8 @@ have_event:
key = KEYC_MOUSEUP2_STATUS_LEFT; key = KEYC_MOUSEUP2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP2_STATUS_RIGHT; key = KEYC_MOUSEUP2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP2_BORDER; key = KEYC_MOUSEUP2_BORDER;
break; break;
@ -758,6 +790,8 @@ have_event:
key = KEYC_MOUSEUP3_STATUS_LEFT; key = KEYC_MOUSEUP3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP3_STATUS_RIGHT; key = KEYC_MOUSEUP3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEUP3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP3_BORDER; key = KEYC_MOUSEUP3_BORDER;
break; break;
@ -774,6 +808,8 @@ have_event:
key = KEYC_MOUSEDOWN1_STATUS_LEFT; key = KEYC_MOUSEDOWN1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN1_STATUS_RIGHT; key = KEYC_MOUSEDOWN1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN1_BORDER; key = KEYC_MOUSEDOWN1_BORDER;
break; break;
@ -786,6 +822,8 @@ have_event:
key = KEYC_MOUSEDOWN2_STATUS_LEFT; key = KEYC_MOUSEDOWN2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN2_STATUS_RIGHT; key = KEYC_MOUSEDOWN2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN2_BORDER; key = KEYC_MOUSEDOWN2_BORDER;
break; break;
@ -798,6 +836,8 @@ have_event:
key = KEYC_MOUSEDOWN3_STATUS_LEFT; key = KEYC_MOUSEDOWN3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN3_STATUS_RIGHT; key = KEYC_MOUSEDOWN3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_MOUSEDOWN3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN3_BORDER; key = KEYC_MOUSEDOWN3_BORDER;
break; break;
@ -814,6 +854,8 @@ have_event:
key = KEYC_DOUBLECLICK1_STATUS_LEFT; key = KEYC_DOUBLECLICK1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK1_STATUS_RIGHT; key = KEYC_DOUBLECLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK1_BORDER; key = KEYC_DOUBLECLICK1_BORDER;
break; break;
@ -826,6 +868,8 @@ have_event:
key = KEYC_DOUBLECLICK2_STATUS_LEFT; key = KEYC_DOUBLECLICK2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK2_STATUS_RIGHT; key = KEYC_DOUBLECLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK2_BORDER; key = KEYC_DOUBLECLICK2_BORDER;
break; break;
@ -838,6 +882,8 @@ have_event:
key = KEYC_DOUBLECLICK3_STATUS_LEFT; key = KEYC_DOUBLECLICK3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK3_STATUS_RIGHT; key = KEYC_DOUBLECLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_DOUBLECLICK3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK3_BORDER; key = KEYC_DOUBLECLICK3_BORDER;
break; break;
@ -854,6 +900,8 @@ have_event:
key = KEYC_TRIPLECLICK1_STATUS_LEFT; key = KEYC_TRIPLECLICK1_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK1_STATUS_RIGHT; key = KEYC_TRIPLECLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK1_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK1_BORDER; key = KEYC_TRIPLECLICK1_BORDER;
break; break;
@ -866,6 +914,8 @@ have_event:
key = KEYC_TRIPLECLICK2_STATUS_LEFT; key = KEYC_TRIPLECLICK2_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK2_STATUS_RIGHT; key = KEYC_TRIPLECLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK2_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK2_BORDER; key = KEYC_TRIPLECLICK2_BORDER;
break; break;
@ -878,6 +928,8 @@ have_event:
key = KEYC_TRIPLECLICK3_STATUS_LEFT; key = KEYC_TRIPLECLICK3_STATUS_LEFT;
if (where == STATUS_RIGHT) if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK3_STATUS_RIGHT; key = KEYC_TRIPLECLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_TRIPLECLICK3_STATUS_DEFAULT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK3_BORDER; key = KEYC_TRIPLECLICK3_BORDER;
break; break;

20
tmux.1
View File

@ -3597,16 +3597,16 @@ option is on (the default is off),
allows mouse events to be bound as keys. allows mouse events to be bound as keys.
The name of each key is made up of a mouse event (such as The name of each key is made up of a mouse event (such as
.Ql MouseUp1 ) .Ql MouseUp1 )
and a location suffix (one of and a location suffix, one of the following:
.Ql Pane .Bl -column "XXXXXXXXXXXXX" -offset indent
for the contents of a pane, .It Li "Pane" Ta "the contents of a pane"
.Ql Border .It Li "Border" Ta "a pane border"
for a pane border or .It Li "Status" Ta "the status line window list"
.Ql Status , .It Li "StatusLeft" Ta "the left part of the status line"
.Ql StatusLeft , .It Li "StatusRight" Ta "the right part of the status line"
or .It Li "StatusDefault" Ta "any other part of the status line"
.Ql StatusRight .El
for the status line). .Pp
The following mouse events are available: The following mouse events are available:
.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent .Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
.It Li "WheelUp" Ta "WheelDown" Ta "" .It Li "WheelUp" Ta "WheelDown" Ta ""

2
tmux.h
View File

@ -130,12 +130,14 @@ struct winlink;
KEYC_ ## name ## _STATUS, \ KEYC_ ## name ## _STATUS, \
KEYC_ ## name ## _STATUS_LEFT, \ KEYC_ ## name ## _STATUS_LEFT, \
KEYC_ ## name ## _STATUS_RIGHT, \ KEYC_ ## name ## _STATUS_RIGHT, \
KEYC_ ## name ## _STATUS_DEFAULT, \
KEYC_ ## name ## _BORDER KEYC_ ## name ## _BORDER
#define KEYC_MOUSE_STRING(name, s) \ #define KEYC_MOUSE_STRING(name, s) \
{ #s "Pane", KEYC_ ## name ## _PANE }, \ { #s "Pane", KEYC_ ## name ## _PANE }, \
{ #s "Status", KEYC_ ## name ## _STATUS }, \ { #s "Status", KEYC_ ## name ## _STATUS }, \
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \ { #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \ { #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
{ #s "Border", KEYC_ ## name ## _BORDER } { #s "Border", KEYC_ ## name ## _BORDER }
/* /*