From 0bb211978121292518d59430e3547685882078bc Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 18 Apr 2011 19:49:05 +0000 Subject: Add an option (mouse-select-window) which allows the mouse to be used by clicking on the status line, written by hsim at gmx dot li. --- status.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'status.c') diff --git a/status.c b/status.c index 0a777ce8..ecf19b25 100644 --- a/status.c +++ b/status.c @@ -120,6 +120,23 @@ status_redraw_get_right(struct client *c, return (right); } +/* Set window at window list position. */ +void +status_set_window_at(struct client *c, u_int x) +{ + struct session *s = c->session; + struct winlink *wl; + + x += s->wlmouse; + RB_FOREACH(wl, winlinks, &s->windows) { + if (x < wl->status_width && + session_select(s, wl->idx) == 0) { + server_redraw_session(s); + } + x -= wl->status_width + 1; + } +} + /* Draw status for client on the last lines of given context. */ int status_redraw(struct client *c) @@ -325,6 +342,7 @@ draw: wloffset++; /* Copy the window list. */ + s->wlmouse = -wloffset + wlstart; screen_write_cursormove(&ctx, wloffset, 0); screen_write_copy(&ctx, &window_list, wlstart, 0, wlwidth, 1); screen_free(&window_list); -- cgit v1.2.3