Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2020-03-31 16:01:29 +01:00
commit 0bb1a50b88
5 changed files with 72 additions and 8 deletions

View File

@ -2492,6 +2492,7 @@ format_defaults_session(struct format_tree *ft, struct session *s)
ft->s = s; ft->s = s;
format_add(ft, "session_name", "%s", s->name); format_add(ft, "session_name", "%s", s->name);
format_add(ft, "session_path", "%s", s->cwd);
format_add(ft, "session_windows", "%u", winlink_count(&s->windows)); format_add(ft, "session_windows", "%u", winlink_count(&s->windows));
format_add(ft, "session_id", "$%u", s->id); format_add(ft, "session_id", "$%u", s->id);

View File

@ -100,6 +100,9 @@ static const struct {
KEYC_MOUSE_STRING(MOUSEDRAGEND3, MouseDragEnd3), KEYC_MOUSE_STRING(MOUSEDRAGEND3, MouseDragEnd3),
KEYC_MOUSE_STRING(WHEELUP, WheelUp), KEYC_MOUSE_STRING(WHEELUP, WheelUp),
KEYC_MOUSE_STRING(WHEELDOWN, WheelDown), KEYC_MOUSE_STRING(WHEELDOWN, WheelDown),
KEYC_MOUSE_STRING(SECONDCLICK1, SecondClick1),
KEYC_MOUSE_STRING(SECONDCLICK2, SecondClick2),
KEYC_MOUSE_STRING(SECONDCLICK3, SecondClick3),
KEYC_MOUSE_STRING(DOUBLECLICK1, DoubleClick1), KEYC_MOUSE_STRING(DOUBLECLICK1, DoubleClick1),
KEYC_MOUSE_STRING(DOUBLECLICK2, DoubleClick2), KEYC_MOUSE_STRING(DOUBLECLICK2, DoubleClick2),
KEYC_MOUSE_STRING(DOUBLECLICK3, DoubleClick3), KEYC_MOUSE_STRING(DOUBLECLICK3, DoubleClick3),

View File

@ -438,6 +438,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
UP, UP,
DRAG, DRAG,
WHEEL, WHEEL,
SECOND,
DOUBLE, DOUBLE,
TRIPLE } type = NOTYPE; TRIPLE } type = NOTYPE;
enum { NOWHERE, enum { NOWHERE,
@ -491,9 +492,10 @@ server_client_check_mouse(struct client *c, struct key_event *event)
evtimer_del(&c->click_timer); evtimer_del(&c->click_timer);
c->flags &= ~CLIENT_DOUBLECLICK; c->flags &= ~CLIENT_DOUBLECLICK;
if (m->b == c->click_button) { if (m->b == c->click_button) {
type = NOTYPE; type = SECOND;
x = m->x, y = m->y, b = m->b;
log_debug("second-click at %u,%u", x, y);
c->flags |= CLIENT_TRIPLECLICK; c->flags |= CLIENT_TRIPLECLICK;
goto add_timer;
} }
} else if (c->flags & CLIENT_TRIPLECLICK) { } else if (c->flags & CLIENT_TRIPLECLICK) {
evtimer_del(&c->click_timer); evtimer_del(&c->click_timer);
@ -505,13 +507,12 @@ server_client_check_mouse(struct client *c, struct key_event *event)
ignore = 1; ignore = 1;
goto have_event; goto have_event;
} }
} else } else {
c->flags |= CLIENT_DOUBLECLICK;
add_timer:
type = DOWN; type = DOWN;
x = m->x, y = m->y, b = m->b; x = m->x, y = m->y, b = m->b;
log_debug("down at %u,%u", x, y); log_debug("down at %u,%u", x, y);
c->flags |= CLIENT_DOUBLECLICK;
}
if (KEYC_CLICK_TIMEOUT != 0) { if (KEYC_CLICK_TIMEOUT != 0) {
memcpy(&c->click_event, m, sizeof c->click_event); memcpy(&c->click_event, m, sizeof c->click_event);
@ -875,6 +876,52 @@ have_event:
break; break;
} }
break; break;
case SECOND:
switch (MOUSE_BUTTONS(b)) {
case 0:
if (where == PANE)
key = KEYC_SECONDCLICK1_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK1_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK1_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK1_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK1_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK1_BORDER;
break;
case 1:
if (where == PANE)
key = KEYC_SECONDCLICK2_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK2_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK2_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK2_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK2_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK2_BORDER;
break;
case 2:
if (where == PANE)
key = KEYC_SECONDCLICK3_PANE;
if (where == STATUS)
key = KEYC_SECONDCLICK3_STATUS;
if (where == STATUS_LEFT)
key = KEYC_SECONDCLICK3_STATUS_LEFT;
if (where == STATUS_RIGHT)
key = KEYC_SECONDCLICK3_STATUS_RIGHT;
if (where == STATUS_DEFAULT)
key = KEYC_SECONDCLICK3_STATUS_DEFAULT;
if (where == BORDER)
key = KEYC_SECONDCLICK3_BORDER;
break;
}
break;
case DOUBLE: case DOUBLE:
switch (MOUSE_BUTTONS(b)) { switch (MOUSE_BUTTONS(b)) {
case 0: case 0:

10
tmux.1
View File

@ -3982,10 +3982,19 @@ The following mouse events are available:
.It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1" .It Li "MouseDown1" Ta "MouseUp1" Ta "MouseDrag1" Ta "MouseDragEnd1"
.It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2" .It Li "MouseDown2" Ta "MouseUp2" Ta "MouseDrag2" Ta "MouseDragEnd2"
.It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3" .It Li "MouseDown3" Ta "MouseUp3" Ta "MouseDrag3" Ta "MouseDragEnd3"
.It Li "SecondClick1" Ta "SecondClick2" Ta "SecondClick3"
.It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3" .It Li "DoubleClick1" Ta "DoubleClick2" Ta "DoubleClick3"
.It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3" .It Li "TripleClick1" Ta "TripleClick2" Ta "TripleClick3"
.El .El
.Pp .Pp
The
.Ql SecondClick
events are fired for the second click of a double click, even if there may be a
third click which will fire
.Ql TripleClick
instead of
.Ql DoubleClick .
.Pp
Each should be suffixed with a location, for example Each should be suffixed with a location, for example
.Ql MouseDown1Status . .Ql MouseDown1Status .
.Pp .Pp
@ -4414,6 +4423,7 @@ The following variables are available, where appropriate:
.It Li "session_last_attached" Ta "" Ta "Time session last attached" .It Li "session_last_attached" Ta "" Ta "Time session last attached"
.It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached" .It Li "session_many_attached" Ta "" Ta "1 if multiple clients attached"
.It Li "session_name" Ta "#S" Ta "Name of session" .It Li "session_name" Ta "#S" Ta "Name of session"
.It Li "session_path" Ta "" Ta "Working directory of session"
.It Li "session_stack" Ta "" Ta "Window indexes in most recent order" .It Li "session_stack" Ta "" Ta "Window indexes in most recent order"
.It Li "session_windows" Ta "" Ta "Number of windows in session" .It Li "session_windows" Ta "" Ta "Number of windows in session"
.It Li "socket_path" Ta "" Ta "Server socket path" .It Li "socket_path" Ta "" Ta "Server socket path"

3
tmux.h
View File

@ -184,6 +184,9 @@ enum {
KEYC_MOUSE_KEY(MOUSEDRAGEND3), KEYC_MOUSE_KEY(MOUSEDRAGEND3),
KEYC_MOUSE_KEY(WHEELUP), KEYC_MOUSE_KEY(WHEELUP),
KEYC_MOUSE_KEY(WHEELDOWN), KEYC_MOUSE_KEY(WHEELDOWN),
KEYC_MOUSE_KEY(SECONDCLICK1),
KEYC_MOUSE_KEY(SECONDCLICK2),
KEYC_MOUSE_KEY(SECONDCLICK3),
KEYC_MOUSE_KEY(DOUBLECLICK1), KEYC_MOUSE_KEY(DOUBLECLICK1),
KEYC_MOUSE_KEY(DOUBLECLICK2), KEYC_MOUSE_KEY(DOUBLECLICK2),
KEYC_MOUSE_KEY(DOUBLECLICK3), KEYC_MOUSE_KEY(DOUBLECLICK3),