version 1.208, 2017/01/13 11:56:43 |
version 1.209, 2017/02/01 09:55:07 |
|
|
int flag; |
int flag; |
key_code key; |
key_code key; |
struct timeval tv; |
struct timeval tv; |
enum { NOTYPE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type = NOTYPE; |
enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; |
enum { NOWHERE, PANE, STATUS, BORDER } where = NOWHERE; |
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, |
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); |
m->lx, m->ly, c->tty.mouse_drag_flag); |
|
|
/* What type of event is this? */ |
/* 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; |
type = DRAG; |
if (c->tty.mouse_drag_flag) { |
if (c->tty.mouse_drag_flag) { |
x = m->x, y = m->y, b = m->b; |
x = m->x, y = m->y, b = m->b; |
|
|
switch (type) { |
switch (type) { |
case NOTYPE: |
case NOTYPE: |
break; |
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: |
case DRAG: |
if (c->tty.mouse_drag_update != NULL) |
if (c->tty.mouse_drag_update != NULL) |
key = KEYC_DRAGGING; |
key = KEYC_DRAGGING; |
|
|
server_client_reset_state(struct client *c) |
server_client_reset_state(struct client *c) |
{ |
{ |
struct window *w = c->session->curw->window; |
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 screen *s = wp->screen; |
struct options *oo = c->session->options; |
struct options *oo = c->session->options; |
int status, mode, o; |
int status, mode, o; |
|
|
* mode. |
* mode. |
*/ |
*/ |
mode = s->mode; |
mode = s->mode; |
if (options_get_number(oo, "mouse")) |
if (options_get_number(oo, "mouse")) { |
mode = (mode & ~ALL_MOUSE_MODES) | MODE_MOUSE_BUTTON; |
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. */ |
/* Set the terminal mode and reset attributes. */ |
tty_update_mode(&c->tty, mode, s); |
tty_update_mode(&c->tty, mode, s); |