mirror of
https://github.com/tmux/tmux.git
synced 2026-06-21 17:55:21 +00:00
Rename screen_redraw_ to redraw_.
This commit is contained in:
6
layout.c
6
layout.c
@@ -466,7 +466,7 @@ layout_fix_panes(struct window *w, struct window_pane *skip)
|
|||||||
changed = 1;
|
changed = 1;
|
||||||
}
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Count the number of available cells in a layout. */
|
/* Count the number of available cells in a layout. */
|
||||||
@@ -841,7 +841,7 @@ layout_resize_floating_pane_to(struct window_pane *wp, enum layout_type type,
|
|||||||
return;
|
return;
|
||||||
lc->sx = size;
|
lc->sx = size;
|
||||||
}
|
}
|
||||||
screen_redraw_invalidate_scene(wp->window);
|
redraw_invalidate_scene(wp->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resize a floating pane relative to its current size. */
|
/* Resize a floating pane relative to its current size. */
|
||||||
@@ -878,7 +878,7 @@ layout_resize_floating_pane(struct window_pane *wp, enum layout_type type,
|
|||||||
if (opposite)
|
if (opposite)
|
||||||
lc->xoff -= change;
|
lc->xoff -= change;
|
||||||
}
|
}
|
||||||
screen_redraw_invalidate_scene(wp->window);
|
redraw_invalidate_scene(wp->window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Resize a layout cell. */
|
/* Resize a layout cell. */
|
||||||
|
|||||||
@@ -1227,7 +1227,7 @@ options_push_changes(const char *name)
|
|||||||
strcmp(name, "pane-scrollbars") == 0 ||
|
strcmp(name, "pane-scrollbars") == 0 ||
|
||||||
strcmp(name, "pane-scrollbars-position") == 0 ||
|
strcmp(name, "pane-scrollbars-position") == 0 ||
|
||||||
strcmp(name, "pane-scrollbars-style") == 0)
|
strcmp(name, "pane-scrollbars-style") == 0)
|
||||||
screen_redraw_invalidate_all_scenes();
|
redraw_invalidate_all_scenes();
|
||||||
if (strcmp(name, "monitor-silence") == 0)
|
if (strcmp(name, "monitor-silence") == 0)
|
||||||
alerts_reset_all();
|
alerts_reset_all();
|
||||||
if (strcmp(name, "window-style") == 0 ||
|
if (strcmp(name, "window-style") == 0 ||
|
||||||
|
|||||||
259
screen-redraw.c
259
screen-redraw.c
@@ -164,8 +164,8 @@ struct redraw_build_cell {
|
|||||||
struct redraw_span_data data;
|
struct redraw_span_data data;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct redraw_build_cell *screen_redraw_cells;
|
static struct redraw_build_cell *redraw_cells;
|
||||||
static size_t screen_redraw_ncells;
|
static size_t redraw_ncells;
|
||||||
|
|
||||||
/* Context for building the scene. */
|
/* Context for building the scene. */
|
||||||
struct redraw_build_ctx {
|
struct redraw_build_ctx {
|
||||||
@@ -202,7 +202,7 @@ struct redraw_draw_ctx {
|
|||||||
|
|
||||||
/* Make redraw flags into a string. */
|
/* Make redraw flags into a string. */
|
||||||
static const char *
|
static const char *
|
||||||
screen_redraw_flags_string(int flags)
|
redraw_flags_string(int flags)
|
||||||
{
|
{
|
||||||
static char s[128];
|
static char s[128];
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ screen_redraw_flags_string(int flags)
|
|||||||
|
|
||||||
/* Initialize the context for building scene. */
|
/* Initialize the context for building scene. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_set_context(struct client *c, struct redraw_build_ctx *bctx)
|
redraw_set_context(struct client *c, struct redraw_build_ctx *bctx)
|
||||||
{
|
{
|
||||||
struct session *s = c->session;
|
struct session *s = c->session;
|
||||||
struct window *w = s->curw->window;
|
struct window *w = s->curw->window;
|
||||||
@@ -246,16 +246,16 @@ screen_redraw_set_context(struct client *c, struct redraw_build_ctx *bctx)
|
|||||||
|
|
||||||
/* Return a cell. */
|
/* Return a cell. */
|
||||||
static struct redraw_build_cell *
|
static struct redraw_build_cell *
|
||||||
screen_redraw_cell(struct redraw_build_ctx *bctx, u_int x, u_int y)
|
redraw_cell(struct redraw_build_ctx *bctx, u_int x, u_int y)
|
||||||
{
|
{
|
||||||
return (&bctx->cells[(y * bctx->sx) + x]);
|
return (&bctx->cells[(y * bctx->sx) + x]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset cell to either empty or outside the window. */
|
/* Reset cell to either empty or outside the window. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_reset_cell(struct redraw_build_ctx *bctx, u_int x, u_int y)
|
redraw_reset_cell(struct redraw_build_ctx *bctx, u_int x, u_int y)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc = screen_redraw_cell(bctx, x, y);
|
struct redraw_build_cell *bc = redraw_cell(bctx, x, y);
|
||||||
struct window *w = bctx->w;
|
struct window *w = bctx->w;
|
||||||
|
|
||||||
memset(bc, 0, sizeof *bc);
|
memset(bc, 0, sizeof *bc);
|
||||||
@@ -267,7 +267,7 @@ screen_redraw_reset_cell(struct redraw_build_ctx *bctx, u_int x, u_int y)
|
|||||||
|
|
||||||
/* Convert window position to scene position. Return 0 if outside the scene. */
|
/* Convert window position to scene position. Return 0 if outside the scene. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_window_to_scene(struct redraw_build_ctx *bctx, int wx, int wy,
|
redraw_window_to_scene(struct redraw_build_ctx *bctx, int wx, int wy,
|
||||||
u_int *x, u_int *y)
|
u_int *x, u_int *y)
|
||||||
{
|
{
|
||||||
if (wx < 0 || wy < 0)
|
if (wx < 0 || wy < 0)
|
||||||
@@ -290,17 +290,17 @@ screen_redraw_window_to_scene(struct redraw_build_ctx *bctx, int wx, int wy,
|
|||||||
|
|
||||||
/* Convert pane position to scene position. Return 0 if outside the scene. */
|
/* Convert pane position to scene position. Return 0 if outside the scene. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_pane_to_scene(struct redraw_build_ctx *bctx,
|
redraw_pane_to_scene(struct redraw_build_ctx *bctx, struct window_pane *wp,
|
||||||
struct window_pane *wp, int px, int py, u_int *x, u_int *y)
|
int px, int py, u_int *x, u_int *y)
|
||||||
{
|
{
|
||||||
int wx = wp->xoff + px, wy = wp->yoff + py;
|
int wx = wp->xoff + px, wy = wp->yoff + py;
|
||||||
|
|
||||||
return (screen_redraw_window_to_scene(bctx, wx, wy, x, y));
|
return (redraw_window_to_scene(bctx, wx, wy, x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert redraw border mask to a cell type. */
|
/* Convert redraw border mask to a cell type. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_get_cell_type(int mask)
|
redraw_get_cell_type(int mask)
|
||||||
{
|
{
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case REDRAW_BORDER_L|REDRAW_BORDER_R|REDRAW_BORDER_U|REDRAW_BORDER_D:
|
case REDRAW_BORDER_L|REDRAW_BORDER_R|REDRAW_BORDER_U|REDRAW_BORDER_D:
|
||||||
@@ -335,7 +335,7 @@ screen_redraw_get_cell_type(int mask)
|
|||||||
|
|
||||||
/* Return if this cell has exactly two panes with a shared border. */
|
/* Return if this cell has exactly two panes with a shared border. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_two_panes(struct window *w, enum layout_type *type)
|
redraw_two_panes(struct window *w, enum layout_type *type)
|
||||||
{
|
{
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
u_int count = 0;
|
u_int count = 0;
|
||||||
@@ -354,8 +354,8 @@ screen_redraw_two_panes(struct window *w, enum layout_type *type)
|
|||||||
|
|
||||||
/* Clear the cells covered by a floating pane. */
|
/* Clear the cells covered by a floating pane. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_reset_floating_pane_cells(struct redraw_build_ctx *bctx,
|
redraw_reset_floating_pane_cells(struct redraw_build_ctx *bctx,
|
||||||
struct window_pane *wp, int sb_w, int sb_left)
|
struct window_pane *wp, int sb_w, int sb_left)
|
||||||
{
|
{
|
||||||
enum pane_lines pane_lines;
|
enum pane_lines pane_lines;
|
||||||
u_int x, y;
|
u_int x, y;
|
||||||
@@ -383,26 +383,24 @@ screen_redraw_reset_floating_pane_cells(struct redraw_build_ctx *bctx,
|
|||||||
|
|
||||||
for (wy = top; wy <= bottom; wy++) {
|
for (wy = top; wy <= bottom; wy++) {
|
||||||
for (wx = left; wx <= right; wx++) {
|
for (wx = left; wx <= right; wx++) {
|
||||||
if (screen_redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
if (redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
||||||
screen_redraw_reset_cell(bctx, x, y);
|
redraw_reset_cell(bctx, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark pane inside data. */
|
/* Mark pane inside data. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_pane_inside(struct redraw_build_ctx *bctx,
|
redraw_mark_pane_inside(struct redraw_build_ctx *bctx, struct window_pane *wp)
|
||||||
struct window_pane *wp)
|
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
u_int px, py, x, y;
|
u_int px, py, x, y;
|
||||||
|
|
||||||
for (py = 0; py < wp->sy; py++) {
|
for (py = 0; py < wp->sy; py++) {
|
||||||
for (px = 0; px < wp->sx; px++) {
|
for (px = 0; px < wp->sx; px++) {
|
||||||
if (!screen_redraw_pane_to_scene(bctx, wp, px, py, &x,
|
if (!redraw_pane_to_scene(bctx, wp, px, py, &x, &y))
|
||||||
&y))
|
|
||||||
continue;
|
continue;
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
memset(bc, 0, sizeof *bc);
|
memset(bc, 0, sizeof *bc);
|
||||||
bc->data.type = REDRAW_SPAN_PANE;
|
bc->data.type = REDRAW_SPAN_PANE;
|
||||||
bc->data.p.wp = wp;
|
bc->data.p.wp = wp;
|
||||||
@@ -414,13 +412,13 @@ screen_redraw_mark_pane_inside(struct redraw_build_ctx *bctx,
|
|||||||
|
|
||||||
/* Mark scrollbar data. */
|
/* Mark scrollbar data. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_pane_scrollbar(struct redraw_build_ctx *bctx,
|
redraw_mark_pane_scrollbar(struct redraw_build_ctx *bctx,
|
||||||
struct window_pane *wp, int sb_w, int sb_left)
|
struct window_pane *wp, int sb_w, int sb_left)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
u_int x, y;
|
u_int x, y;
|
||||||
int wx, wy, sx, ex;
|
int wx, wy, sx, ex;
|
||||||
u_int sy;
|
u_int sy;
|
||||||
|
|
||||||
if (sb_w == 0)
|
if (sb_w == 0)
|
||||||
return;
|
return;
|
||||||
@@ -436,10 +434,10 @@ screen_redraw_mark_pane_scrollbar(struct redraw_build_ctx *bctx,
|
|||||||
for (sy = 0; sy < wp->sy; sy++) {
|
for (sy = 0; sy < wp->sy; sy++) {
|
||||||
wy = wp->yoff + (int)sy;
|
wy = wp->yoff + (int)sy;
|
||||||
for (wx = sx; wx <= ex; wx++) {
|
for (wx = sx; wx <= ex; wx++) {
|
||||||
if (!screen_redraw_window_to_scene(bctx, wx, wy, &x,
|
if (!redraw_window_to_scene(bctx, wx, wy, &x,
|
||||||
&y))
|
&y))
|
||||||
continue;
|
continue;
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
memset(bc, 0, sizeof *bc);
|
memset(bc, 0, sizeof *bc);
|
||||||
bc->data.type = REDRAW_SPAN_SCROLLBAR;
|
bc->data.type = REDRAW_SPAN_SCROLLBAR;
|
||||||
bc->data.sb.wp = wp;
|
bc->data.sb.wp = wp;
|
||||||
@@ -458,16 +456,16 @@ screen_redraw_mark_pane_scrollbar(struct redraw_build_ctx *bctx,
|
|||||||
* replace it. If it is already a border, merge it.
|
* replace it. If it is already a border, merge it.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_border_cell(struct redraw_build_ctx *bctx, int wx, int wy,
|
redraw_mark_border_cell(struct redraw_build_ctx *bctx, int wx, int wy,
|
||||||
struct window_pane *wp, int top_owner, int bottom_owner, int mask)
|
struct window_pane *wp, int top_owner, int bottom_owner, int mask)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
enum pane_lines pane_lines;
|
enum pane_lines pane_lines;
|
||||||
u_int x, y;
|
u_int x, y;
|
||||||
|
|
||||||
if (!screen_redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
if (!redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
||||||
return;
|
return;
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
|
|
||||||
if (bc->data.type != REDRAW_SPAN_BORDER) {
|
if (bc->data.type != REDRAW_SPAN_BORDER) {
|
||||||
if (bc->data.type != REDRAW_SPAN_EMPTY)
|
if (bc->data.type != REDRAW_SPAN_EMPTY)
|
||||||
@@ -497,12 +495,12 @@ screen_redraw_mark_border_cell(struct redraw_build_ctx *bctx, int wx, int wy,
|
|||||||
|
|
||||||
mask |= bc->data.b.cell_mask;
|
mask |= bc->data.b.cell_mask;
|
||||||
bc->data.b.cell_mask = mask;
|
bc->data.b.cell_mask = mask;
|
||||||
bc->data.b.cell_type = screen_redraw_get_cell_type(mask);
|
bc->data.b.cell_type = redraw_get_cell_type(mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark area available for pane status line. */
|
/* Mark area available for pane status line. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_border_status(struct redraw_build_ctx *bctx,
|
redraw_mark_border_status(struct redraw_build_ctx *bctx,
|
||||||
struct window_pane *wp, __unused int left, int right, int top, int bottom)
|
struct window_pane *wp, __unused int left, int right, int top, int bottom)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
@@ -523,9 +521,9 @@ screen_redraw_mark_border_status(struct redraw_build_ctx *bctx,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (wx = sx; wx <= ex; wx++, off++) {
|
for (wx = sx; wx <= ex; wx++, off++) {
|
||||||
if (!screen_redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
if (!redraw_window_to_scene(bctx, wx, wy, &x, &y))
|
||||||
continue;
|
continue;
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type != REDRAW_SPAN_BORDER)
|
if (bc->data.type != REDRAW_SPAN_BORDER)
|
||||||
continue;
|
continue;
|
||||||
cell_type = bc->data.b.cell_type;
|
cell_type = bc->data.b.cell_type;
|
||||||
@@ -539,7 +537,7 @@ screen_redraw_mark_border_status(struct redraw_build_ctx *bctx,
|
|||||||
|
|
||||||
/* Mark where indicator arrows will go, if enabled. */
|
/* Mark where indicator arrows will go, if enabled. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_border_arrows(struct redraw_build_ctx *bctx,
|
redraw_mark_border_arrows(struct redraw_build_ctx *bctx,
|
||||||
struct window_pane *wp, int left, int right, int top, int bottom)
|
struct window_pane *wp, int left, int right, int top, int bottom)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
@@ -552,14 +550,14 @@ screen_redraw_mark_border_arrows(struct redraw_build_ctx *bctx,
|
|||||||
wx = wp->xoff + 1;
|
wx = wp->xoff + 1;
|
||||||
if (wx >= left && wx <= right) {
|
if (wx >= left && wx <= right) {
|
||||||
wy = top;
|
wy = top;
|
||||||
if (screen_redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
if (redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type == REDRAW_SPAN_BORDER)
|
if (bc->data.type == REDRAW_SPAN_BORDER)
|
||||||
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
||||||
}
|
}
|
||||||
wy = bottom;
|
wy = bottom;
|
||||||
if (screen_redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
if (redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type == REDRAW_SPAN_BORDER)
|
if (bc->data.type == REDRAW_SPAN_BORDER)
|
||||||
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
||||||
}
|
}
|
||||||
@@ -568,14 +566,14 @@ screen_redraw_mark_border_arrows(struct redraw_build_ctx *bctx,
|
|||||||
wy = wp->yoff + 1;
|
wy = wp->yoff + 1;
|
||||||
if (wy >= top && wy <= bottom) {
|
if (wy >= top && wy <= bottom) {
|
||||||
wx = left;
|
wx = left;
|
||||||
if (screen_redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
if (redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type == REDRAW_SPAN_BORDER)
|
if (bc->data.type == REDRAW_SPAN_BORDER)
|
||||||
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
||||||
}
|
}
|
||||||
wx = right;
|
wx = right;
|
||||||
if (screen_redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
if (redraw_window_to_scene(bctx, wx, wy, &x, &y)) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type == REDRAW_SPAN_BORDER)
|
if (bc->data.type == REDRAW_SPAN_BORDER)
|
||||||
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
bc->data.b.flags |= REDRAW_BORDER_IS_ARROW;
|
||||||
}
|
}
|
||||||
@@ -584,7 +582,7 @@ screen_redraw_mark_border_arrows(struct redraw_build_ctx *bctx,
|
|||||||
|
|
||||||
/* Mark pane borders. */
|
/* Mark pane borders. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
||||||
struct window_pane *wp, int sb_w, int sb_left)
|
struct window_pane *wp, int sb_w, int sb_left)
|
||||||
{
|
{
|
||||||
enum pane_lines pane_lines = window_pane_get_pane_lines(wp);
|
enum pane_lines pane_lines = window_pane_get_pane_lines(wp);
|
||||||
@@ -625,8 +623,7 @@ screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
|||||||
mask |= REDRAW_BORDER_L;
|
mask |= REDRAW_BORDER_L;
|
||||||
if (wx < right)
|
if (wx < right)
|
||||||
mask |= REDRAW_BORDER_R;
|
mask |= REDRAW_BORDER_R;
|
||||||
screen_redraw_mark_border_cell(bctx, wx, top, wp,
|
redraw_mark_border_cell(bctx, wx, top, wp, 0, 1, mask);
|
||||||
0, 1, mask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (draw_bottom) {
|
if (draw_bottom) {
|
||||||
@@ -636,8 +633,8 @@ screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
|||||||
mask |= REDRAW_BORDER_L;
|
mask |= REDRAW_BORDER_L;
|
||||||
if (wx < right)
|
if (wx < right)
|
||||||
mask |= REDRAW_BORDER_R;
|
mask |= REDRAW_BORDER_R;
|
||||||
screen_redraw_mark_border_cell(bctx, wx, bottom, wp,
|
redraw_mark_border_cell(bctx, wx, bottom, wp, 1, 0,
|
||||||
1, 0, mask);
|
mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (draw_left) {
|
if (draw_left) {
|
||||||
@@ -647,8 +644,7 @@ screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
|||||||
mask |= REDRAW_BORDER_U;
|
mask |= REDRAW_BORDER_U;
|
||||||
if (wy < bottom)
|
if (wy < bottom)
|
||||||
mask |= REDRAW_BORDER_D;
|
mask |= REDRAW_BORDER_D;
|
||||||
screen_redraw_mark_border_cell(bctx, left, wy, wp,
|
redraw_mark_border_cell(bctx, left, wy, wp, 0, 0, mask);
|
||||||
0, 0, mask);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (draw_right) {
|
if (draw_right) {
|
||||||
@@ -658,13 +654,13 @@ screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
|||||||
mask |= REDRAW_BORDER_U;
|
mask |= REDRAW_BORDER_U;
|
||||||
if (wy < bottom)
|
if (wy < bottom)
|
||||||
mask |= REDRAW_BORDER_D;
|
mask |= REDRAW_BORDER_D;
|
||||||
screen_redraw_mark_border_cell(bctx, right, wy, wp,
|
redraw_mark_border_cell(bctx, right, wy, wp, 0, 0,
|
||||||
0, 0, mask);
|
mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_redraw_mark_border_status(bctx, wp, left, right, top, bottom);
|
redraw_mark_border_status(bctx, wp, left, right, top, bottom);
|
||||||
screen_redraw_mark_border_arrows(bctx, wp, left, right, top, bottom);
|
redraw_mark_border_arrows(bctx, wp, left, right, top, bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -672,7 +668,7 @@ screen_redraw_mark_pane_borders(struct redraw_build_ctx *bctx,
|
|||||||
* already below them.
|
* already below them.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_pane(struct redraw_build_ctx *bctx, struct window_pane *wp)
|
redraw_mark_pane(struct redraw_build_ctx *bctx, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
int sb_w = 0, sb_left = 0;
|
int sb_w = 0, sb_left = 0;
|
||||||
|
|
||||||
@@ -684,15 +680,15 @@ screen_redraw_mark_pane(struct redraw_build_ctx *bctx, struct window_pane *wp)
|
|||||||
if (sb_w != 0 && bctx->sbp == PANE_SCROLLBARS_LEFT)
|
if (sb_w != 0 && bctx->sbp == PANE_SCROLLBARS_LEFT)
|
||||||
sb_left = 1;
|
sb_left = 1;
|
||||||
|
|
||||||
screen_redraw_reset_floating_pane_cells(bctx, wp, sb_w, sb_left);
|
redraw_reset_floating_pane_cells(bctx, wp, sb_w, sb_left);
|
||||||
screen_redraw_mark_pane_inside(bctx, wp);
|
redraw_mark_pane_inside(bctx, wp);
|
||||||
screen_redraw_mark_pane_borders(bctx, wp, sb_w, sb_left);
|
redraw_mark_pane_borders(bctx, wp, sb_w, sb_left);
|
||||||
screen_redraw_mark_pane_scrollbar(bctx, wp, sb_w, sb_left);
|
redraw_mark_pane_scrollbar(bctx, wp, sb_w, sb_left);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark the indicator. */
|
/* Mark the indicator. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_mark_two_pane_colours(struct redraw_build_ctx *bctx)
|
redraw_mark_two_pane_colours(struct redraw_build_ctx *bctx)
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc;
|
struct redraw_build_cell *bc;
|
||||||
struct redraw_span_data *sd;
|
struct redraw_span_data *sd;
|
||||||
@@ -701,12 +697,12 @@ screen_redraw_mark_two_pane_colours(struct redraw_build_ctx *bctx)
|
|||||||
|
|
||||||
if (bctx->ind != PANE_BORDER_COLOUR && bctx->ind != PANE_BORDER_BOTH)
|
if (bctx->ind != PANE_BORDER_COLOUR && bctx->ind != PANE_BORDER_BOTH)
|
||||||
return;
|
return;
|
||||||
if (!screen_redraw_two_panes(bctx->w, &type))
|
if (!redraw_two_panes(bctx->w, &type))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (y = 0; y < bctx->sy; y++) {
|
for (y = 0; y < bctx->sy; y++) {
|
||||||
for (x = 0; x < bctx->sx; x++) {
|
for (x = 0; x < bctx->sx; x++) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (bc->data.type != REDRAW_SPAN_BORDER)
|
if (bc->data.type != REDRAW_SPAN_BORDER)
|
||||||
continue;
|
continue;
|
||||||
sd = &bc->data;
|
sd = &bc->data;
|
||||||
@@ -735,7 +731,7 @@ screen_redraw_mark_two_pane_colours(struct redraw_build_ctx *bctx)
|
|||||||
|
|
||||||
/* Return true if two adjacent build data can be coalesced into one span. */
|
/* Return true if two adjacent build data can be coalesced into one span. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_data_cmp(struct redraw_build_cell *a, struct redraw_build_cell *b)
|
redraw_data_cmp(struct redraw_build_cell *a, struct redraw_build_cell *b)
|
||||||
{
|
{
|
||||||
struct redraw_span_data *ad = &a->data, *bd = &b->data;
|
struct redraw_span_data *ad = &a->data, *bd = &b->data;
|
||||||
|
|
||||||
@@ -788,8 +784,7 @@ screen_redraw_data_cmp(struct redraw_build_cell *a, struct redraw_build_cell *b)
|
|||||||
|
|
||||||
/* Convert the cells into spans. */
|
/* Convert the cells into spans. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_finish_scene(struct redraw_build_ctx *bctx,
|
redraw_finish_scene(struct redraw_build_ctx *bctx, struct redraw_scene *scene)
|
||||||
struct redraw_scene *scene)
|
|
||||||
{
|
{
|
||||||
struct redraw_build_cell *bc, *last;
|
struct redraw_build_cell *bc, *last;
|
||||||
struct redraw_line *line;
|
struct redraw_line *line;
|
||||||
@@ -802,17 +797,17 @@ screen_redraw_finish_scene(struct redraw_build_ctx *bctx,
|
|||||||
x = 0;
|
x = 0;
|
||||||
while (x < bctx->sx) {
|
while (x < bctx->sx) {
|
||||||
x0 = x;
|
x0 = x;
|
||||||
last = screen_redraw_cell(bctx, x, y);
|
last = redraw_cell(bctx, x, y);
|
||||||
x++;
|
x++;
|
||||||
|
|
||||||
while (x < bctx->sx) {
|
while (x < bctx->sx) {
|
||||||
bc = screen_redraw_cell(bctx, x, y);
|
bc = redraw_cell(bctx, x, y);
|
||||||
if (!screen_redraw_data_cmp(last, bc))
|
if (!redraw_data_cmp(last, bc))
|
||||||
break;
|
break;
|
||||||
last = bc;
|
last = bc;
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
bc = screen_redraw_cell(bctx, x0, y);
|
bc = redraw_cell(bctx, x0, y);
|
||||||
type = bc->data.type;
|
type = bc->data.type;
|
||||||
|
|
||||||
span = xcalloc(1, sizeof *span);
|
span = xcalloc(1, sizeof *span);
|
||||||
@@ -826,10 +821,10 @@ screen_redraw_finish_scene(struct redraw_build_ctx *bctx,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Build and return a redraw scene for a client. The caller owns the scene and
|
* Build and return a redraw scene for a client. The caller owns the scene and
|
||||||
* must free it with screen_redraw_free_scene.
|
* must free it with redraw_free_scene.
|
||||||
*/
|
*/
|
||||||
static struct redraw_scene *
|
static struct redraw_scene *
|
||||||
screen_redraw_make_scene(struct client *c)
|
redraw_make_scene(struct client *c)
|
||||||
{
|
{
|
||||||
struct redraw_build_ctx bctx;
|
struct redraw_build_ctx bctx;
|
||||||
struct redraw_scene *scene;
|
struct redraw_scene *scene;
|
||||||
@@ -839,7 +834,7 @@ screen_redraw_make_scene(struct client *c)
|
|||||||
|
|
||||||
if (c->flags & CLIENT_SUSPENDED)
|
if (c->flags & CLIENT_SUSPENDED)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
screen_redraw_set_context(c, &bctx);
|
redraw_set_context(c, &bctx);
|
||||||
|
|
||||||
scene = xcalloc(1, sizeof *scene);
|
scene = xcalloc(1, sizeof *scene);
|
||||||
scene->c = c;
|
scene->c = c;
|
||||||
@@ -862,22 +857,22 @@ screen_redraw_make_scene(struct client *c)
|
|||||||
if (bctx.sx != 0 && bctx.sy > SIZE_MAX / bctx.sx)
|
if (bctx.sx != 0 && bctx.sy > SIZE_MAX / bctx.sx)
|
||||||
fatalx("%s: too many cells", __func__);
|
fatalx("%s: too many cells", __func__);
|
||||||
ncells = (size_t)bctx.sx * bctx.sy;
|
ncells = (size_t)bctx.sx * bctx.sy;
|
||||||
if (ncells > screen_redraw_ncells) {
|
if (ncells > redraw_ncells) {
|
||||||
screen_redraw_cells = xreallocarray(screen_redraw_cells, ncells,
|
redraw_cells = xreallocarray(redraw_cells, ncells,
|
||||||
sizeof *screen_redraw_cells);
|
sizeof *redraw_cells);
|
||||||
screen_redraw_ncells = ncells;
|
redraw_ncells = ncells;
|
||||||
}
|
}
|
||||||
bctx.cells = screen_redraw_cells;
|
bctx.cells = redraw_cells;
|
||||||
for (y = 0; y < bctx.sy; y++) {
|
for (y = 0; y < bctx.sy; y++) {
|
||||||
for (x = 0; x < bctx.sx; x++)
|
for (x = 0; x < bctx.sx; x++)
|
||||||
screen_redraw_reset_cell(&bctx, x, y);
|
redraw_reset_cell(&bctx, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH_REVERSE(wp, &bctx.w->z_index, window_panes_zindex, zentry)
|
TAILQ_FOREACH_REVERSE(wp, &bctx.w->z_index, window_panes_zindex, zentry)
|
||||||
screen_redraw_mark_pane(&bctx, wp);
|
redraw_mark_pane(&bctx, wp);
|
||||||
|
|
||||||
screen_redraw_mark_two_pane_colours(&bctx);
|
redraw_mark_two_pane_colours(&bctx);
|
||||||
screen_redraw_finish_scene(&bctx, scene);
|
redraw_finish_scene(&bctx, scene);
|
||||||
log_debug("%s: finished @%u scene build", c->name, scene->w->id);
|
log_debug("%s: finished @%u scene build", c->name, scene->w->id);
|
||||||
|
|
||||||
return (scene);
|
return (scene);
|
||||||
@@ -885,7 +880,7 @@ screen_redraw_make_scene(struct client *c)
|
|||||||
|
|
||||||
/* Free a scene. */
|
/* Free a scene. */
|
||||||
void
|
void
|
||||||
screen_redraw_free_scene(struct redraw_scene *scene)
|
redraw_free_scene(struct redraw_scene *scene)
|
||||||
{
|
{
|
||||||
struct redraw_spans *spans;
|
struct redraw_spans *spans;
|
||||||
struct redraw_span *span, *span1;
|
struct redraw_span *span, *span1;
|
||||||
@@ -909,24 +904,24 @@ screen_redraw_free_scene(struct redraw_scene *scene)
|
|||||||
|
|
||||||
/* Mark a window's cached redraw scenes as out of date. */
|
/* Mark a window's cached redraw scenes as out of date. */
|
||||||
void
|
void
|
||||||
screen_redraw_invalidate_scene(struct window *w)
|
redraw_invalidate_scene(struct window *w)
|
||||||
{
|
{
|
||||||
w->redraw_scene_generation++;
|
w->redraw_scene_generation++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark all cached redraw scenes as out of date. */
|
/* Mark all cached redraw scenes as out of date. */
|
||||||
void
|
void
|
||||||
screen_redraw_invalidate_all_scenes(void)
|
redraw_invalidate_all_scenes(void)
|
||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
|
|
||||||
RB_FOREACH(w, windows, &windows)
|
RB_FOREACH(w, windows, &windows)
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the cached redraw scene, rebuilding it if needed. */
|
/* Get the cached redraw scene, rebuilding it if needed. */
|
||||||
static struct redraw_scene *
|
static struct redraw_scene *
|
||||||
screen_redraw_get_scene(struct client *c)
|
redraw_get_scene(struct client *c)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = c->redraw_scene;
|
struct redraw_scene *scene = c->redraw_scene;
|
||||||
struct window *w = c->session->curw->window;
|
struct window *w = c->session->curw->window;
|
||||||
@@ -946,8 +941,8 @@ screen_redraw_get_scene(struct client *c)
|
|||||||
reason = "size changed";
|
reason = "size changed";
|
||||||
if (reason != NULL) {
|
if (reason != NULL) {
|
||||||
log_debug("%s: @%u scene invalid: %s", c->name, w->id, reason);
|
log_debug("%s: @%u scene invalid: %s", c->name, w->id, reason);
|
||||||
screen_redraw_free_scene(scene);
|
redraw_free_scene(scene);
|
||||||
scene = screen_redraw_make_scene(c);
|
scene = redraw_make_scene(c);
|
||||||
c->redraw_scene = scene;
|
c->redraw_scene = scene;
|
||||||
}
|
}
|
||||||
return (scene);
|
return (scene);
|
||||||
@@ -955,7 +950,7 @@ screen_redraw_get_scene(struct client *c)
|
|||||||
|
|
||||||
/* Is this span adjacent to this pane? */
|
/* Is this span adjacent to this pane? */
|
||||||
static int
|
static int
|
||||||
screen_redraw_span_has_pane(struct redraw_span *span, struct window_pane *wp)
|
redraw_span_has_pane(struct redraw_span *span, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
if (span->data.b.top_wp == wp)
|
if (span->data.b.top_wp == wp)
|
||||||
return (1);
|
return (1);
|
||||||
@@ -970,7 +965,7 @@ screen_redraw_span_has_pane(struct redraw_span *span, struct window_pane *wp)
|
|||||||
|
|
||||||
/* Draw a pane span. */
|
/* Draw a pane span. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_pane_span(struct redraw_draw_ctx *dctx,
|
redraw_draw_pane_span(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span, u_int x, u_int y, u_int n)
|
struct redraw_span *span, u_int x, u_int y, u_int n)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -994,7 +989,7 @@ screen_redraw_draw_pane_span(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Get style for cells without a pane. */
|
/* Get style for cells without a pane. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_get_default_border_style(struct redraw_draw_ctx *dctx,
|
redraw_get_default_border_style(struct redraw_draw_ctx *dctx,
|
||||||
struct grid_cell *gc)
|
struct grid_cell *gc)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1019,7 +1014,7 @@ screen_redraw_get_default_border_style(struct redraw_draw_ctx *dctx,
|
|||||||
* then any adjacent pane.
|
* then any adjacent pane.
|
||||||
*/
|
*/
|
||||||
static struct window_pane *
|
static struct window_pane *
|
||||||
screen_redraw_get_pane_for_border_style(struct redraw_draw_ctx *dctx,
|
redraw_get_pane_for_border_style(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span)
|
struct redraw_span *span)
|
||||||
{
|
{
|
||||||
struct window_pane *active = dctx->active;
|
struct window_pane *active = dctx->active;
|
||||||
@@ -1029,7 +1024,7 @@ screen_redraw_get_pane_for_border_style(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
if (span->data.b.style_wp != NULL)
|
if (span->data.b.style_wp != NULL)
|
||||||
return (span->data.b.style_wp);
|
return (span->data.b.style_wp);
|
||||||
if (active != NULL && screen_redraw_span_has_pane(span, active))
|
if (active != NULL && redraw_span_has_pane(span, active))
|
||||||
return (active);
|
return (active);
|
||||||
|
|
||||||
if (span->data.b.top_wp != NULL)
|
if (span->data.b.top_wp != NULL)
|
||||||
@@ -1045,7 +1040,7 @@ screen_redraw_get_pane_for_border_style(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw arrow indicator if this border span is an arrow cell. */
|
/* Draw arrow indicator if this border span is an arrow cell. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_border_arrow(struct redraw_draw_ctx *dctx,
|
redraw_draw_border_arrow(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span, struct grid_cell *gc)
|
struct redraw_span *span, struct grid_cell *gc)
|
||||||
{
|
{
|
||||||
struct window_pane *active = dctx->active;
|
struct window_pane *active = dctx->active;
|
||||||
@@ -1073,7 +1068,7 @@ screen_redraw_draw_border_arrow(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw a border span. */
|
/* Draw a border span. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_border_span(struct redraw_draw_ctx *dctx,
|
redraw_draw_border_span(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span, u_int x, u_int y, u_int n)
|
struct redraw_span *span, u_int x, u_int y, u_int n)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1090,13 +1085,13 @@ screen_redraw_draw_border_span(struct redraw_draw_ctx *dctx,
|
|||||||
if (span->data.type != REDRAW_SPAN_BORDER)
|
if (span->data.type != REDRAW_SPAN_BORDER)
|
||||||
cell_type = CELL_NONE;
|
cell_type = CELL_NONE;
|
||||||
else {
|
else {
|
||||||
wp = screen_redraw_get_pane_for_border_style(dctx, span);
|
wp = redraw_get_pane_for_border_style(dctx, span);
|
||||||
cell_type = span->data.b.cell_type;
|
cell_type = span->data.b.cell_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wp == NULL) {
|
if (wp == NULL) {
|
||||||
pane_lines = options_get_number(oo, "pane-border-lines");
|
pane_lines = options_get_number(oo, "pane-border-lines");
|
||||||
screen_redraw_get_default_border_style(dctx, &gc);
|
redraw_get_default_border_style(dctx, &gc);
|
||||||
window_get_border_cell(w, NULL, pane_lines, cell_type, &gc);
|
window_get_border_cell(w, NULL, pane_lines, cell_type, &gc);
|
||||||
} else {
|
} else {
|
||||||
window_pane_get_border_style(wp, c, &gc);
|
window_pane_get_border_style(wp, c, &gc);
|
||||||
@@ -1105,9 +1100,9 @@ screen_redraw_draw_border_span(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
if (span->data.type == REDRAW_SPAN_BORDER &&
|
if (span->data.type == REDRAW_SPAN_BORDER &&
|
||||||
dctx->marked != NULL &&
|
dctx->marked != NULL &&
|
||||||
screen_redraw_span_has_pane(span, dctx->marked))
|
redraw_span_has_pane(span, dctx->marked))
|
||||||
gc.attr ^= GRID_ATTR_REVERSE;
|
gc.attr ^= GRID_ATTR_REVERSE;
|
||||||
screen_redraw_draw_border_arrow(dctx, span, &gc);
|
redraw_draw_border_arrow(dctx, span, &gc);
|
||||||
|
|
||||||
if (cell_type == CELL_UD && (dctx->flags & REDRAW_ISOLATES))
|
if (cell_type == CELL_UD && (dctx->flags & REDRAW_ISOLATES))
|
||||||
isolates = 1;
|
isolates = 1;
|
||||||
@@ -1122,7 +1117,7 @@ screen_redraw_draw_border_span(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw a pane status span. */
|
/* Draw a pane status span. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_status_span(struct redraw_draw_ctx *dctx,
|
redraw_draw_status_span(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span, u_int x, u_int y, u_int n)
|
struct redraw_span *span, u_int x, u_int y, u_int n)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1142,7 +1137,7 @@ screen_redraw_draw_status_span(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw a scrollbar span. */
|
/* Draw a scrollbar span. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_scrollbar_span(struct redraw_draw_ctx *dctx,
|
redraw_draw_scrollbar_span(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_span *span, u_int x, u_int y, u_int n)
|
struct redraw_span *span, u_int x, u_int y, u_int n)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1219,7 +1214,7 @@ screen_redraw_draw_scrollbar_span(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw a span. */
|
/* Draw a span. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_span(struct redraw_draw_ctx *dctx, struct redraw_span *span,
|
redraw_draw_span(struct redraw_draw_ctx *dctx, struct redraw_span *span,
|
||||||
u_int y)
|
u_int y)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1244,18 +1239,18 @@ screen_redraw_draw_span(struct redraw_draw_ctx *dctx, struct redraw_span *span,
|
|||||||
|
|
||||||
switch (span->data.type) {
|
switch (span->data.type) {
|
||||||
case REDRAW_SPAN_PANE:
|
case REDRAW_SPAN_PANE:
|
||||||
screen_redraw_draw_pane_span(dctx, span, x, y, n);
|
redraw_draw_pane_span(dctx, span, x, y, n);
|
||||||
break;
|
break;
|
||||||
case REDRAW_SPAN_BORDER:
|
case REDRAW_SPAN_BORDER:
|
||||||
case REDRAW_SPAN_EMPTY:
|
case REDRAW_SPAN_EMPTY:
|
||||||
case REDRAW_SPAN_OUTSIDE:
|
case REDRAW_SPAN_OUTSIDE:
|
||||||
screen_redraw_draw_border_span(dctx, span, x, y, n);
|
redraw_draw_border_span(dctx, span, x, y, n);
|
||||||
break;
|
break;
|
||||||
case REDRAW_SPAN_STATUS:
|
case REDRAW_SPAN_STATUS:
|
||||||
screen_redraw_draw_status_span(dctx, span, x, y, n);
|
redraw_draw_status_span(dctx, span, x, y, n);
|
||||||
break;
|
break;
|
||||||
case REDRAW_SPAN_SCROLLBAR:
|
case REDRAW_SPAN_SCROLLBAR:
|
||||||
screen_redraw_draw_scrollbar_span(dctx, span, x, y, n);
|
redraw_draw_scrollbar_span(dctx, span, x, y, n);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1263,8 +1258,8 @@ screen_redraw_draw_span(struct redraw_draw_ctx *dctx, struct redraw_span *span,
|
|||||||
|
|
||||||
/* Draw pane lines. */
|
/* Draw pane lines. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_pane_lines(struct redraw_draw_ctx *dctx,
|
redraw_draw_pane_lines(struct redraw_draw_ctx *dctx, struct window_pane *wp,
|
||||||
struct window_pane *wp, int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
struct redraw_line *line;
|
struct redraw_line *line;
|
||||||
@@ -1292,14 +1287,14 @@ screen_redraw_draw_pane_lines(struct redraw_draw_ctx *dctx,
|
|||||||
spans = &line->spans[REDRAW_SPAN_PANE];
|
spans = &line->spans[REDRAW_SPAN_PANE];
|
||||||
TAILQ_FOREACH(span, spans, entry) {
|
TAILQ_FOREACH(span, spans, entry) {
|
||||||
if (span->data.p.wp == wp)
|
if (span->data.p.wp == wp)
|
||||||
screen_redraw_draw_span(dctx, span, cy);
|
redraw_draw_span(dctx, span, cy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flags & REDRAW_PANE_SCROLLBAR) {
|
if (flags & REDRAW_PANE_SCROLLBAR) {
|
||||||
spans = &line->spans[REDRAW_SPAN_SCROLLBAR];
|
spans = &line->spans[REDRAW_SPAN_SCROLLBAR];
|
||||||
TAILQ_FOREACH(span, spans, entry) {
|
TAILQ_FOREACH(span, spans, entry) {
|
||||||
if (span->data.sb.wp == wp)
|
if (span->data.sb.wp == wp)
|
||||||
screen_redraw_draw_span(dctx, span, cy);
|
redraw_draw_span(dctx, span, cy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1307,7 +1302,7 @@ screen_redraw_draw_pane_lines(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw lines. */
|
/* Draw lines. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw_lines(struct redraw_draw_ctx *dctx, int flags)
|
redraw_draw_lines(struct redraw_draw_ctx *dctx, int flags)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
struct redraw_line *line;
|
struct redraw_line *line;
|
||||||
@@ -1354,14 +1349,14 @@ screen_redraw_draw_lines(struct redraw_draw_ctx *dctx, int flags)
|
|||||||
}
|
}
|
||||||
spans = &line->spans[type];
|
spans = &line->spans[type];
|
||||||
TAILQ_FOREACH(span, spans, entry)
|
TAILQ_FOREACH(span, spans, entry)
|
||||||
screen_redraw_draw_span(dctx, span, cy);
|
redraw_draw_span(dctx, span, cy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get line for pane status line. */
|
/* Get line for pane status line. */
|
||||||
static int
|
static int
|
||||||
screen_redraw_pane_status_line(struct redraw_draw_ctx *dctx,
|
redraw_pane_status_line(struct redraw_draw_ctx *dctx,
|
||||||
struct window_pane *wp, u_int *line)
|
struct window_pane *wp, u_int *line)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
@@ -1385,14 +1380,14 @@ screen_redraw_pane_status_line(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Get available width for pane status line. */
|
/* Get available width for pane status line. */
|
||||||
static u_int
|
static u_int
|
||||||
screen_redraw_pane_status_width(struct redraw_draw_ctx *dctx,
|
redraw_pane_status_width(struct redraw_draw_ctx *dctx,
|
||||||
struct window_pane *wp, struct redraw_span **first)
|
struct window_pane *wp, struct redraw_span **first)
|
||||||
{
|
{
|
||||||
struct redraw_scene *scene = dctx->scene;
|
struct redraw_scene *scene = dctx->scene;
|
||||||
struct redraw_span *span;
|
struct redraw_span *span;
|
||||||
u_int y, width = 0, end;
|
u_int y, width = 0, end;
|
||||||
|
|
||||||
if (!screen_redraw_pane_status_line(dctx, wp, &y))
|
if (!redraw_pane_status_line(dctx, wp, &y))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
*first = NULL;
|
*first = NULL;
|
||||||
@@ -1410,7 +1405,7 @@ screen_redraw_pane_status_width(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Set up draw context. */
|
/* Set up draw context. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_set_draw_context(struct redraw_draw_ctx *dctx,
|
redraw_set_draw_context(struct redraw_draw_ctx *dctx,
|
||||||
struct redraw_scene *scene)
|
struct redraw_scene *scene)
|
||||||
{
|
{
|
||||||
struct client *c = scene->c;
|
struct client *c = scene->c;
|
||||||
@@ -1437,7 +1432,7 @@ screen_redraw_set_draw_context(struct redraw_draw_ctx *dctx,
|
|||||||
|
|
||||||
/* Draw scene to client. */
|
/* Draw scene to client. */
|
||||||
static void
|
static void
|
||||||
screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
||||||
{
|
{
|
||||||
struct redraw_draw_ctx dctx;
|
struct redraw_draw_ctx dctx;
|
||||||
struct session *s = c->session;
|
struct session *s = c->session;
|
||||||
@@ -1469,13 +1464,13 @@ screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
|||||||
|
|
||||||
if (log_get_level() != 0) {
|
if (log_get_level() != 0) {
|
||||||
log_debug("%s: starting @%u redraw (%s)", c->name, w->id,
|
log_debug("%s: starting @%u redraw (%s)", c->name, w->id,
|
||||||
screen_redraw_flags_string(flags));
|
redraw_flags_string(flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
scene = screen_redraw_get_scene(c);
|
scene = redraw_get_scene(c);
|
||||||
if (scene == NULL)
|
if (scene == NULL)
|
||||||
return;
|
return;
|
||||||
screen_redraw_set_draw_context(&dctx, scene);
|
redraw_set_draw_context(&dctx, scene);
|
||||||
|
|
||||||
if (flags & (REDRAW_PANE_BORDER|REDRAW_PANE_STATUS)) {
|
if (flags & (REDRAW_PANE_BORDER|REDRAW_PANE_STATUS)) {
|
||||||
TAILQ_FOREACH(loop, &scene->w->panes, entry) {
|
TAILQ_FOREACH(loop, &scene->w->panes, entry) {
|
||||||
@@ -1492,7 +1487,7 @@ screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
|||||||
else
|
else
|
||||||
loop->flags &= ~PANE_NEWSTATUS;
|
loop->flags &= ~PANE_NEWSTATUS;
|
||||||
|
|
||||||
width = screen_redraw_pane_status_width(&dctx, loop,
|
width = redraw_pane_status_width(&dctx, loop,
|
||||||
&first);
|
&first);
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -1526,9 +1521,9 @@ screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
|||||||
tty_update_mode(tty, 0, NULL);
|
tty_update_mode(tty, 0, NULL);
|
||||||
|
|
||||||
if (wp != NULL)
|
if (wp != NULL)
|
||||||
screen_redraw_draw_pane_lines(&dctx, wp, flags);
|
redraw_draw_pane_lines(&dctx, wp, flags);
|
||||||
else
|
else
|
||||||
screen_redraw_draw_lines(&dctx, flags);
|
redraw_draw_lines(&dctx, flags);
|
||||||
|
|
||||||
if (flags & REDRAW_STATUS) {
|
if (flags & REDRAW_STATUS) {
|
||||||
lines = dctx.status_lines;
|
lines = dctx.status_lines;
|
||||||
@@ -1554,7 +1549,7 @@ screen_redraw_draw(struct client *c, struct window_pane *wp, int flags)
|
|||||||
|
|
||||||
/* Get border cell type beneath status cell at offset x in pane status line. */
|
/* Get border cell type beneath status cell at offset x in pane status line. */
|
||||||
int
|
int
|
||||||
screen_redraw_get_status_border_cell_type(struct redraw_span **spanp, u_int x)
|
redraw_get_status_border_cell_type(struct redraw_span **spanp, u_int x)
|
||||||
{
|
{
|
||||||
struct redraw_span *span = *spanp;
|
struct redraw_span *span = *spanp;
|
||||||
struct window_pane *wp;
|
struct window_pane *wp;
|
||||||
@@ -1588,12 +1583,12 @@ screen_redraw_get_status_border_cell_type(struct redraw_span **spanp, u_int x)
|
|||||||
|
|
||||||
/* Draw screen. */
|
/* Draw screen. */
|
||||||
void
|
void
|
||||||
screen_redraw_screen(struct client *c)
|
redraw_screen(struct client *c)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
if (c->flags & CLIENT_REDRAWWINDOW)
|
if (c->flags & CLIENT_REDRAWWINDOW)
|
||||||
screen_redraw_draw(c, NULL, REDRAW_ALL);
|
redraw_draw(c, NULL, REDRAW_ALL);
|
||||||
else {
|
else {
|
||||||
if (c->flags & CLIENT_REDRAWBORDERS)
|
if (c->flags & CLIENT_REDRAWBORDERS)
|
||||||
flags |= (REDRAW_PANE_BORDER|REDRAW_PANE_STATUS);
|
flags |= (REDRAW_PANE_BORDER|REDRAW_PANE_STATUS);
|
||||||
@@ -1602,20 +1597,20 @@ screen_redraw_screen(struct client *c)
|
|||||||
if (c->flags & CLIENT_REDRAWOVERLAY)
|
if (c->flags & CLIENT_REDRAWOVERLAY)
|
||||||
flags |= REDRAW_OVERLAY;
|
flags |= REDRAW_OVERLAY;
|
||||||
if (flags != 0)
|
if (flags != 0)
|
||||||
screen_redraw_draw(c, NULL, flags);
|
redraw_draw(c, NULL, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a single pane. */
|
/* Draw a single pane. */
|
||||||
void
|
void
|
||||||
screen_redraw_pane(struct client *c, struct window_pane *wp)
|
redraw_pane(struct client *c, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
screen_redraw_draw(c, wp, REDRAW_PANE|REDRAW_PANE_SCROLLBAR);
|
redraw_draw(c, wp, REDRAW_PANE|REDRAW_PANE_SCROLLBAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw a pane's scrollbar. */
|
/* Draw a pane's scrollbar. */
|
||||||
void
|
void
|
||||||
screen_redraw_pane_scrollbar(struct client *c, struct window_pane *wp)
|
redraw_pane_scrollbar(struct client *c, struct window_pane *wp)
|
||||||
{
|
{
|
||||||
screen_redraw_draw(c, wp, REDRAW_PANE_SCROLLBAR);
|
redraw_draw(c, wp, REDRAW_PANE_SCROLLBAR);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -530,7 +530,7 @@ server_client_free(__unused int fd, __unused short events, void *arg)
|
|||||||
|
|
||||||
log_debug("free client %p (%d references)", c, c->references);
|
log_debug("free client %p (%d references)", c, c->references);
|
||||||
|
|
||||||
screen_redraw_free_scene(c->redraw_scene);
|
redraw_free_scene(c->redraw_scene);
|
||||||
cmdq_free(c->queue);
|
cmdq_free(c->queue);
|
||||||
|
|
||||||
if (c->references == 0) {
|
if (c->references == 0) {
|
||||||
@@ -2102,11 +2102,11 @@ server_client_check_redraw(struct client *c)
|
|||||||
if (wp->flags & PANE_REDRAW) {
|
if (wp->flags & PANE_REDRAW) {
|
||||||
log_debug("%s: redraw pane %%%u", __func__,
|
log_debug("%s: redraw pane %%%u", __func__,
|
||||||
wp->id);
|
wp->id);
|
||||||
screen_redraw_pane(c, wp);
|
redraw_pane(c, wp);
|
||||||
} else if (wp->flags & PANE_REDRAWSCROLLBAR) {
|
} else if (wp->flags & PANE_REDRAWSCROLLBAR) {
|
||||||
log_debug("%s: redraw scrollbar %%%u", __func__,
|
log_debug("%s: redraw scrollbar %%%u", __func__,
|
||||||
wp->id);
|
wp->id);
|
||||||
screen_redraw_pane_scrollbar(c, wp);
|
redraw_pane_scrollbar(c, wp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2121,7 +2121,7 @@ server_client_check_redraw(struct client *c)
|
|||||||
server_client_set_path(c);
|
server_client_set_path(c);
|
||||||
}
|
}
|
||||||
server_client_set_progress_bar(c);
|
server_client_set_progress_bar(c);
|
||||||
screen_redraw_screen(c);
|
redraw_screen(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Put the tty back how it was. */
|
/* Put the tty back how it was. */
|
||||||
|
|||||||
14
tmux.h
14
tmux.h
@@ -3367,13 +3367,13 @@ void screen_write_alternateoff(struct screen_write_ctx *,
|
|||||||
struct grid_cell *, int);
|
struct grid_cell *, int);
|
||||||
|
|
||||||
/* screen-redraw.c */
|
/* screen-redraw.c */
|
||||||
void screen_redraw_screen(struct client *);
|
void redraw_screen(struct client *);
|
||||||
void screen_redraw_pane(struct client *, struct window_pane *);
|
void redraw_pane(struct client *, struct window_pane *);
|
||||||
void screen_redraw_pane_scrollbar(struct client *, struct window_pane *);
|
void redraw_pane_scrollbar(struct client *, struct window_pane *);
|
||||||
void screen_redraw_free_scene(struct redraw_scene *);
|
void redraw_free_scene(struct redraw_scene *);
|
||||||
void screen_redraw_invalidate_scene(struct window *);
|
void redraw_invalidate_scene(struct window *);
|
||||||
void screen_redraw_invalidate_all_scenes(void);
|
void redraw_invalidate_all_scenes(void);
|
||||||
int screen_redraw_get_status_border_cell_type(struct redraw_span **, u_int);
|
int redraw_get_status_border_cell_type(struct redraw_span **, u_int);
|
||||||
|
|
||||||
/* screen.c */
|
/* screen.c */
|
||||||
void screen_init(struct screen *, u_int, u_int, u_int);
|
void screen_init(struct screen *, u_int, u_int, u_int);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ window_make_pane_status(struct window_pane *wp, struct client *c, u_int width,
|
|||||||
window_pane_get_border_style(wp, c, &gc);
|
window_pane_get_border_style(wp, c, &gc);
|
||||||
pane_lines = window_pane_get_pane_lines(wp);
|
pane_lines = window_pane_get_pane_lines(wp);
|
||||||
for (i = 0; i < width; i++) {
|
for (i = 0; i < width; i++) {
|
||||||
cell_type = screen_redraw_get_status_border_cell_type(&span, i);
|
cell_type = redraw_get_status_border_cell_type(&span, i);
|
||||||
window_get_border_cell(wp->window, wp, pane_lines, cell_type, &gc);
|
window_get_border_cell(wp->window, wp, pane_lines, cell_type, &gc);
|
||||||
screen_write_cell(&ctx, &gc);
|
screen_write_cell(&ctx, &gc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ window_copy_scroll1(struct window_mode_entry *wme, struct window_pane *wp,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See screen_redraw_draw_pane_scrollbar - this is the inverse of the
|
* See redraw_draw_pane_scrollbar - this is the inverse of the
|
||||||
* formula used there.
|
* formula used there.
|
||||||
*/
|
*/
|
||||||
new_offset = new_slider_y * ((float)(size + sb_height) / sb_height);
|
new_offset = new_slider_y * ((float)(size + sb_height) / sb_height);
|
||||||
|
|||||||
10
window.c
10
window.c
@@ -758,7 +758,7 @@ window_zoom(struct window_pane *wp)
|
|||||||
w->flags |= WINDOW_ZOOMED;
|
w->flags |= WINDOW_ZOOMED;
|
||||||
notify_window("window-layout-changed", w);
|
notify_window("window-layout-changed", w);
|
||||||
|
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,7 +785,7 @@ window_unzoom(struct window *w, int notify)
|
|||||||
if (notify)
|
if (notify)
|
||||||
notify_window("window-layout-changed", w);
|
notify_window("window-layout-changed", w);
|
||||||
|
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -842,7 +842,7 @@ window_add_pane(struct window *w, struct window_pane *other, u_int hlimit,
|
|||||||
else {
|
else {
|
||||||
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
|
TAILQ_INSERT_HEAD(&w->z_index, wp, zentry);
|
||||||
}
|
}
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
return (wp);
|
return (wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -869,7 +869,7 @@ window_lost_pane(struct window *w, struct window_pane *wp)
|
|||||||
window_update_focus(w);
|
window_update_focus(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -878,7 +878,7 @@ window_remove_pane(struct window *w, struct window_pane *wp)
|
|||||||
window_lost_pane(w, wp);
|
window_lost_pane(w, wp);
|
||||||
TAILQ_REMOVE(&w->panes, wp, entry);
|
TAILQ_REMOVE(&w->panes, wp, entry);
|
||||||
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
TAILQ_REMOVE(&w->z_index, wp, zentry);
|
||||||
screen_redraw_invalidate_scene(w);
|
redraw_invalidate_scene(w);
|
||||||
window_pane_destroy(wp);
|
window_pane_destroy(wp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user