Try another way

pull/3592/head
topcat001 2023-05-14 15:43:02 -07:00
parent b77fbae29c
commit b1b0670225
1 changed files with 2 additions and 44 deletions

46
tty.c
View File

@ -71,8 +71,6 @@ static void tty_default_attributes(struct tty *, const struct grid_cell *,
static int tty_check_overlay(struct tty *, u_int, u_int);
static void tty_check_overlay_range(struct tty *, u_int, u_int, u_int,
struct overlay_ranges *);
static void tty_write_sixel(void (*)(struct tty *, const struct tty_ctx *),
struct tty_ctx *);
#define tty_use_margin(tty) \
(tty->term->flags & TERM_DECSLRM)
@ -1628,7 +1626,8 @@ tty_draw_images(struct tty *tty, struct window_pane *wp, struct screen *s)
ttyctx.ptr = im;
ttyctx.arg = wp;
ttyctx.set_client_cb = tty_set_client_cb;
tty_write_sixel(tty_cmd_sixelimage, &ttyctx);
ttyctx.allow_invisible_panes = 1;
tty_write(tty_cmd_sixelimage, &ttyctx);
}
}
@ -1705,47 +1704,6 @@ tty_write(void (*cmdfn)(struct tty *, const struct tty_ctx *),
}
}
static int
tty_client_ready_sixel(const struct tty_ctx *ctx, struct client *c)
{
if (c->session == NULL || c->tty.term == NULL)
return (0);
if (c->flags & CLIENT_SUSPENDED)
return (0);
/*
* If invisible panes are allowed (used for passthrough), don't care if
* redrawing or frozen.
*/
if (ctx->allow_invisible_panes)
return (1);
if (c->tty.flags & TTY_FREEZE)
return (0);
return (1);
}
static void
tty_write_sixel(void (*cmdfn)(struct tty *, const struct tty_ctx *),
struct tty_ctx *ctx)
{
struct client *c;
int state;
if (ctx->set_client_cb == NULL)
return;
TAILQ_FOREACH(c, &clients, entry) {
if (tty_client_ready_sixel(ctx, c)) {
state = ctx->set_client_cb(ctx, c);
if (state == -1)
break;
if (state == 0)
continue;
cmdfn(&c->tty, ctx);
}
}
}
void
tty_cmd_insertcharacter(struct tty *tty, const struct tty_ctx *ctx)
{