summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/input-keys.c13
-rw-r--r--usr.bin/tmux/server-client.c12
-rw-r--r--usr.bin/tmux/tmux.h4
3 files changed, 17 insertions, 12 deletions
diff --git a/usr.bin/tmux/input-keys.c b/usr.bin/tmux/input-keys.c
index 0ba6a9376fd..4cdf5d90654 100644
--- a/usr.bin/tmux/input-keys.c
+++ b/usr.bin/tmux/input-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input-keys.c,v 1.67 2020/01/13 07:51:54 nicm Exp $ */
+/* $OpenBSD: input-keys.c,v 1.68 2020/03/16 06:12:42 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -254,12 +254,12 @@ static void
input_key_mouse(struct window_pane *wp, struct mouse_event *m)
{
struct screen *s = wp->screen;
- int mode = s->mode;
char buf[40];
size_t len;
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;
if (cmd_mouse_at(wp, m, &x, &y, 0) != 0)
return;
@@ -267,8 +267,7 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
return;
/* If this pane is not in button or all mode, discard motion events. */
- if (MOUSE_DRAG(m->b) &&
- (mode & (MODE_MOUSE_BUTTON|MODE_MOUSE_ALL)) == 0)
+ if (MOUSE_DRAG(m->b) && (s->mode & MOTION_MOUSE_MODES) == 0)
return;
/*
@@ -280,13 +279,13 @@ input_key_mouse(struct window_pane *wp, struct mouse_event *m)
if (m->sgr_type != ' ') {
if (MOUSE_DRAG(m->sgr_b) &&
MOUSE_BUTTONS(m->sgr_b) == 3 &&
- (~mode & MODE_MOUSE_ALL))
+ (~s->mode & MODE_MOUSE_ALL))
return;
} else {
if (MOUSE_DRAG(m->b) &&
MOUSE_BUTTONS(m->b) == 3 &&
MOUSE_BUTTONS(m->lb) == 3 &&
- (~mode & MODE_MOUSE_ALL))
+ (~s->mode & MODE_MOUSE_ALL))
return;
}
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 0af65b60ac5..c33be44fa0b 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.306 2020/03/12 13:16:16 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.307 2020/03/16 06:12:42 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -419,6 +419,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
struct winlink *wl;
struct window_pane *wp;
u_int x, y, b, sx, sy, px, py;
+ int ignore = 0;
key_code key;
struct timeval tv;
struct style_range *sr;
@@ -445,6 +446,7 @@ server_client_check_mouse(struct client *c, struct key_event *event)
if (event->key == KEYC_DOUBLECLICK) {
type = DOUBLE;
x = m->x, y = m->y, b = m->b;
+ ignore = 1;
log_debug("double-click at %u,%u", x, y);
} else if ((m->sgr_type != ' ' &&
MOUSE_DRAG(m->sgr_b) &&
@@ -491,16 +493,17 @@ server_client_check_mouse(struct client *c, struct key_event *event)
type = TRIPLE;
x = m->x, y = m->y, b = m->b;
log_debug("triple-click at %u,%u", x, y);
+ ignore = 1;
goto have_event;
}
- }
+ } else
+ c->flags |= CLIENT_DOUBLECLICK;
+ add_timer:
type = DOWN;
x = m->x, y = m->y, b = m->b;
log_debug("down at %u,%u", x, y);
- c->flags |= CLIENT_DOUBLECLICK;
- add_timer:
if (KEYC_CLICK_TIMEOUT != 0) {
memcpy(&c->click_event, m, sizeof c->click_event);
c->click_button = m->b;
@@ -519,6 +522,7 @@ have_event:
/* Save the session. */
m->s = s->id;
m->w = -1;
+ m->ignore = ignore;
/* Is this on the status line? */
m->statusat = status_at_line(c);
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 2213fa0387c..188e7ae5557 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.957 2020/03/12 13:16:16 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.958 2020/03/16 06:12:43 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -561,6 +561,7 @@ struct msg_write_close {
#define ALL_MODES 0xffffff
#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
@@ -1117,6 +1118,7 @@ RB_HEAD(sessions, session);
/* Mouse input. */
struct mouse_event {
int valid;
+ int ignore;
key_code key;