Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2018-08-22 23:02:43 +01:00
commit 5b93f0fcd3
5 changed files with 116 additions and 16 deletions

View File

@ -273,6 +273,10 @@ key_string_lookup_key(key_code key)
return ("MouseMovePane"); return ("MouseMovePane");
if (key == KEYC_MOUSEMOVE_STATUS) if (key == KEYC_MOUSEMOVE_STATUS)
return ("MouseMoveStatus"); return ("MouseMoveStatus");
if (key == KEYC_MOUSEMOVE_STATUS_LEFT)
return ("MouseMoveStatusLeft");
if (key == KEYC_MOUSEMOVE_STATUS_RIGHT)
return ("MouseMoveStatusRight");
if (key == KEYC_MOUSEMOVE_BORDER) if (key == KEYC_MOUSEMOVE_BORDER)
return ("MouseMoveBorder"); return ("MouseMoveBorder");
if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) { if (key >= KEYC_USER && key < KEYC_USER + KEYC_NUSER) {

View File

@ -415,7 +415,7 @@ server_client_check_mouse(struct client *c)
key_code key; key_code key;
struct timeval tv; struct timeval tv;
enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type;
enum { NOWHERE, PANE, STATUS, BORDER } where; enum { NOWHERE, PANE, STATUS, STATUS_LEFT, STATUS_RIGHT, BORDER } where;
type = NOTYPE; type = NOTYPE;
where = NOWHERE; where = NOWHERE;
@ -494,19 +494,25 @@ have_event:
if (type == NOTYPE) if (type == NOTYPE)
return (KEYC_UNKNOWN); return (KEYC_UNKNOWN);
/* Always save the session. */ /* Save the session. */
m->s = s->id; m->s = s->id;
m->w = -1;
/* Is this on the status line? */ /* Is this on the status line? */
m->statusat = status_at_line(c); m->statusat = status_at_line(c);
if (m->statusat != -1 && y == (u_int)m->statusat) { if (m->statusat != -1 && y == (u_int)m->statusat) {
w = status_get_window_at(c, x); if (x < c->status.left_size)
if (w == NULL) where = STATUS_LEFT;
return (KEYC_UNKNOWN); else if (x > c->tty.sx - c->status.right_size)
m->w = w->id; where = STATUS_RIGHT;
where = STATUS; else {
} else w = status_get_window_at(c, x);
m->w = -1; if (w == NULL)
return (KEYC_UNKNOWN);
m->w = w->id;
where = STATUS;
}
}
/* Not on status line. Adjust position and check for border or pane. */ /* Not on status line. Adjust position and check for border or pane. */
if (where == NOWHERE) { if (where == NOWHERE) {
@ -573,6 +579,10 @@ have_event:
key = KEYC_MOUSEDRAGEND1_PANE; key = KEYC_MOUSEDRAGEND1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAGEND1_STATUS; key = KEYC_MOUSEDRAGEND1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND1_BORDER; key = KEYC_MOUSEDRAGEND1_BORDER;
break; break;
@ -581,6 +591,10 @@ have_event:
key = KEYC_MOUSEDRAGEND2_PANE; key = KEYC_MOUSEDRAGEND2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAGEND2_STATUS; key = KEYC_MOUSEDRAGEND2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND2_BORDER; key = KEYC_MOUSEDRAGEND2_BORDER;
break; break;
@ -589,6 +603,10 @@ have_event:
key = KEYC_MOUSEDRAGEND3_PANE; key = KEYC_MOUSEDRAGEND3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAGEND3_STATUS; key = KEYC_MOUSEDRAGEND3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAGEND3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAGEND3_BORDER; key = KEYC_MOUSEDRAGEND3_BORDER;
break; break;
@ -624,6 +642,10 @@ have_event:
key = KEYC_MOUSEDRAG1_PANE; key = KEYC_MOUSEDRAG1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAG1_STATUS; key = KEYC_MOUSEDRAG1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG1_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG1_BORDER; key = KEYC_MOUSEDRAG1_BORDER;
break; break;
@ -632,6 +654,10 @@ have_event:
key = KEYC_MOUSEDRAG2_PANE; key = KEYC_MOUSEDRAG2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAG2_STATUS; key = KEYC_MOUSEDRAG2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG2_BORDER; key = KEYC_MOUSEDRAG2_BORDER;
break; break;
@ -640,6 +666,10 @@ have_event:
key = KEYC_MOUSEDRAG3_PANE; key = KEYC_MOUSEDRAG3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDRAG3_STATUS; key = KEYC_MOUSEDRAG3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDRAG3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDRAG3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDRAG3_BORDER; key = KEYC_MOUSEDRAG3_BORDER;
break; break;
@ -658,6 +688,10 @@ have_event:
key = KEYC_WHEELUP_PANE; key = KEYC_WHEELUP_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_WHEELUP_STATUS; key = KEYC_WHEELUP_STATUS;
if (where == STATUS_LEFT)
key = KEYC_WHEELUP_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_WHEELUP_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_WHEELUP_BORDER; key = KEYC_WHEELUP_BORDER;
} else { } else {
@ -676,6 +710,10 @@ have_event:
key = KEYC_MOUSEUP1_PANE; key = KEYC_MOUSEUP1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEUP1_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 == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP1_BORDER; key = KEYC_MOUSEUP1_BORDER;
break; break;
@ -684,6 +722,10 @@ have_event:
key = KEYC_MOUSEUP2_PANE; key = KEYC_MOUSEUP2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEUP2_STATUS; key = KEYC_MOUSEUP2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP2_BORDER; key = KEYC_MOUSEUP2_BORDER;
break; break;
@ -692,6 +734,10 @@ have_event:
key = KEYC_MOUSEUP3_PANE; key = KEYC_MOUSEUP3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEUP3_STATUS; key = KEYC_MOUSEUP3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEUP3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEUP3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEUP3_BORDER; key = KEYC_MOUSEUP3_BORDER;
break; break;
@ -704,6 +750,10 @@ have_event:
key = KEYC_MOUSEDOWN1_PANE; key = KEYC_MOUSEDOWN1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDOWN1_STATUS; key = KEYC_MOUSEDOWN1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN1_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN1_BORDER; key = KEYC_MOUSEDOWN1_BORDER;
break; break;
@ -712,6 +762,10 @@ have_event:
key = KEYC_MOUSEDOWN2_PANE; key = KEYC_MOUSEDOWN2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDOWN2_STATUS; key = KEYC_MOUSEDOWN2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN2_BORDER; key = KEYC_MOUSEDOWN2_BORDER;
break; break;
@ -720,6 +774,10 @@ have_event:
key = KEYC_MOUSEDOWN3_PANE; key = KEYC_MOUSEDOWN3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_MOUSEDOWN3_STATUS; key = KEYC_MOUSEDOWN3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_MOUSEDOWN3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_MOUSEDOWN3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_MOUSEDOWN3_BORDER; key = KEYC_MOUSEDOWN3_BORDER;
break; break;
@ -732,6 +790,10 @@ have_event:
key = KEYC_DOUBLECLICK1_PANE; key = KEYC_DOUBLECLICK1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_DOUBLECLICK1_STATUS; key = KEYC_DOUBLECLICK1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK1_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK1_BORDER; key = KEYC_DOUBLECLICK1_BORDER;
break; break;
@ -740,6 +802,10 @@ have_event:
key = KEYC_DOUBLECLICK2_PANE; key = KEYC_DOUBLECLICK2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_DOUBLECLICK2_STATUS; key = KEYC_DOUBLECLICK2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK2_BORDER; key = KEYC_DOUBLECLICK2_BORDER;
break; break;
@ -748,6 +814,10 @@ have_event:
key = KEYC_DOUBLECLICK3_PANE; key = KEYC_DOUBLECLICK3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_DOUBLECLICK3_STATUS; key = KEYC_DOUBLECLICK3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_DOUBLECLICK3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_DOUBLECLICK3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_DOUBLECLICK3_BORDER; key = KEYC_DOUBLECLICK3_BORDER;
break; break;
@ -760,6 +830,10 @@ have_event:
key = KEYC_TRIPLECLICK1_PANE; key = KEYC_TRIPLECLICK1_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_TRIPLECLICK1_STATUS; key = KEYC_TRIPLECLICK1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK1_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK1_BORDER; key = KEYC_TRIPLECLICK1_BORDER;
break; break;
@ -768,6 +842,10 @@ have_event:
key = KEYC_TRIPLECLICK2_PANE; key = KEYC_TRIPLECLICK2_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_TRIPLECLICK2_STATUS; key = KEYC_TRIPLECLICK2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK2_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK2_BORDER; key = KEYC_TRIPLECLICK2_BORDER;
break; break;
@ -776,6 +854,10 @@ have_event:
key = KEYC_TRIPLECLICK3_PANE; key = KEYC_TRIPLECLICK3_PANE;
if (where == STATUS) if (where == STATUS)
key = KEYC_TRIPLECLICK3_STATUS; key = KEYC_TRIPLECLICK3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_TRIPLECLICK3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_TRIPLECLICK3_STATUS_RIGHT;
if (where == BORDER) if (where == BORDER)
key = KEYC_TRIPLECLICK3_BORDER; key = KEYC_TRIPLECLICK3_BORDER;
break; break;

View File

@ -511,6 +511,10 @@ draw:
screen_write_fast_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1); screen_write_fast_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1);
screen_free(&window_list); screen_free(&window_list);
/* Save left and right size. */
c->status.left_size = llen;
c->status.right_size = rlen;
screen_write_stop(&ctx); screen_write_stop(&ctx);
out: out:

5
tmux.1
View File

@ -3608,7 +3608,10 @@ and a location suffix (one of
for the contents of a pane, for the contents of a pane,
.Ql Border .Ql Border
for a pane border or for a pane border or
.Ql Status .Ql Status ,
.Ql StatusLeft ,
or
.Ql StatusRight
for the status line). for the status line).
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

19
tmux.h
View File

@ -124,13 +124,17 @@ struct tmuxproc;
#define KEYC_CLICK_TIMEOUT 300 #define KEYC_CLICK_TIMEOUT 300
/* Mouse key codes. */ /* Mouse key codes. */
#define KEYC_MOUSE_KEY(name) \ #define KEYC_MOUSE_KEY(name) \
KEYC_ ## name ## _PANE, \ KEYC_ ## name ## _PANE, \
KEYC_ ## name ## _STATUS, \ KEYC_ ## name ## _STATUS, \
KEYC_ ## name ## _STATUS_LEFT, \
KEYC_ ## name ## _STATUS_RIGHT, \
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 "StatusRight", KEYC_ ## name ## _STATUS_RIGHT }, \
{ #s "Border", KEYC_ ## name ## _BORDER } { #s "Border", KEYC_ ## name ## _BORDER }
/* /*
@ -1309,6 +1313,9 @@ struct status_line {
struct screen *old_status; struct screen *old_status;
int window_list_offset; int window_list_offset;
u_int left_size;
u_int right_size;
}; };
/* Client connection. */ /* Client connection. */