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.
This commit is contained in:
Nicholas Marriott
2011-04-18 19:49:05 +00:00
parent 4e75e82cc3
commit 0bb2119781
5 changed files with 41 additions and 0 deletions

View File

@ -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);