summaryrefslogtreecommitdiffstats
path: root/status.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-04-18 19:49:05 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-04-18 19:49:05 +0000
commit0bb211978121292518d59430e3547685882078bc (patch)
tree0fbcc60e35bddb0cc2536ab08485a7131f4f1ad2 /status.c
parent4e75e82cc35050a244193830bd4d252eee9ad323 (diff)
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.
Diffstat (limited to 'status.c')
-rw-r--r--status.c18
1 files changed, 18 insertions, 0 deletions
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);