diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-02-01 12:01:18 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-02-01 12:01:18 +0000 |
commit | 9b1f620aa017bb3634b3806e959580cde75ec655 (patch) | |
tree | 2112ace73236adcc27200cecedf6688eade17f7a /server-client.c | |
parent | 9b9a5a292d656f14c927a36bf77af4a4cf1ecb3a (diff) | |
parent | dd0c8147795c518de443c33895c614e52b42677f (diff) | |
download | rtmux-9b1f620aa017bb3634b3806e959580cde75ec655.tar.gz rtmux-9b1f620aa017bb3634b3806e959580cde75ec655.tar.bz2 rtmux-9b1f620aa017bb3634b3806e959580cde75ec655.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/server-client.c b/server-client.c index dbe3e7ec..0461b97e 100644 --- a/server-client.c +++ b/server-client.c @@ -333,14 +333,27 @@ server_client_check_mouse(struct client *c) int flag; key_code key; struct timeval tv; - enum { NOTYPE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type = NOTYPE; - enum { NOWHERE, PANE, STATUS, BORDER } where = NOWHERE; + enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; + enum { NOWHERE, PANE, STATUS, BORDER } where; + + type = NOTYPE; + where = NOWHERE; log_debug("mouse %02x at %u,%u (last %u,%u) (%d)", m->b, m->x, m->y, m->lx, m->ly, c->tty.mouse_drag_flag); /* What type of event is this? */ - if (MOUSE_DRAG(m->b)) { + if ((m->sgr_type != ' ' && + MOUSE_DRAG(m->sgr_b) && + MOUSE_BUTTONS(m->sgr_b) == 3) || + (m->sgr_type == ' ' && + MOUSE_DRAG(m->b) && + MOUSE_BUTTONS(m->b) == 3 && + MOUSE_BUTTONS(m->lb) == 3)) { + type = MOVE; + x = m->x, y = m->y, b = 0; + log_debug("move at %u,%u", x, y); + } else if (MOUSE_DRAG(m->b)) { type = DRAG; if (c->tty.mouse_drag_flag) { x = m->x, y = m->y, b = m->b; @@ -498,6 +511,14 @@ have_event: switch (type) { case NOTYPE: break; + case MOVE: + if (where == PANE) + key = KEYC_MOUSEMOVE_PANE; + if (where == STATUS) + key = KEYC_MOUSEMOVE_STATUS; + if (where == BORDER) + key = KEYC_MOUSEMOVE_BORDER; + break; case DRAG: if (c->tty.mouse_drag_update != NULL) key = KEYC_DRAGGING; @@ -1063,7 +1084,7 @@ static void server_client_reset_state(struct client *c) { struct window *w = c->session->curw->window; - struct window_pane *wp = w->active; + struct window_pane *wp = w->active, *loop; struct screen *s = wp->screen; struct options *oo = c->session->options; int status, mode, o; @@ -1087,8 +1108,15 @@ server_client_reset_state(struct client *c) * mode. */ mode = s->mode; - if (options_get_number(oo, "mouse")) - mode = (mode & ~ALL_MOUSE_MODES) | MODE_MOUSE_BUTTON; + if (options_get_number(oo, "mouse")) { + mode &= ~ALL_MOUSE_MODES; + TAILQ_FOREACH(loop, &w->panes, entry) { + if (loop->screen->mode & MODE_MOUSE_ALL) + mode |= MODE_MOUSE_ALL; + } + if (~mode & MODE_MOUSE_ALL) + mode |= MODE_MOUSE_BUTTON; + } /* Set the terminal mode and reset attributes. */ tty_update_mode(&c->tty, mode, s); |