Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2020-03-16 08:01:27 +00:00
commit f584fe1b00
3 changed files with 14 additions and 9 deletions

View File

@ -253,12 +253,12 @@ static void
input_key_mouse(struct window_pane *wp, struct mouse_event *m) input_key_mouse(struct window_pane *wp, struct mouse_event *m)
{ {
struct screen *s = wp->screen; struct screen *s = wp->screen;
int mode = s->mode;
char buf[40]; char buf[40];
size_t len; size_t len;
u_int x, y; u_int x, y;
if ((mode & ALL_MOUSE_MODES) == 0) /* Ignore events if no mouse mode or the pane is not visible. */
if (m->ignore || (s->mode & ALL_MOUSE_MODES) == 0)
return; return;
if (cmd_mouse_at(wp, m, &x, &y, 0) != 0) if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)
return; return;
@ -266,8 +266,7 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
return; return;
/* If this pane is not in button or all mode, discard motion events. */ /* If this pane is not in button or all mode, discard motion events. */
if (MOUSE_DRAG(m->b) && if (MOUSE_DRAG(m->b) && (s->mode & MOTION_MOUSE_MODES) == 0)
(mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0)
return; return;
/* /*
@ -279,13 +278,13 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
if (m->sgr_type != ' ') { if (m->sgr_type != ' ') {
if (MOUSE_DRAG(m->sgr_b) && if (MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3 && MOUSE_BUTTONS(m->sgr_b) == 3 &&
(~mode & MODE_MOUSE_ALL)) (~s->mode & MODE_MOUSE_ALL))
return; return;
} else { } else {
if (MOUSE_DRAG(m->b) && if (MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 && MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3 && MOUSE_BUTTONS(m->lb) == 3 &&
(~mode & MODE_MOUSE_ALL)) (~s->mode & MODE_MOUSE_ALL))
return; return;
} }

View File

@ -417,6 +417,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
struct winlink *wl; struct winlink *wl;
struct window_pane *wp; struct window_pane *wp;
u_int x, y, b, sx, sy, px, py; u_int x, y, b, sx, sy, px, py;
int ignore = 0;
key_code key; key_code key;
struct timeval tv; struct timeval tv;
struct style_range *sr; struct style_range *sr;
@ -443,6 +444,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
if (event->key == KEYC_DOUBLECLICK) { if (event->key == KEYC_DOUBLECLICK) {
type = DOUBLE; type = DOUBLE;
x = m->x, y = m->y, b = m->b; x = m->x, y = m->y, b = m->b;
ignore = 1;
log_debug("double-click at %u,%u", x, y); log_debug("double-click at %u,%u", x, y);
} else if ((m->sgr_type != ' ' && } else if ((m->sgr_type != ' ' &&
MOUSE_DRAG(m->sgr_b) && MOUSE_DRAG(m->sgr_b) &&
@ -489,16 +491,17 @@ server_client_check_mouse(struct client *c, struct key_event *event)
type = TRIPLE; type = TRIPLE;
x = m->x, y = m->y, b = m->b; x = m->x, y = m->y, b = m->b;
log_debug("triple-click at %u,%u", x, y); log_debug("triple-click at %u,%u", x, y);
ignore = 1;
goto have_event; goto have_event;
} }
} } else
type = DOWN;
x = m->x, y = m->y, b = m->b;
log_debug("down at %u,%u", x, y);
c->flags |= CLIENT_DOUBLECLICK; c->flags |= CLIENT_DOUBLECLICK;
add_timer: add_timer:
type = DOWN;
x = m->x, y = m->y, b = m->b;
log_debug("down at %u,%u", x, y);
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);
c->click_button = m->b; c->click_button = m->b;
@ -517,6 +520,7 @@ have_event:
/* Save the session. */ /* Save the session. */
m->s = s->id; m->s = s->id;
m->w = -1; m->w = -1;
m->ignore = ignore;
/* Is this on the status line? */ /* Is this on the status line? */
m->statusat = status_at_line(c); m->statusat = status_at_line(c);

2
tmux.h
View File

@ -563,6 +563,7 @@ struct msg_write_close {
#define ALL_MODES 0xffffff #define ALL_MODES 0xffffff
#define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL) #define ALL_MOUSE_MODES (MODE_MOUSE_STANDARD|MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
#define MOTION_MOUSE_MODES (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)
/* /*
* A single UTF-8 character. UTF8_SIZE must be big enough to hold * A single UTF-8 character. UTF8_SIZE must be big enough to hold
@ -1119,6 +1120,7 @@ RB_HEAD(sessions, session);
/* Mouse input. */ /* Mouse input. */
struct mouse_event { struct mouse_event {
int valid; int valid;
int ignore;
key_code key; key_code key;