diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-03-17 23:45:19 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2013-03-17 23:45:19 +0000 |
commit | f5de847a0c8be02a16b06e2cae366c2edf539d10 (patch) | |
tree | f4e7d0eeca657405acb435296214033f0be9b9d4 /screen-redraw.c | |
parent | b5516771d30536a7ee931a8331929bffd2103796 (diff) | |
parent | 6bdc947f6b8616e45ed0cf742ad143d138d3d6e2 (diff) | |
download | rtmux-f5de847a0c8be02a16b06e2cae366c2edf539d10.tar.gz rtmux-f5de847a0c8be02a16b06e2cae366c2edf539d10.tar.bz2 rtmux-f5de847a0c8be02a16b06e2cae366c2edf539d10.zip |
Merge branch 'master' of ssh://git.code.sf.net/p/tmux/tmux-code
Diffstat (limited to 'screen-redraw.c')
-rw-r--r-- | screen-redraw.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/screen-redraw.c b/screen-redraw.c index 14b73164..a7bf81ff 100644 --- a/screen-redraw.c +++ b/screen-redraw.c @@ -24,7 +24,11 @@ int screen_redraw_cell_border1(struct window_pane *, u_int, u_int); int screen_redraw_cell_border(struct client *, u_int, u_int); -int screen_redraw_check_cell(struct client *, u_int, u_int); +int screen_redraw_check_cell(struct client *, u_int, u_int, + struct window_pane **); +int screen_redraw_check_active(u_int, u_int, int, struct window *, + struct window_pane *); + void screen_redraw_draw_number(struct client *, struct window_pane *); #define CELL_INSIDE 0 @@ -93,7 +97,8 @@ screen_redraw_cell_border(struct client *c, u_int px, u_int py) /* Check if cell inside a pane. */ int -screen_redraw_check_cell(struct client *c, u_int px, u_int py) +screen_redraw_check_cell(struct client *c, u_int px, u_int py, + struct window_pane **wpp) { struct window *w = c->session->curw->window; struct window_pane *wp; @@ -105,6 +110,7 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py) TAILQ_FOREACH(wp, &w->panes, entry) { if (!window_pane_visible(wp)) continue; + *wpp = wp; /* If outside the pane and its border, skip it. */ if ((wp->xoff != 0 && px < wp->xoff - 1) || @@ -162,9 +168,52 @@ screen_redraw_check_cell(struct client *c, u_int px, u_int py) } } + *wpp = NULL; return (CELL_OUTSIDE); } +/* Check active pane indicator. */ +int +screen_redraw_check_active(u_int px, u_int py, int type, struct window *w, + struct window_pane *wp) +{ + /* Is this off the active pane border? */ + if (screen_redraw_cell_border1(w->active, px, py) != 1) + return (0); + + /* If there are more than two panes, that's enough. */ + if (window_count_panes(w) != 2) + return (1); + + /* Else if the cell is not a border cell, forget it. */ + if (wp == NULL || (type == CELL_OUTSIDE || type == CELL_INSIDE)) + return (1); + + /* Check if the pane covers the whole width. */ + if (wp->xoff == 0 && wp->sx == w->sx) { + /* This can either be the top pane or the bottom pane. */ + if (wp->yoff == 0) { /* top pane */ + if (wp == w->active) + return (px <= wp->sx / 2); + return (px > wp->sx / 2); + } + return (0); + } + + /* Check if the pane covers the whole height. */ + if (wp->yoff == 0 && wp->sy == w->sy) { + /* This can either be the left pane or the right pane. */ + if (wp->xoff == 0) { /* left pane */ + if (wp == w->active) + return (py <= wp->sy / 2); + return (py > wp->sy / 2); + } + return (0); + } + + return (type); +} + /* Redraw entire screen. */ void screen_redraw_screen(struct client *c, int status_only, int borders_only) @@ -223,10 +272,10 @@ screen_redraw_screen(struct client *c, int status_only, int borders_only) break; } for (i = 0; i < tty->sx; i++) { - type = screen_redraw_check_cell(c, i, j); + type = screen_redraw_check_cell(c, i, j, &wp); if (type == CELL_INSIDE) continue; - if (screen_redraw_cell_border1(w->active, i, j) == 1) + if (screen_redraw_check_active(i, j, type, w, wp)) tty_attributes(tty, &active_gc); else tty_attributes(tty, &other_gc); |