Update of /cvsroot/tmux/tmux
In directory vz-cvs-2.sog:/tmp/cvs-serv28315

Modified Files:
        options-table.c server-client.c status.c tmux.1 tmux.h 
Log Message:
|PatchSet 893
|Date: 2011/04/18 20:49:05
|Author: nicm
|Branch: HEAD
|Tag: (none)
|Log:
|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.



Index: server-client.c
===================================================================
RCS file: /cvsroot/tmux/tmux/server-client.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- server-client.c     6 Apr 2011 22:21:02 -0000       1.55
+++ server-client.c     18 Apr 2011 21:07:58 -0000      1.56
@@ -318,6 +318,12 @@
                        server_redraw_window_borders(w);
                        wp = w->active;
                }
+               if (mouse->y + 1 == c->tty.sy && mouse->b == MOUSE_UP &&
+                   options_get_number(oo, "mouse-select-window") &&
+                   options_get_number(oo, "status")) {
+                       status_set_window_at(c, mouse->x);
+                       return;
+               }
                window_pane_mouse(wp, c->session, mouse);
                return;
        }
@@ -458,6 +464,10 @@
            (mode & ALL_MOUSE_MODES) == 0)
                mode |= MODE_MOUSE_STANDARD;
 
+       if (options_get_number(oo, "mouse-select-window") &&
+           (mode & ALL_MOUSE_MODES) == 0)
+               mode |= MODE_MOUSE_STANDARD;
+
        /*
         * Set UTF-8 mouse input if required. If the terminal is UTF-8, the
         * user has set mouse-utf8 and any mouse mode is in effect, turn on

Index: options-table.c
===================================================================
RCS file: /cvsroot/tmux/tmux/options-table.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- options-table.c     18 Apr 2011 21:03:42 -0000      1.6
+++ options-table.c     18 Apr 2011 21:07:58 -0000      1.7
@@ -197,6 +197,11 @@
          .default_num = 0
        },
 
+       { .name = "mouse-select-window",
+         .type = OPTIONS_TABLE_FLAG,
+         .default_num = 0
+       },
+
        { .name = "mouse-utf8",
          .type = OPTIONS_TABLE_FLAG,
          .default_num = 0

Index: status.c
===================================================================
RCS file: /cvsroot/tmux/tmux/status.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- status.c    6 Apr 2011 22:21:02 -0000       1.157
+++ status.c    18 Apr 2011 21:07:58 -0000      1.158
@@ -120,6 +120,23 @@
        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 @@
                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);

Index: tmux.h
===================================================================
RCS file: /cvsroot/tmux/tmux/tmux.h,v
retrieving revision 1.619
retrieving revision 1.620
diff -u -d -r1.619 -r1.620
--- tmux.h      9 Apr 2011 07:48:58 -0000       1.619
+++ tmux.h      18 Apr 2011 21:07:58 -0000      1.620
@@ -953,6 +953,8 @@
 
        struct environ   environ;
 
+       int              wlmouse;
+
        int              references;
 
        TAILQ_ENTRY(session) gentry;
@@ -1662,6 +1664,7 @@
 RB_PROTOTYPE(status_out_tree, status_out, entry, status_out_cmp);
 void    status_free_jobs(struct status_out_tree *);
 void    status_update_jobs(struct client *);
+void    status_set_window_at(struct client *, u_int);
 int     status_redraw(struct client *);
 char   *status_replace(struct client *, struct session *,
             struct winlink *, struct window_pane *, const char *, time_t, int);



------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
tmux-cvs mailing list
tmux-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-cvs

Reply via email to