version 1.20, 2012/01/21 23:45:44 |
version 1.21, 2012/01/29 09:37:02 |
|
|
screen_redraw_screen(struct client *c, int status_only, int borders_only) |
screen_redraw_screen(struct client *c, int status_only, int borders_only) |
{ |
{ |
struct window *w = c->session->curw->window; |
struct window *w = c->session->curw->window; |
|
struct options *oo = &c->session->options; |
struct tty *tty = &c->tty; |
struct tty *tty = &c->tty; |
struct window_pane *wp; |
struct window_pane *wp; |
struct grid_cell active_gc, other_gc; |
struct grid_cell active_gc, other_gc; |
u_int i, j, type; |
u_int i, j, type, top; |
int status, fg, bg; |
int status, spos, fg, bg; |
|
|
/* Suspended clients should not be updated. */ |
/* Suspended clients should not be updated. */ |
if (c->flags & CLIENT_SUSPENDED) |
if (c->flags & CLIENT_SUSPENDED) |
return; |
return; |
|
|
/* Get status line, er, status. */ |
/* Get status line, er, status. */ |
|
spos = options_get_number(oo, "status-position"); |
if (c->message_string != NULL || c->prompt_string != NULL) |
if (c->message_string != NULL || c->prompt_string != NULL) |
status = 1; |
status = 1; |
else |
else |
status = options_get_number(&c->session->options, "status"); |
status = options_get_number(oo, "status"); |
|
top = 0; |
|
if (status && spos == 0) |
|
top = 1; |
|
|
/* If only drawing status and it is present, don't need the rest. */ |
/* If only drawing status and it is present, don't need the rest. */ |
if (status_only && status) { |
if (status_only && status) { |
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1); |
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); |
tty_reset(tty); |
return; |
return; |
} |
} |
|
|
memcpy(&active_gc, &grid_default_cell, sizeof active_gc); |
memcpy(&active_gc, &grid_default_cell, sizeof active_gc); |
active_gc.data = other_gc.data = 'x'; /* not space */ |
active_gc.data = other_gc.data = 'x'; /* not space */ |
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET; |
active_gc.attr = other_gc.attr = GRID_ATTR_CHARSET; |
fg = options_get_number(&c->session->options, "pane-border-fg"); |
fg = options_get_number(oo, "pane-border-fg"); |
colour_set_fg(&other_gc, fg); |
colour_set_fg(&other_gc, fg); |
bg = options_get_number(&c->session->options, "pane-border-bg"); |
bg = options_get_number(oo, "pane-border-bg"); |
colour_set_bg(&other_gc, bg); |
colour_set_bg(&other_gc, bg); |
fg = options_get_number(&c->session->options, "pane-active-border-fg"); |
fg = options_get_number(oo, "pane-active-border-fg"); |
colour_set_fg(&active_gc, fg); |
colour_set_fg(&active_gc, fg); |
bg = options_get_number(&c->session->options, "pane-active-border-bg"); |
bg = options_get_number(oo, "pane-active-border-bg"); |
colour_set_bg(&active_gc, bg); |
colour_set_bg(&active_gc, bg); |
|
|
/* Draw background and borders. */ |
/* Draw background and borders. */ |
for (j = 0; j < tty->sy - status; j++) { |
for (j = 0; j < tty->sy - status; j++) { |
if (status_only && j != tty->sy - 1) |
if (status_only) { |
continue; |
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); |
type = screen_redraw_check_cell(c, i, j); |
if (type == CELL_INSIDE) |
if (type == CELL_INSIDE) |
|
|
tty_attributes(tty, &active_gc); |
tty_attributes(tty, &active_gc); |
else |
else |
tty_attributes(tty, &other_gc); |
tty_attributes(tty, &other_gc); |
tty_cursor(tty, i, j); |
tty_cursor(tty, i, top + j); |
tty_putc(tty, CELL_BORDERS[type]); |
tty_putc(tty, CELL_BORDERS[type]); |
} |
} |
} |
} |
|
|
if (!window_pane_visible(wp)) |
if (!window_pane_visible(wp)) |
continue; |
continue; |
for (i = 0; i < wp->sy; i++) { |
for (i = 0; i < wp->sy; i++) { |
if (status_only && wp->yoff + i != tty->sy - 1) |
if (status_only) { |
continue; |
if (spos == 1 && wp->yoff + i != tty->sy - 1) |
tty_draw_line(tty, wp->screen, i, wp->xoff, 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. */ |
/* Draw the status line. */ |
if (status) |
if (status) { |
tty_draw_line(tty, &c->status, 0, 0, tty->sy - 1); |
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); |
tty_reset(tty); |
} |
} |
|
|
|
|
void |
void |
screen_redraw_pane(struct client *c, struct window_pane *wp) |
screen_redraw_pane(struct client *c, struct window_pane *wp) |
{ |
{ |
u_int i; |
u_int i, yoff; |
|
|
|
yoff = wp->yoff; |
|
if (status_at_line(c) == 0) |
|
yoff++; |
|
|
for (i = 0; i < wp->sy; i++) |
for (i = 0; i < wp->sy; i++) |
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, wp->yoff); |
tty_draw_line(&c->tty, wp->screen, i, wp->xoff, yoff); |
tty_reset(&c->tty); |
tty_reset(&c->tty); |
} |
} |
|
|