Fix build.

pull/3363/head
Nicholas Marriott 2021-10-07 13:59:08 +01:00
parent ebd2c58593
commit 6680a024be
3 changed files with 11 additions and 15 deletions

View File

@ -2137,7 +2137,7 @@ screen_write_sixelimage(struct screen_write_ctx *ctx, struct sixel_image *si,
for (i = 0; i < lines; i++) { for (i = 0; i < lines; i++) {
grid_view_scroll_region_up(gd, 0, screen_size_y(s) - 1, grid_view_scroll_region_up(gd, 0, screen_size_y(s) - 1,
bg); bg);
screen_write_collect_scroll(ctx); screen_write_collect_scroll(ctx, bg);
} }
ctx->scrolled += lines; ctx->scrolled += lines;
if (lines > cy) if (lines > cy)
@ -2145,11 +2145,11 @@ screen_write_sixelimage(struct screen_write_ctx *ctx, struct sixel_image *si,
else else
screen_write_cursormove(ctx, -1, cy - lines, 0); screen_write_cursormove(ctx, -1, cy - lines, 0);
} }
screen_write_collect_flush(ctx, 0); screen_write_collect_flush(ctx, 0, __func__);
image_store(s, si); image_store(s, si);
screen_write_initctx(ctx, &ttyctx); screen_write_initctx(ctx, &ttyctx, 0);
ttyctx.ptr = si; ttyctx.ptr = si;
tty_write(tty_cmd_sixelimage, &ttyctx); tty_write(tty_cmd_sixelimage, &ttyctx);

View File

@ -547,7 +547,7 @@ sixel_to_screen(struct sixel_image *si)
gc.attr |= (GRID_ATTR_CHARSET|GRID_ATTR_DIM); gc.attr |= (GRID_ATTR_CHARSET|GRID_ATTR_DIM);
utf8_set(&gc.data, '~'); utf8_set(&gc.data, '~');
screen_write_start(&ctx, NULL, s); screen_write_start(&ctx, s);
if (sx == 1 || sy == 1) { if (sx == 1 || sy == 1) {
for (y = 0; y < sy; y++) { for (y = 0; y < sy; y++) {
for (x = 0; x < sx; x++) for (x = 0; x < sx; x++)

18
tty.c
View File

@ -1500,6 +1500,7 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx,
void void
tty_draw_images(struct tty *tty, struct window_pane *wp, struct screen *s) tty_draw_images(struct tty *tty, struct window_pane *wp, struct screen *s)
{ {
#if 0 /* XXX */
struct client *c = tty->client; struct client *c = tty->client;
struct image *im; struct image *im;
struct tty_ctx ttyctx; struct tty_ctx ttyctx;
@ -1507,8 +1508,6 @@ tty_draw_images(struct tty *tty, struct window_pane *wp, struct screen *s)
TAILQ_FOREACH(im, &s->images, entry) { TAILQ_FOREACH(im, &s->images, entry) {
memset(&ttyctx, 0, sizeof ttyctx); memset(&ttyctx, 0, sizeof ttyctx);
ttyctx.wp = wp;
ttyctx.ocx = im->px; ttyctx.ocx = im->px;
ttyctx.ocy = im->py; ttyctx.ocy = im->py;
@ -1527,8 +1526,10 @@ tty_draw_images(struct tty *tty, struct window_pane *wp, struct screen *s)
ttyctx.ptr = im->data; ttyctx.ptr = im->data;
tty_cmd_sixelimage(tty, &ttyctx); tty_cmd_sixelimage(tty, &ttyctx);
} }
#endif
} }
void
tty_sync_start(struct tty *tty) tty_sync_start(struct tty *tty)
{ {
if (tty->flags & TTY_BLOCK) if (tty->flags & TTY_BLOCK)
@ -2072,25 +2073,20 @@ tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
void void
tty_cmd_sixelimage(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_sixelimage(struct tty *tty, const struct tty_ctx *ctx)
{ {
struct window_pane *wp = ctx->wp;
struct sixel_image *si = ctx->ptr; struct sixel_image *si = ctx->ptr;
struct sixel_image *new; struct sixel_image *new;
int flags = (tty->term->flags|tty->term_flags);
char *data; char *data;
size_t size; size_t size;
u_int cx = ctx->ocx, cy = ctx->ocy, sx, sy; u_int cx = ctx->ocx, cy = ctx->ocy, sx, sy;
u_int i, j, x, y, rx, ry; u_int i, j, x, y, rx, ry;
if ((~flags & TERM_SIXEL) && !tty_term_has(tty->term, TTYC_SXL)) if ((~tty->term->flags & TERM_SIXEL) &&
!tty_term_has(tty->term, TTYC_SXL))
return; return;
if (tty->xpixel == 0 || tty->ypixel == 0) if (tty->xpixel == 0 || tty->ypixel == 0)
return; return;
sixel_size_in_cells(si, &sx, &sy); sixel_size_in_cells(si, &sx, &sy);
if (sx > wp->sx - cx)
sx = wp->sx - cx;
if (sy > wp->sy - cy)
sy = wp->sy - cy;
log_debug("%s: image is %ux%u", __func__, sx, sy); log_debug("%s: image is %ux%u", __func__, sx, sy);
if (!tty_clamp_area(tty, ctx, cx, cy, sx, sy, &i, &j, &x, &y, &rx, &ry)) if (!tty_clamp_area(tty, ctx, cx, cy, sx, sy, &i, &j, &x, &y, &rx, &ry))
return; return;
@ -2115,7 +2111,7 @@ tty_cmd_sixelimage(struct tty *tty, const struct tty_ctx *ctx)
sixel_free(new); sixel_free(new);
} }
static void void
tty_cmd_syncstart(struct tty *tty, const struct tty_ctx *ctx) tty_cmd_syncstart(struct tty *tty, const struct tty_ctx *ctx)
{ {
if (ctx->num == 0x11) { if (ctx->num == 0x11) {
@ -2134,7 +2130,7 @@ tty_cmd_syncstart(struct tty *tty, const struct tty_ctx *ctx)
} }
} }
static void void
tty_cell(struct tty *tty, const struct grid_cell *gc, tty_cell(struct tty *tty, const struct grid_cell *gc,
const struct grid_cell *defaults, struct colour_palette *palette) const struct grid_cell *defaults, struct colour_palette *palette)
{ {