version 1.25, 2014/01/28 23:07:09 |
version 1.26, 2014/01/31 14:19:24 |
|
|
int screen_redraw_check_active(u_int, u_int, int, struct window *, |
int screen_redraw_check_active(u_int, u_int, int, struct window *, |
struct window_pane *); |
struct window_pane *); |
|
|
|
void screen_redraw_draw_borders(struct client *, int, u_int); |
|
void screen_redraw_draw_panes(struct client *, u_int); |
|
void screen_redraw_draw_status(struct client *, u_int); |
void screen_redraw_draw_number(struct client *, struct window_pane *); |
void screen_redraw_draw_number(struct client *, struct window_pane *); |
|
|
#define CELL_INSIDE 0 |
#define CELL_INSIDE 0 |
|
|
|
|
/* Redraw entire screen. */ |
/* Redraw entire screen. */ |
void |
void |
screen_redraw_screen(struct client *c, int status_only, int borders_only) |
screen_redraw_screen(struct client *c, int draw_panes, int draw_status, |
|
int draw_borders) |
{ |
{ |
struct window *w = c->session->curw->window; |
struct options *oo = &c->session->options; |
struct options *oo = &c->session->options; |
struct tty *tty = &c->tty; |
struct tty *tty = &c->tty; |
u_int top; |
struct window_pane *wp; |
int status, spos; |
struct grid_cell active_gc, other_gc; |
|
u_int i, j, type, top; |
|
int status, spos; |
|
|
|
/* Suspended clients should not be updated. */ |
/* Suspended clients should not be updated. */ |
if (c->flags & CLIENT_SUSPENDED) |
if (c->flags & CLIENT_SUSPENDED) |
|
|
top = 0; |
top = 0; |
if (status && spos == 0) |
if (status && spos == 0) |
top = 1; |
top = 1; |
|
if (!status) |
|
draw_status = 0; |
|
|
/* If only drawing status and it is present, don't need the rest. */ |
if (draw_borders) |
if (status_only && status) { |
screen_redraw_draw_borders(c, status, top); |
if (top) |
if (draw_panes) |
tty_draw_line(tty, &c->status, 0, 0, 0); |
screen_redraw_draw_panes(c, top); |
else |
if (draw_status) |
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1); |
screen_redraw_draw_status(c, top); |
tty_reset(tty); |
tty_reset(tty); |
|
} |
|
|
|
/* Draw a single pane. */ |
|
void |
|
screen_redraw_pane(struct client *c, struct window_pane *wp) |
|
{ |
|
u_int i, yoff; |
|
|
|
if (!window_pane_visible(wp)) |
return; |
return; |
} |
|
|
|
/* Set up pane border attributes. */ |
yoff = wp->yoff; |
|
if (status_at_line(c) == 0) |
|
yoff++; |
|
|
|
for (i = 0; i < wp->sy; i++) |
|
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, yoff); |
|
tty_reset(&c->tty); |
|
} |
|
|
|
/* Draw the borders. */ |
|
void |
|
screen_redraw_draw_borders(struct client *c, int status, u_int top) |
|
{ |
|
struct window *w = c->session->curw->window; |
|
struct options *oo = &c->session->options; |
|
struct tty *tty = &c->tty; |
|
struct window_pane *wp; |
|
struct grid_cell active_gc, other_gc; |
|
u_int i, j, type; |
|
|
style_apply(&other_gc, oo, "pane-border-style"); |
style_apply(&other_gc, oo, "pane-border-style"); |
style_apply(&active_gc, oo, "pane-active-border-style"); |
style_apply(&active_gc, oo, "pane-active-border-style"); |
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET; /* nuke existing */ |
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET; |
|
|
/* Draw background and borders. */ |
|
for (j = 0; j < tty->sy - status; j++) { |
for (j = 0; j < tty->sy - status; j++) { |
if (status_only) { |
|
if (spos == 1 && j != tty->sy - 1) |
|
continue; |
|
else if (spos == 0 && j != 0) |
|
break; |
|
} |
|
for (i = 0; i < tty->sx; i++) { |
for (i = 0; i < tty->sx; i++) { |
type = screen_redraw_check_cell(c, i, j, &wp); |
type = screen_redraw_check_cell(c, i, j, &wp); |
if (type == CELL_INSIDE) |
if (type == CELL_INSIDE) |
|
|
tty_putc(tty, CELL_BORDERS[type]); |
tty_putc(tty, CELL_BORDERS[type]); |
} |
} |
} |
} |
|
} |
|
|
/* If only drawing borders, that's it. */ |
/* Draw the panes. */ |
if (borders_only) |
void |
return; |
screen_redraw_draw_panes(struct client *c, u_int top) |
|
{ |
|
struct window *w = c->session->curw->window; |
|
struct tty *tty = &c->tty; |
|
struct window_pane *wp; |
|
struct screen *s; |
|
u_int i; |
|
|
/* Draw the panes, if necessary. */ |
|
TAILQ_FOREACH(wp, &w->panes, entry) { |
TAILQ_FOREACH(wp, &w->panes, entry) { |
if (!window_pane_visible(wp)) |
if (!window_pane_visible(wp)) |
continue; |
continue; |
for (i = 0; i < wp->sy; i++) { |
s = wp->screen; |
if (status_only) { |
for (i = 0; i < wp->sy; i++) |
if (spos == 1 && wp->yoff + i != tty->sy - 1) |
tty_draw_line(tty, s, i, wp->xoff, top + wp->yoff); |
continue; |
|
else if (spos == 0 && wp->yoff + i != 0) |
|
break; |
|
} |
|
tty_draw_line( |
|
tty, wp->screen, i, wp->xoff, top + wp->yoff); |
|
} |
|
if (c->flags & CLIENT_IDENTIFY) |
if (c->flags & CLIENT_IDENTIFY) |
screen_redraw_draw_number(c, wp); |
screen_redraw_draw_number(c, wp); |
} |
} |
|
|
/* Draw the status line. */ |
|
if (status) { |
|
if (top) |
|
tty_draw_line(tty, &c->status, 0, 0, 0); |
|
else |
|
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1); |
|
} |
|
tty_reset(tty); |
|
} |
} |
|
|
/* Draw a single pane. */ |
/* Draw the status line. */ |
void |
void |
screen_redraw_pane(struct client *c, struct window_pane *wp) |
screen_redraw_draw_status(struct client *c, u_int top) |
{ |
{ |
u_int i, yoff; |
struct tty *tty = &c->tty; |
|
|
if (!window_pane_visible(wp)) |
if (top) |
return; |
tty_draw_line(tty, &c->status, 0, 0, 0); |
|
else |
yoff = wp->yoff; |
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1); |
if (status_at_line(c) == 0) |
|
yoff++; |
|
|
|
for (i = 0; i < wp->sy; i++) |
|
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, yoff); |
|
tty_reset(&c->tty); |
|
} |
} |
|
|
/* Draw number on a pane. */ |
/* Draw number on a pane. */ |