diff options
author | Thomas Adam <thomas@xteddy.org> | 2023-08-17 18:01:09 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2023-08-17 18:01:09 +0100 |
commit | e3a8b8434cf656164d74ae115ebccd432144ed2c (patch) | |
tree | 45b6061279b4b6155e0b6dd921b42a9341d3e98d /server-client.c | |
parent | 3d93b0c52ecd6d5b321fef777d49c360c9fbe069 (diff) | |
parent | 8636848e6348bb0e38cd6aaaadbe61e15181bc8f (diff) |
Merge branch 'obsd-master'
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/server-client.c b/server-client.c index 874a3522..b2c355c7 100644 --- a/server-client.c +++ b/server-client.c @@ -560,9 +560,9 @@ static key_code server_client_check_mouse(struct client *c, struct key_event *event) { struct mouse_event *m = &event->m; - struct session *s = c->session; - struct winlink *wl; - struct window_pane *wp; + struct session *s = c->session, *fs; + struct winlink *fwl; + struct window_pane *wp, *fwp; u_int x, y, b, sx, sy, px, py; int ignore = 0; key_code key; @@ -668,6 +668,7 @@ have_event: /* Save the session. */ m->s = s->id; m->w = -1; + m->wp = -1; m->ignore = ignore; /* Is this on the status line? */ @@ -684,18 +685,42 @@ have_event: case STYLE_RANGE_NONE: return (KEYC_UNKNOWN); case STYLE_RANGE_LEFT: + log_debug("mouse range: left"); where = STATUS_LEFT; break; case STYLE_RANGE_RIGHT: + log_debug("mouse range: right"); where = STATUS_RIGHT; break; + case STYLE_RANGE_PANE: + fwp = window_pane_find_by_id(sr->argument); + if (fwp == NULL) + return (KEYC_UNKNOWN); + m->wp = sr->argument; + + log_debug("mouse range: pane %%%u", m->wp); + where = STATUS; + break; case STYLE_RANGE_WINDOW: - wl = winlink_find_by_index(&s->windows, + fwl = winlink_find_by_index(&s->windows, sr->argument); - if (wl == NULL) + if (fwl == NULL) return (KEYC_UNKNOWN); - m->w = wl->window->id; + m->w = fwl->window->id; + log_debug("mouse range: window @%u", m->w); + where = STATUS; + break; + case STYLE_RANGE_SESSION: + fs = session_find_by_id(sr->argument); + if (fs == NULL) + return (KEYC_UNKNOWN); + m->s = sr->argument; + + log_debug("mouse range: session $%u", m->s); + where = STATUS; + break; + case STYLE_RANGE_USER: where = STATUS; break; } |