mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
6ac84585e6
@ -417,7 +417,7 @@ server_client_check_mouse(struct client *c)
|
||||
struct timeval tv;
|
||||
struct style_range *sr;
|
||||
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;
|
||||
where = NOWHERE;
|
||||
@ -506,25 +506,27 @@ have_event:
|
||||
y >= (u_int)m->statusat &&
|
||||
y < m->statusat + status_line_size(c)) {
|
||||
sr = status_get_range(c, x, y - m->statusat);
|
||||
if (sr == NULL)
|
||||
return (KEYC_UNKNOWN);
|
||||
switch (sr->type) {
|
||||
case STYLE_RANGE_NONE:
|
||||
return (KEYC_UNKNOWN);
|
||||
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)
|
||||
if (sr == NULL) {
|
||||
where = STATUS_DEFAULT;
|
||||
} else {
|
||||
switch (sr->type) {
|
||||
case STYLE_RANGE_NONE:
|
||||
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;
|
||||
break;
|
||||
where = STATUS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -603,6 +605,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND1_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND1_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND1_BORDER;
|
||||
break;
|
||||
@ -615,6 +619,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND2_BORDER;
|
||||
break;
|
||||
@ -627,6 +633,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAGEND3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAGEND3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAGEND3_BORDER;
|
||||
break;
|
||||
@ -649,6 +657,12 @@ have_event:
|
||||
key = KEYC_MOUSEMOVE_PANE;
|
||||
if (where == 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)
|
||||
key = KEYC_MOUSEMOVE_BORDER;
|
||||
break;
|
||||
@ -666,6 +680,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG1_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAG1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG1_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG1_BORDER;
|
||||
break;
|
||||
@ -678,6 +694,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAG2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG2_BORDER;
|
||||
break;
|
||||
@ -690,6 +708,8 @@ have_event:
|
||||
key = KEYC_MOUSEDRAG3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDRAG3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDRAG3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDRAG3_BORDER;
|
||||
break;
|
||||
@ -712,6 +732,8 @@ have_event:
|
||||
key = KEYC_WHEELUP_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_WHEELUP_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_WHEELUP_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_WHEELUP_BORDER;
|
||||
} else {
|
||||
@ -719,6 +741,12 @@ have_event:
|
||||
key = KEYC_WHEELDOWN_PANE;
|
||||
if (where == 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)
|
||||
key = KEYC_WHEELDOWN_BORDER;
|
||||
}
|
||||
@ -734,6 +762,8 @@ have_event:
|
||||
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;
|
||||
@ -746,6 +776,8 @@ have_event:
|
||||
key = KEYC_MOUSEUP2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEUP2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP2_BORDER;
|
||||
break;
|
||||
@ -758,6 +790,8 @@ have_event:
|
||||
key = KEYC_MOUSEUP3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEUP3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEUP3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEUP3_BORDER;
|
||||
break;
|
||||
@ -774,6 +808,8 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN1_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDOWN1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN1_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN1_BORDER;
|
||||
break;
|
||||
@ -786,6 +822,8 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDOWN2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN2_BORDER;
|
||||
break;
|
||||
@ -798,6 +836,8 @@ have_event:
|
||||
key = KEYC_MOUSEDOWN3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_MOUSEDOWN3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_MOUSEDOWN3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_MOUSEDOWN3_BORDER;
|
||||
break;
|
||||
@ -814,6 +854,8 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK1_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_DOUBLECLICK1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK1_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK1_BORDER;
|
||||
break;
|
||||
@ -826,6 +868,8 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_DOUBLECLICK2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK2_BORDER;
|
||||
break;
|
||||
@ -838,6 +882,8 @@ have_event:
|
||||
key = KEYC_DOUBLECLICK3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_DOUBLECLICK3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_DOUBLECLICK3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_DOUBLECLICK3_BORDER;
|
||||
break;
|
||||
@ -854,6 +900,8 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK1_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_TRIPLECLICK1_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK1_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK1_BORDER;
|
||||
break;
|
||||
@ -866,6 +914,8 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK2_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_TRIPLECLICK2_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK2_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK2_BORDER;
|
||||
break;
|
||||
@ -878,6 +928,8 @@ have_event:
|
||||
key = KEYC_TRIPLECLICK3_STATUS_LEFT;
|
||||
if (where == STATUS_RIGHT)
|
||||
key = KEYC_TRIPLECLICK3_STATUS_RIGHT;
|
||||
if (where == STATUS_DEFAULT)
|
||||
key = KEYC_TRIPLECLICK3_STATUS_DEFAULT;
|
||||
if (where == BORDER)
|
||||
key = KEYC_TRIPLECLICK3_BORDER;
|
||||
break;
|
||||
|
20
tmux.1
20
tmux.1
@ -3597,16 +3597,16 @@ option is on (the default is off),
|
||||
allows mouse events to be bound as keys.
|
||||
The name of each key is made up of a mouse event (such as
|
||||
.Ql MouseUp1 )
|
||||
and a location suffix (one of
|
||||
.Ql Pane
|
||||
for the contents of a pane,
|
||||
.Ql Border
|
||||
for a pane border or
|
||||
.Ql Status ,
|
||||
.Ql StatusLeft ,
|
||||
or
|
||||
.Ql StatusRight
|
||||
for the status line).
|
||||
and a location suffix, one of the following:
|
||||
.Bl -column "XXXXXXXXXXXXX" -offset indent
|
||||
.It Li "Pane" Ta "the contents of a pane"
|
||||
.It Li "Border" Ta "a pane border"
|
||||
.It Li "Status" Ta "the status line window list"
|
||||
.It Li "StatusLeft" Ta "the left part of the status line"
|
||||
.It Li "StatusRight" Ta "the right part of the status line"
|
||||
.It Li "StatusDefault" Ta "any other part of the status line"
|
||||
.El
|
||||
.Pp
|
||||
The following mouse events are available:
|
||||
.Bl -column "MouseDown1" "MouseDrag1" "WheelDown" -offset indent
|
||||
.It Li "WheelUp" Ta "WheelDown" Ta ""
|
||||
|
2
tmux.h
2
tmux.h
@ -130,12 +130,14 @@ struct winlink;
|
||||
KEYC_ ## name ## _STATUS, \
|
||||
KEYC_ ## name ## _STATUS_LEFT, \
|
||||
KEYC_ ## name ## _STATUS_RIGHT, \
|
||||
KEYC_ ## name ## _STATUS_DEFAULT, \
|
||||
KEYC_ ## name ## _BORDER
|
||||
#define KEYC_MOUSE_STRING(name, s) \
|
||||
{ #s "Pane", KEYC_ ## name ## _PANE }, \
|
||||
{ #s "Status", KEYC_ ## name ## _STATUS }, \
|
||||
{ #s "StatusLeft", KEYC_ ## name ## _STATUS_LEFT }, \
|
||||
{ #s "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
|
||||
{ #s "StatusDefault", KEYC_ ## name ## _STATUS_DEFAULT }, \
|
||||
{ #s "Border", KEYC_ ## name ## _BORDER }
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user