diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-03-18 21:24:49 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-03-18 21:24:49 +0000 |
commit | 962f255ee8f271920e8901824ae30fa7a0b40804 (patch) | |
tree | 32c8466be03d668fc42360e5f415ad689c5c95f9 /server-client.c | |
parent | 1d6fe43c7b2250f042d0113da8545d5ebb75c01e (diff) | |
parent | 979313832ce1d5f6cdc2c512e8524d6c517422e0 (diff) |
Merge branch 'obsd-master'
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/server-client.c b/server-client.c index 7b7720e4..a233a91d 100644 --- a/server-client.c +++ b/server-client.c @@ -409,12 +409,13 @@ server_client_check_mouse(struct client *c) { struct session *s = c->session; struct mouse_event *m = &c->tty.mouse; - struct window *w; + struct winlink *wl; struct window_pane *wp; u_int x, y, b, sx, sy, px, py; int flag; key_code key; struct timeval tv; + struct style_range *sr; enum { NOTYPE, MOVE, DOWN, UP, DRAG, WHEEL, DOUBLE, TRIPLE } type; enum { NOWHERE, PANE, STATUS, STATUS_LEFT, STATUS_RIGHT, BORDER } where; @@ -501,17 +502,29 @@ have_event: /* Is this on the status line? */ m->statusat = status_at_line(c); - if (m->statusat != -1 && y == (u_int)m->statusat) { - if (x < c->status.left_size) + if (m->statusat != -1 && + y >= (u_int)m->statusat && + y < m->statusat + status_line_size(c)) + sr = status_get_range(c, x, y - m->statusat); + else + sr = NULL; + if (sr != NULL) { + switch (sr->type) { + case STYLE_RANGE_NONE: + break; + case STYLE_RANGE_LEFT: where = STATUS_LEFT; - else if (x > c->tty.sx - c->status.right_size) + break; + case STYLE_RANGE_RIGHT: where = STATUS_RIGHT; - else { - w = status_get_window_at(c, x); - if (w == NULL) - return (KEYC_UNKNOWN); - m->w = w->id; - where = STATUS; + break; + case STYLE_RANGE_WINDOW: + wl = winlink_find_by_index(&s->windows, sr->argument); + if (wl != NULL) { + m->w = wl->window->id; + where = STATUS; + } + break; } } |