Adding sixel support ref. #7

This commit is contained in:
bakkeby 2021-03-10 18:09:47 +01:00
parent 884c62a056
commit f31c43015d
17 changed files with 1260 additions and 156 deletions

18
patch/sixel_st.c Normal file
View file

@ -0,0 +1,18 @@
sixel_state_t sixel_st;
void
dcshandle(void)
{
switch (csiescseq.mode[0]) {
default:
fprintf(stderr, "erresc: unknown csi ");
csidump();
/* die(""); */
break;
case 'q': /* DECSIXEL */
if (sixel_parser_init(&sixel_st, 0, 0 << 16 | 0 << 8 | 0, 1, win.cw, win.ch) != 0)
perror("sixel_parser_init() failed");
term.mode |= MODE_SIXEL;
break;
}
}

1
patch/sixel_st.h Normal file
View file

@ -0,0 +1 @@
static void dcshandle(void);

14
patch/sixel_x.c Normal file
View file

@ -0,0 +1,14 @@
void
delete_image(ImageList *im)
{
if (im->prev)
im->prev->next = im->next;
else
term.images = im->next;
if (im->next)
im->next->prev = im->prev;
if (im->pixmap)
XFreePixmap(xw.dpy, (Drawable)im->pixmap);
free(im->pixels);
free(im);
}

View file

@ -19,4 +19,7 @@
#endif
#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
#include "scrollback.c"
#endif
#if SIXEL_PATCH
#include "sixel_st.c"
#endif

View file

@ -19,4 +19,7 @@
#endif
#if SCROLLBACK_PATCH || SCROLLBACK_MOUSE_PATCH || SCROLLBACK_MOUSE_ALTSCREEN_PATCH
#include "scrollback.h"
#endif
#if SIXEL_PATCH
#include "sixel_st.h"
#endif

View file

@ -20,6 +20,9 @@
#if RIGHTCLICKTOPLUMB_PATCH
#include "rightclicktoplumb_x.c"
#endif
#if SIXEL_PATCH
#include "sixel_x.c"
#endif
#if ST_EMBEDDER_PATCH
#include "st_embedder_x.c"
#endif