diff --git a/image.c b/image.c index 7281cd3ae..4923a180b 100644 --- a/image.c +++ b/image.c @@ -82,9 +82,6 @@ static u_int image_next_id; static u_short image_next_grid_id; static struct image *image_grid_ids[USHRT_MAX + 1]; -#define IMAGE_BACKEND_GRAPHICAL 0x1 -#define IMAGE_BACKEND_SCROLLS 0x2 - struct image_backend { const char *name; int flags; @@ -130,20 +127,12 @@ image_tty_update(struct tty *tty) tty->client->name, backend->name); } -/* Return if a terminal can draw graphical images. */ +/* Return the flags for a terminal's image backend. */ int -image_tty_is_graphical(struct tty *tty) +image_backend_flags(struct tty *tty) { image_tty_update(tty); - return (!!(tty->image_backend->flags & IMAGE_BACKEND_GRAPHICAL)); -} - -/* Return if image output advances the terminal screen. */ -int -image_tty_scrolls(struct tty *tty) -{ - image_tty_update(tty); - return (!!(tty->image_backend->flags & IMAGE_BACKEND_SCROLLS)); + return (tty->image_backend->flags); } /* Discard image backend state after a terminal geometry change. */ diff --git a/tmux.h b/tmux.h index b69772afd..9d346dc7c 100644 --- a/tmux.h +++ b/tmux.h @@ -4238,6 +4238,9 @@ char *regsub(const char *, const char *, const char *, int); #ifdef ENABLE_IMAGES /* image.c */ +#define IMAGE_BACKEND_GRAPHICAL 0x1 +#define IMAGE_BACKEND_SCROLLS 0x2 + struct image *image_create(u_int, u_int, u_int, u_int, u_int, u_int, u_char *); struct image *image_find(u_int); @@ -4269,8 +4272,7 @@ void image_redraw_area(struct screen_write_ctx *, u_int, u_int, u_int, u_int); void image_redraw_all(struct screen_write_ctx *); void image_redraw_scroll(struct screen_write_ctx *, u_int); -int image_tty_is_graphical(struct tty *); -int image_tty_scrolls(struct tty *); +int image_backend_flags(struct tty *); void image_tty_update(struct tty *); void image_tty_geometry_changed(struct tty *); void image_tty_free(struct tty *, int); diff --git a/tty-draw.c b/tty-draw.c index ff3f6148c..d06def59b 100644 --- a/tty-draw.c +++ b/tty-draw.c @@ -264,7 +264,8 @@ tty_draw_line(struct tty *tty, struct screen *s, u_int px, u_int py, u_int nx, */ if (gc.flags & GRID_FLAG_IMAGE) { im = image_find(gc.image_id); - if (image_tty_is_graphical(tty)) { + if (image_backend_flags(tty) & + IMAGE_BACKEND_GRAPHICAL) { memcpy(&image_gc, &gc, sizeof image_gc); image_gc.flags &= ~(GRID_FLAG_IMAGE| diff --git a/tty.c b/tty.c index 9481294aa..56ecabd89 100644 --- a/tty.c +++ b/tty.c @@ -2155,7 +2155,7 @@ tty_cell(struct tty *tty, const struct grid_cell *gc, * selection; the unchanged image would then need to be drawn again. */ if (gc->flags & GRID_FLAG_IMAGE) { - if (image_tty_is_graphical(tty)) + if (image_backend_flags(tty) & IMAGE_BACKEND_GRAPHICAL) return; im = image_find(gc->image_id); image_get_fallback_cell(tty, im, gc->image_x, gc->image_y, gc,