summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
Diffstat (limited to 'patches')
-rw-r--r--patches/st-alpha-0.8.1.diff183
-rw-r--r--patches/st-clipboard-20160727-308bfbf.diff13
-rw-r--r--patches/st-clipboard-20180309-c5ba9c0.diff13
-rw-r--r--patches/st-no_bold_colors-0.8.1.diff25
-rw-r--r--patches/st-no_bold_colors-20160727-308bfbf.diff13
-rw-r--r--patches/st-scrollback-0.8.diff (renamed from patches/st-scrollback-20170104-c63a87c.diff)181
-rw-r--r--patches/st-scrollback-mouse-0.8.diff (renamed from patches/st-scrollback-mouse-20161020-6e79e83.diff)41
-rw-r--r--patches/st-solarized-both-20160727-308bfbf.diff189
-rw-r--r--patches/transparency.diff189
9 files changed, 340 insertions, 507 deletions
diff --git a/patches/st-alpha-0.8.1.diff b/patches/st-alpha-0.8.1.diff
new file mode 100644
index 0000000..9dd26c3
--- /dev/null
+++ b/patches/st-alpha-0.8.1.diff
@@ -0,0 +1,183 @@
+diff --git a/config.def.h b/config.def.h
+index feec7e2..e373018 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -82,6 +82,9 @@ char *termname = "st-256color";
+ */
+ unsigned int tabspaces = 8;
+
++/* bg opacity */
++unsigned int alpha = 0xcd;
++
+ /* Terminal colors (16 first used in escape sequence) */
+ static const char *colorname[] = {
+ /* 8 normal colors */
+diff --git a/config.mk b/config.mk
+index 039c42c..3b00d7e 100644
+--- a/config.mk
++++ b/config.mk
+@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib
+ INCS = -I$(X11INC) \
+ `pkg-config --cflags fontconfig` \
+ `pkg-config --cflags freetype2`
+-LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
++LIBS = -L${X11LIB} -lm -lrt -lX11 -lutil -lXft -lXrender \
+ `pkg-config --libs fontconfig` \
+ `pkg-config --libs freetype2`
+
+diff --git a/st.h b/st.h
+index cdd25ae..850c5f0 100644
+--- a/st.h
++++ b/st.h
+@@ -134,6 +134,7 @@ extern char *worddelimiters;
+ extern int allowaltscreen;
+ extern char *termname;
+ extern unsigned int tabspaces;
++extern unsigned int alpha;
+ extern unsigned int defaultfg;
+ extern unsigned int defaultbg;
+ extern MouseKey mkeys[];
+diff --git a/win.h b/win.h
+index 31f327d..d277477 100644
+--- a/win.h
++++ b/win.h
+@@ -23,6 +23,10 @@ enum win_mode {
+ |MODE_MOUSEMANY,
+ };
+
++/* alpha */
++#define OPAQUE 0Xff
++#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL)
++
+ void xbell(void);
+ void xclipcopy(void);
+ void xdrawcursor(int, int, Glyph, int, int, Glyph);
+diff --git a/x.c b/x.c
+index f4a6be7..840d2fa 100644
+--- a/x.c
++++ b/x.c
+@@ -99,6 +99,7 @@ typedef struct {
+ XSetWindowAttributes attrs;
+ int scr;
+ int isfixed; /* is fixed geometry? */
++ int depth; /* bit depth */
+ int l, t; /* left and top offset */
+ int gm; /* geometry mask */
+ } XWindow;
+@@ -698,7 +699,7 @@ xresize(int col, int row)
+
+ XFreePixmap(xw.dpy, xw.buf);
+ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
+- DefaultDepth(xw.dpy, xw.scr));
++ xw.depth);
+ XftDrawChange(xw.draw, xw.buf);
+ xclear(0, 0, win.w, win.h);
+
+@@ -758,6 +759,13 @@ xloadcols(void)
+ else
+ die("Could not allocate color %d\n", i);
+ }
++
++ /* set alpha value of bg color */
++ if (USE_ARGB) {
++ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE;
++ dc.col[defaultbg].pixel &= 0x00111111;
++ dc.col[defaultbg].pixel |= alpha << 24;
++ }
+ loaded = 1;
+ }
+
+@@ -779,6 +787,17 @@ xsetcolorname(int x, const char *name)
+ return 0;
+ }
+
++void
++xtermclear(int col1, int row1, int col2, int row2)
++{
++ XftDrawRect(xw.draw,
++ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
++ borderpx + col1 * win.cw,
++ borderpx + row1 * win.ch,
++ (col2-col1+1) * win.cw,
++ (row2-row1+1) * win.ch);
++}
++
+ /*
+ * Absolute coordinates.
+ */
+@@ -1018,7 +1037,40 @@ xinit(int cols, int rows)
+ if (!(xw.dpy = XOpenDisplay(NULL)))
+ die("Can't open display\n");
+ xw.scr = XDefaultScreen(xw.dpy);
+- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
++ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr);
++ if (!USE_ARGB)
++ xw.vis = XDefaultVisual(xw.dpy, xw.scr);
++ else {
++ XVisualInfo *vis;
++ XRenderPictFormat *fmt;
++ int nvi;
++ int i;
++
++ XVisualInfo tpl = {
++ .screen = xw.scr,
++ .depth = 32,
++ .class = TrueColor
++ };
++
++ vis = XGetVisualInfo(xw.dpy,
++ VisualScreenMask | VisualDepthMask | VisualClassMask,
++ &tpl, &nvi);
++ xw.vis = NULL;
++ for (i = 0; i < nvi; i++) {
++ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual);
++ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
++ xw.vis = vis[i].visual;
++ break;
++ }
++ }
++
++ XFree(vis);
++
++ if (!xw.vis) {
++ fprintf(stderr, "Couldn't find ARGB visual.\n");
++ exit(1);
++ }
++ }
+
+ /* font */
+ if (!FcInit())
+@@ -1028,7 +1080,11 @@ xinit(int cols, int rows)
+ xloadfonts(usedfont, 0);
+
+ /* colors */
+- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
++ if (!USE_ARGB)
++ xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
++ else
++ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr),
++ xw.vis, None);
+ xloadcols();
+
+ /* adjust fixed window geometry */
+@@ -1051,16 +1107,15 @@ xinit(int cols, int rows)
+ if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
+ parent = XRootWindow(xw.dpy, xw.scr);
+ xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
+- win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
++ win.w, win.h, 0, xw.depth, InputOutput,
+ xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
+ | CWEventMask | CWColormap, &xw.attrs);
+
+ memset(&gcvalues, 0, sizeof(gcvalues));
+ gcvalues.graphics_exposures = False;
+- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
+- &gcvalues);
+- xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
+- DefaultDepth(xw.dpy, xw.scr));
++ xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
++ dc.gc = XCreateGC(xw.dpy, (USE_ARGB) ? xw.buf: parent,
++ GCGraphicsExposures, &gcvalues);
+ XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
+ XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
+
diff --git a/patches/st-clipboard-20160727-308bfbf.diff b/patches/st-clipboard-20160727-308bfbf.diff
deleted file mode 100644
index 4cbec85..0000000
--- a/patches/st-clipboard-20160727-308bfbf.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/st.c b/st.c
-index 2594c65..ebdde9f 100644
---- a/st.c
-+++ b/st.c
-@@ -1263,6 +1263,8 @@ xsetsel(char *str, Time t)
- XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
- if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
- selclear(0);
-+
-+ clipcopy(NULL);
- }
-
- void
diff --git a/patches/st-clipboard-20180309-c5ba9c0.diff b/patches/st-clipboard-20180309-c5ba9c0.diff
new file mode 100644
index 0000000..4a14e2b
--- /dev/null
+++ b/patches/st-clipboard-20180309-c5ba9c0.diff
@@ -0,0 +1,13 @@
+diff --git a/x.c b/x.c
+index 13fa9f4..88fd341 100644
+--- a/x.c
++++ b/x.c
+@@ -624,6 +624,8 @@ setsel(char *str, Time t)
+ XSetSelectionOwner(xw.dpy, XA_PRIMARY, xw.win, t);
+ if (XGetSelectionOwner(xw.dpy, XA_PRIMARY) != xw.win)
+ selclear();
++
++ xclipcopy();
+ }
+
+ void
diff --git a/patches/st-no_bold_colors-0.8.1.diff b/patches/st-no_bold_colors-0.8.1.diff
new file mode 100644
index 0000000..1bd4657
--- /dev/null
+++ b/patches/st-no_bold_colors-0.8.1.diff
@@ -0,0 +1,25 @@
+From e0a92b498278e42e33f8007fd7b622a05e5310eb Mon Sep 17 00:00:00 2001
+From: Linh Nguyen <linhvng.2212@gmail.com>
+Date: Wed, 28 Mar 2018 12:23:45 -0400
+Subject: [PATCH] port st-no_bold_colors patch to 0.8.1
+
+---
+ x.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/x.c b/x.c
+index c343ba2..42e7e9f 100644
+--- a/x.c
++++ b/x.c
+@@ -1295,7 +1295,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
+
+ /* Change basic system colors [0-7] to bright system colors [8-15] */
+ if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
+- fg = &dc.col[base.fg + 8];
++ fg = &dc.col[base.fg];
+
+ if (IS_SET(MODE_REVERSE)) {
+ if (fg == &dc.col[defaultfg]) {
+--
+2.16.3
+
diff --git a/patches/st-no_bold_colors-20160727-308bfbf.diff b/patches/st-no_bold_colors-20160727-308bfbf.diff
deleted file mode 100644
index c381703..0000000
--- a/patches/st-no_bold_colors-20160727-308bfbf.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/st.c b/st.c
-index 2594c65..f6fe717 100644
---- a/st.c
-+++ b/st.c
-@@ -3719,7 +3719,7 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
-
- /* Change basic system colors [0-7] to bright system colors [8-15] */
- if ((base.mode & ATTR_BOLD_FAINT) == ATTR_BOLD && BETWEEN(base.fg, 0, 7))
-- fg = &dc.col[base.fg + 8];
-+ fg = &dc.col[base.fg];
-
- if (IS_SET(MODE_REVERSE)) {
- if (fg == &dc.col[defaultfg]) {
diff --git a/patches/st-scrollback-20170104-c63a87c.diff b/patches/st-scrollback-0.8.diff
index 38d1ad6..a61601a 100644
--- a/patches/st-scrollback-20170104-c63a87c.diff
+++ b/patches/st-scrollback-0.8.diff
@@ -1,68 +1,42 @@
diff --git a/config.def.h b/config.def.h
-index a719e36..9b51988 100644
+index 82b1b09..27d42ca 100644
--- a/config.def.h
+++ b/config.def.h
-@@ -178,6 +178,8 @@ static Shortcut shortcuts[] = {
- { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
- { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
- { MODKEY, XK_Control_L, iso14755, {.i = 0} },
+@@ -181,6 +181,8 @@ static Shortcut shortcuts[] = {
+ { TERMMOD, XK_Y, selpaste, {.i = 0} },
+ { TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
+ { TERMMOD, XK_I, iso14755, {.i = 0} },
+ { ShiftMask, XK_Page_Up, kscrollup, {.i = -1} },
+ { ShiftMask, XK_Page_Down, kscrolldown, {.i = -1} },
};
/*
diff --git a/st.c b/st.c
-index fbcd9e0..64bc208 100644
+index 65a0cb6..1d8c12a 100644
--- a/st.c
+++ b/st.c
-@@ -61,6 +61,7 @@ char *argv0;
- #define XK_ANY_MOD UINT_MAX
- #define XK_NO_MOD 0
- #define XK_SWITCH_MOD (1<<13)
-+#define histsize 2000
-
- /* macros */
- #define MIN(a, b) ((a) < (b) ? (a) : (b))
-@@ -87,6 +88,8 @@ char *argv0;
- #define TRUERED(x) (((x) & 0xff0000) >> 8)
- #define TRUEGREEN(x) (((x) & 0xff00))
- #define TRUEBLUE(x) (((x) & 0xff) << 8)
-+#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \
-+ + histsize + 1) % histsize] : term.line[(y) - term.scr])
-
- /* constants */
- #define ISO14755CMD "dmenu -w %lu -p codepoint: </dev/null"
-@@ -241,6 +244,9 @@ typedef struct {
+@@ -121,6 +121,9 @@ typedef struct {
int col; /* nb col */
Line *line; /* screen */
Line *alt; /* alternate screen */
-+ Line hist[histsize]; /* history buffer */
++ Line hist[HISTSIZE]; /* history buffer */
+ int histi; /* history index */
+ int scr; /* scroll back */
- int *dirty; /* dirtyness of lines */
- XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */
+ int *dirty; /* dirtyness of lines */
TCursor c; /* cursor */
-@@ -334,6 +340,8 @@ typedef struct {
- /* function definitions used in config.h */
- static void clipcopy(const Arg *);
- static void clippaste(const Arg *);
-+static void kscrolldown(const Arg *);
-+static void kscrollup(const Arg *);
- static void numlock(const Arg *);
- static void selpaste(const Arg *);
- static void xzoom(const Arg *);
-@@ -409,8 +417,8 @@ static void tputtab(int);
+ int ocx; /* old cursor col */
+@@ -188,8 +191,8 @@ static void tnewline(int);
+ static void tputtab(int);
static void tputc(Rune);
static void treset(void);
- static void tresize(int, int);
-static void tscrollup(int, int);
-static void tscrolldown(int, int);
+static void tscrollup(int, int, int);
+static void tscrolldown(int, int, int);
static void tsetattr(int *, int);
static void tsetchar(Rune, Glyph *, int, int);
- static void tsetscroll(int, int);
-@@ -742,10 +750,10 @@ tlinelen(int y)
+ static void tsetdirt(int, int);
+@@ -431,10 +434,10 @@ tlinelen(int y)
{
int i = term.col;
@@ -75,7 +49,7 @@ index fbcd9e0..64bc208 100644
--i;
return i;
-@@ -807,7 +815,7 @@ selsnap(int *x, int *y, int direction)
+@@ -543,7 +546,7 @@ selsnap(int *x, int *y, int direction)
* Snap around if the word wraps around at the end or
* beginning of a line.
*/
@@ -84,7 +58,7 @@ index fbcd9e0..64bc208 100644
prevdelim = ISDELIM(prevgp->u);
for (;;) {
newx = *x + direction;
-@@ -822,14 +830,14 @@ selsnap(int *x, int *y, int direction)
+@@ -558,14 +561,14 @@ selsnap(int *x, int *y, int direction)
yt = *y, xt = *x;
else
yt = newy, xt = newx;
@@ -101,7 +75,7 @@ index fbcd9e0..64bc208 100644
delim = ISDELIM(gp->u);
if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim
|| (delim && gp->u != prevgp->u)))
-@@ -850,14 +858,14 @@ selsnap(int *x, int *y, int direction)
+@@ -586,14 +589,14 @@ selsnap(int *x, int *y, int direction)
*x = (direction < 0) ? 0 : term.col - 1;
if (direction < 0) {
for (; *y > 0; *y += direction) {
@@ -118,7 +92,7 @@ index fbcd9e0..64bc208 100644
& ATTR_WRAP)) {
break;
}
-@@ -1023,13 +1031,13 @@ getsel(void)
+@@ -624,13 +627,13 @@ getsel(void)
}
if (sel.type == SEL_RECTANGULAR) {
@@ -135,27 +109,27 @@ index fbcd9e0..64bc208 100644
while (last >= gp && last->u == ' ')
--last;
-@@ -1513,6 +1521,9 @@ ttyread(void)
+@@ -836,6 +839,9 @@ ttyread(void)
if (buflen > 0)
- memmove(buf, ptr, buflen);
+ memmove(buf, buf + written, buflen);
-+ if (term.scr > 0 && term.scr < histsize-1)
++ if (term.scr > 0 && term.scr < HISTSIZE-1)
+ term.scr++;
+
return ret;
}
-@@ -1522,6 +1533,9 @@ ttywrite(const char *s, size_t n)
- fd_set wfd, rfd;
- ssize_t r;
- size_t lim = 256;
+@@ -843,6 +849,9 @@ void
+ ttywrite(const char *s, size_t n, int may_echo)
+ {
+ const char *next;
+ Arg arg = (Arg) { .i = term.scr };
+
+ kscrolldown(&arg);
- /*
- * Remember that we are using a pty, which might be a modem line.
-@@ -1724,13 +1738,53 @@ tswapscreen(void)
+ if (may_echo && IS_SET(MODE_ECHO))
+ twrite(s, n, 1);
+@@ -1054,13 +1063,54 @@ tswapscreen(void)
}
void
@@ -185,13 +159,14 @@ index fbcd9e0..64bc208 100644
+ if (n < 0)
+ n = term.row + n;
+
-+ if (term.scr <= histsize - n) {
++ if (term.scr <= HISTSIZE-n) {
+ term.scr += n;
+ selscroll(0, n);
+ tfulldirt();
+ }
+}
+
++
+void
+tscrolldown(int orig, int n, int copyhist)
{
@@ -201,7 +176,7 @@ index fbcd9e0..64bc208 100644
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
-+ term.histi = (term.histi - 1 + histsize) % histsize;
++ term.histi = (term.histi - 1 + HISTSIZE) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[term.bot];
+ term.line[term.bot] = temp;
@@ -210,7 +185,7 @@ index fbcd9e0..64bc208 100644
tsetdirt(orig, term.bot-n);
tclearregion(0, term.bot-n+1, term.col-1, term.bot);
-@@ -1744,13 +1798,20 @@ tscrolldown(int orig, int n)
+@@ -1074,13 +1124,20 @@ tscrolldown(int orig, int n)
}
void
@@ -223,7 +198,7 @@ index fbcd9e0..64bc208 100644
LIMIT(n, 0, term.bot-orig+1);
+ if (copyhist) {
-+ term.histi = (term.histi + 1) % histsize;
++ term.histi = (term.histi + 1) % HISTSIZE;
+ temp = term.hist[term.histi];
+ term.hist[term.histi] = term.line[orig];
+ term.line[orig] = temp;
@@ -232,7 +207,7 @@ index fbcd9e0..64bc208 100644
tclearregion(0, orig, term.col-1, orig+n-1);
tsetdirt(orig+n, term.bot);
-@@ -1799,7 +1860,7 @@ tnewline(int first_col)
+@@ -1129,7 +1186,7 @@ tnewline(int first_col)
int y = term.c.y;
if (y == term.bot) {
@@ -241,7 +216,7 @@ index fbcd9e0..64bc208 100644
} else {
y++;
}
-@@ -1964,14 +2025,14 @@ void
+@@ -1294,14 +1351,14 @@ void
tinsertblankline(int n)
{
if (BETWEEN(term.c.y, term.top, term.bot))
@@ -258,7 +233,7 @@ index fbcd9e0..64bc208 100644
}
int32_t
-@@ -2405,11 +2466,11 @@ csihandle(void)
+@@ -1730,11 +1787,11 @@ csihandle(void)
break;
case 'S': /* SU -- Scroll <n> line up */
DEFAULT(csiescseq.arg[0], 1);
@@ -272,7 +247,7 @@ index fbcd9e0..64bc208 100644
break;
case 'L': /* IL -- Insert <n> blank lines */
DEFAULT(csiescseq.arg[0], 1);
-@@ -2945,7 +3006,7 @@ eschandle(uchar ascii)
+@@ -2258,7 +2315,7 @@ eschandle(uchar ascii)
return 0;
case 'D': /* IND -- Linefeed */
if (term.c.y == term.bot) {
@@ -281,7 +256,7 @@ index fbcd9e0..64bc208 100644
} else {
tmoveto(term.c.x, term.c.y+1);
}
-@@ -2958,7 +3019,7 @@ eschandle(uchar ascii)
+@@ -2271,7 +2328,7 @@ eschandle(uchar ascii)
break;
case 'M': /* RI -- Reverse index */
if (term.c.y == term.top) {
@@ -290,7 +265,7 @@ index fbcd9e0..64bc208 100644
} else {
tmoveto(term.c.x, term.c.y-1);
}
-@@ -3145,7 +3206,7 @@ check_control_code:
+@@ -2490,7 +2547,7 @@ twrite(const char *buf, int buflen, int show_ctrl)
void
tresize(int col, int row)
{
@@ -299,11 +274,12 @@ index fbcd9e0..64bc208 100644
int minrow = MIN(row, term.row);
int mincol = MIN(col, term.col);
int *bp;
-@@ -3185,6 +3246,14 @@ tresize(int col, int row)
+@@ -2527,7 +2584,15 @@ tresize(int col, int row)
term.dirty = xrealloc(term.dirty, row * sizeof(*term.dirty));
term.tabs = xrealloc(term.tabs, col * sizeof(*term.tabs));
-+ for (i = 0; i < histsize; i++) {
+- /* resize each row to new width, zero-pad if needed */
++ for (i = 0; i < HISTSIZE; i++) {
+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph));
+ for (j = mincol; j < col; j++) {
+ term.hist[i][j] = term.c.attr;
@@ -311,31 +287,62 @@ index fbcd9e0..64bc208 100644
+ }
+ }
+
- /* resize each row to new width, zero-pad if needed */
++ /* resize each r w to new width, zero-pad if needed */
for (i = 0; i < minrow; i++) {
term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph));
-@@ -4112,11 +4181,11 @@ drawregion(int x1, int y1, int x2, int y2)
+ term.alt[i] = xrealloc(term.alt[i], col * sizeof(Glyph));
+@@ -2584,7 +2649,7 @@ drawregion(int x1, int y1, int x2, int y2)
+ continue;
+
term.dirty[y] = 0;
+- xdrawline(term.line[y], x1, y, x2);
++ xdrawline(TLINE(y), x1, y, x2);
+ }
+ }
- specs = term.specbuf;
-- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y);
-+ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y);
+@@ -2605,8 +2670,10 @@ draw(void)
+ cx--;
- i = ox = 0;
- for (x = x1; x < x2 && i < numspecs; x++) {
-- new = term.line[y][x];
-+ new = TLINE(y)[x];
- if (new.mode == ATTR_WDUMMY)
- continue;
- if (ena_sel && selected(x, y))
-@@ -4136,7 +4205,9 @@ drawregion(int x1, int y1, int x2, int y2)
- if (i > 0)
- xdrawglyphfontspecs(specs, base, i, ox, y);
- }
-- xdrawcursor();
-+
-+ if (term.scr == 0)
-+ xdrawcursor();
+ drawregion(0, 0, term.col, term.row);
+- xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
+- term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
++ if (term.scr == 0) {
++ xdrawcursor(cx, term.c.y, term.line[term.c.y][cx],
++ term.ocx, term.ocy, term.line[term.ocy][term.ocx]);
++ }
+ term.ocx = cx, term.ocy = term.c.y;
+ xfinishdraw();
}
+diff --git a/st.h b/st.h
+index dac64d8..628e876 100644
+--- a/st.h
++++ b/st.h
+@@ -3,6 +3,9 @@
+ #include <stdint.h>
+ #include <sys/types.h>
- void
++/* Arbitrary size */
++#define HISTSIZE 2000
++
+ /* macros */
+ #define MIN(a, b) ((a) < (b) ? (a) : (b))
+ #define MAX(a, b) ((a) < (b) ? (b) : (a))
+@@ -19,6 +22,8 @@
+
+ #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
+ #define IS_TRUECOL(x) (1 << 24 & (x))
++#define TLINE(y) ((y) < term.scr ? term.hist[((y) + term.histi - term.scr \
++ + HISTSIZE + 1) % HISTSIZE] : term.line[(y) - term.scr])
+
+ enum glyph_attribute {
+ ATTR_NULL = 0,
+@@ -111,6 +116,9 @@ void *xmalloc(size_t);
+ void *xrealloc(void *, size_t);
+ char *xstrdup(char *);
+
++void kscrolldown(const Arg *);
++void kscrollup(const Arg *);
++
+ /* config.h globals */
+ extern char *utmp;
+ extern char *stty_args;
diff --git a/patches/st-scrollback-mouse-20161020-6e79e83.diff b/patches/st-scrollback-mouse-0.8.diff
index 05b8b45..3b2729e 100644
--- a/patches/st-scrollback-mouse-20161020-6e79e83.diff
+++ b/patches/st-scrollback-mouse-0.8.diff
@@ -1,8 +1,8 @@
diff --git a/config.def.h b/config.def.h
-index eae969e..34ebb44 100644
+index 27d42ca..feec7e2 100644
--- a/config.def.h
+++ b/config.def.h
-@@ -152,8 +152,14 @@ static unsigned int defaultunderline = 7;
+@@ -156,8 +156,14 @@ static unsigned int defaultattr = 11;
*/
static MouseShortcut mshortcuts[] = {
/* button mask string */
@@ -12,18 +12,18 @@ index eae969e..34ebb44 100644
+ { Button5, XK_NO_MOD, "\005" },
+};
+
-+static MouseKey mkeys[] = {
++MouseKey mkeys[] = {
+ /* button mask function argument */
+ { Button4, ShiftMask, kscrollup, {.i = 1} },
+ { Button5, ShiftMask, kscrolldown, {.i = 1} },
};
/* Internal keyboard shortcuts. */
-diff --git a/st.c b/st.c
-index 233d301..c71b6e7 100644
---- a/st.c
-+++ b/st.c
-@@ -299,6 +299,13 @@ typedef union {
+diff --git a/st.h b/st.h
+index 628e876..cdd25ae 100644
+--- a/st.h
++++ b/st.h
+@@ -81,6 +81,13 @@ typedef union {
const void *v;
} Arg;
@@ -34,18 +34,27 @@ index 233d301..c71b6e7 100644
+ const Arg arg;
+} MouseKey;
+
- typedef struct {
- uint mod;
- KeySym keysym;
-@@ -953,6 +960,7 @@ bpress(XEvent *e)
+ void die(const char *, ...);
+ void redraw(void);
+ void draw(void);
+@@ -129,3 +136,4 @@ extern char *termname;
+ extern unsigned int tabspaces;
+ extern unsigned int defaultfg;
+ extern unsigned int defaultbg;
++extern MouseKey mkeys[];
+diff --git a/x.c b/x.c
+index d43a529..754d859 100644
+--- a/x.c
++++ b/x.c
+@@ -409,6 +409,7 @@ bpress(XEvent *e)
{
struct timespec now;
MouseShortcut *ms;
+ MouseKey *mk;
+ int snap;
if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
- mousereport(e);
-@@ -967,6 +975,14 @@ bpress(XEvent *e)
+@@ -424,6 +425,14 @@ bpress(XEvent *e)
}
}
@@ -58,5 +67,5 @@ index 233d301..c71b6e7 100644
+ }
+
if (e->xbutton.button == Button1) {
- clock_gettime(CLOCK_MONOTONIC, &now);
-
+ /*
+ * If the user clicks below predefined timeouts specific
diff --git a/patches/st-solarized-both-20160727-308bfbf.diff b/patches/st-solarized-both-20160727-308bfbf.diff
deleted file mode 100644
index c966579..0000000
--- a/patches/st-solarized-both-20160727-308bfbf.diff
+++ /dev/null
@@ -1,189 +0,0 @@
-diff --git a/config.def.h b/config.def.h
-index b41747f..adaa9b8 100644
---- a/config.def.h
-+++ b/config.def.h
-@@ -84,42 +84,54 @@ static unsigned int tabspaces = 8;
-
- /* Terminal colors (16 first used in escape sequence) */
- static const char *colorname[] = {
-- /* 8 normal colors */
-- "black",
-- "red3",
-- "green3",
-- "yellow3",
-- "blue2",
-- "magenta3",
-- "cyan3",
-- "gray90",
--
-- /* 8 bright colors */
-- "gray50",
-- "red",
-- "green",
-- "yellow",
-- "#5c5cff",
-- "magenta",
-- "cyan",
-- "white",
--
-- [255] = 0,
--
-- /* more colors can be added after 255 to use with DefaultXX */
-- "#cccccc",
-- "#555555",
-+ /* solarized dark */
-+ "#073642", /* 0: black */
-+ "#dc322f", /* 1: red */
-+ "#859900", /* 2: green */
-+ "#b58900", /* 3: yellow */
-+ "#268bd2", /* 4: blue */
-+ "#d33682", /* 5: magenta */
-+ "#2aa198", /* 6: cyan */
-+ "#eee8d5", /* 7: white */
-+ "#002b36", /* 8: brblack */
-+ "#cb4b16", /* 9: brred */
-+ "#586e75", /* 10: brgreen */
-+ "#657b83", /* 11: bryellow */
-+ "#839496", /* 12: brblue */
-+ "#6c71c4", /* 13: brmagenta*/
-+ "#93a1a1", /* 14: brcyan */
-+ "#fdf6e3", /* 15: brwhite */
- };
-
-+/* Terminal colors for alternate (light) palette */
-+static const char *altcolorname[] = {
-+ /* solarized light */
-+ "#eee8d5", /* 0: black */
-+ "#dc322f", /* 1: red */
-+ "#859900", /* 2: green */
-+ "#b58900", /* 3: yellow */
-+ "#268bd2", /* 4: blue */
-+ "#d33682", /* 5: magenta */
-+ "#2aa198", /* 6: cyan */
-+ "#073642", /* 7: white */
-+ "#fdf6e3", /* 8: brblack */
-+ "#cb4b16", /* 9: brred */
-+ "#93a1a1", /* 10: brgreen */
-+ "#839496", /* 11: bryellow */
-+ "#657b83", /* 12: brblue */
-+ "#6c71c4", /* 13: brmagenta*/
-+ "#586e75", /* 14: brcyan */
-+ "#002b36", /* 15: brwhite */
-+};
-
- /*
- * Default colors (colorname index)
- * foreground, background, cursor, reverse cursor
- */
--static unsigned int defaultfg = 7;
--static unsigned int defaultbg = 0;
--static unsigned int defaultcs = 256;
--static unsigned int defaultrcs = 257;
-+static unsigned int defaultfg = 12;
-+static unsigned int defaultbg = 8;
-+static unsigned int defaultcs = 14;
-+static unsigned int defaultrcs = 15;
-
- /*
- * Default shape of cursor
-@@ -172,6 +184,7 @@ static Shortcut shortcuts[] = {
- { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} },
- { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} },
- { MODKEY, XK_Num_Lock, numlock, {.i = 0} },
-+ { XK_ANY_MOD, XK_F6, swapcolors, {.i = 0} },
- };
-
- /*
-diff --git a/st.c b/st.c
-index 2594c65..b4a3089 100644
---- a/st.c
-+++ b/st.c
-@@ -328,6 +328,7 @@ typedef struct {
- static void clipcopy(const Arg *);
- static void clippaste(const Arg *);
- static void numlock(const Arg *);
-+static void swapcolors(const Arg *);
- static void selpaste(const Arg *);
- static void xzoom(const Arg *);
- static void xzoomabs(const Arg *);
-@@ -355,7 +356,7 @@ typedef struct {
-
- /* Drawing Context */
- typedef struct {
-- Color col[MAX(LEN(colorname), 256)];
-+ Color col[MAX(MAX(LEN(colorname), LEN(altcolorname)), 256)];
- Font font, bfont, ifont, ibfont;
- GC gc;
- } DC;
-@@ -533,6 +534,8 @@ static char *opt_name = NULL;
- static char *opt_title = NULL;
- static int oldbutton = 3; /* button event on startup: 3 = release */
-
-+static int usealtcolors = 0; /* 1 to use alternate palette */
-+
- static char *usedfont = NULL;
- static double usedfontsize = 0;
- static double defaultfontsize = 0;
-@@ -3148,6 +3151,11 @@ sixd_to_16bit(int x)
- return x == 0 ? 0 : 0x3737 + 0x2828 * x;
- }
-
-+const char* getcolorname(int i)
-+{
-+ return (usealtcolors) ? altcolorname[i] : colorname[i];
-+}
-+
- int
- xloadcolor(int i, const char *name, Color *ncolor)
- {
-@@ -3166,7 +3174,7 @@ xloadcolor(int i, const char *name, Color *ncolor)
- return XftColorAllocValue(xw.dpy, xw.vis,
- xw.cmap, &color, ncolor);
- } else
-- name = colorname[i];
-+ name = getcolorname(i);
- }
-
- return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
-@@ -3186,8 +3194,8 @@ xloadcols(void)
-
- for (i = 0; i < LEN(dc.col); i++)
- if (!xloadcolor(i, NULL, &dc.col[i])) {
-- if (colorname[i])
-- die("Could not allocate color '%s'\n", colorname[i]);
-+ if (getcolorname(i))
-+ die("Could not allocate color '%s'\n", getcolorname(i));
- else
- die("Could not allocate color %d\n", i);
- }
-@@ -3514,13 +3522,13 @@ xinit(void)
- cursor = XCreateFontCursor(xw.dpy, mouseshape);
- XDefineCursor(xw.dpy, xw.win, cursor);
-
-- if (XParseColor(xw.dpy, xw.cmap, colorname[mousefg], &xmousefg) == 0) {
-+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousefg), &xmousefg) == 0) {
- xmousefg.red = 0xffff;
- xmousefg.green = 0xffff;
- xmousefg.blue = 0xffff;
- }
-
-- if (XParseColor(xw.dpy, xw.cmap, colorname[mousebg], &xmousebg) == 0) {
-+ if (XParseColor(xw.dpy, xw.cmap, getcolorname(mousebg), &xmousebg) == 0) {
- xmousebg.red = 0x0000;
- xmousebg.green = 0x0000;
- xmousebg.blue = 0x0000;
-@@ -4074,6 +4082,14 @@ numlock(const Arg *dummy)
- term.numlock ^= 1;
- }
-
-+void
-+swapcolors(const Arg *dummy)
-+{
-+ usealtcolors = !usealtcolors;
-+ xloadcols();
-+ redraw();
-+}
-+
- char*
- kmap(KeySym k, uint state)
- {
diff --git a/patches/transparency.diff b/patches/transparency.diff
deleted file mode 100644
index b0d923c..0000000
--- a/patches/transparency.diff
+++ /dev/null
@@ -1,189 +0,0 @@
---- st/config.def.h 2018-01-19 12:48:07.280548253 -0700
-+++ st-transparent/config.def.h 2018-01-19 13:15:25.443443692 -0700
-@@ -82,6 +82,9 @@
- */
- static unsigned int tabspaces = 8;
-
-+/* bg opacity */
-+static const int alpha = 0xdd;
-+
- /* Terminal colors (16 first used in escape sequence) */
- static const char *colorname[] = {
- /* solarized dark */
-@@ -101,6 +104,7 @@
- "#6c71c4", /* 13: brmagenta*/
- "#93a1a1", /* 14: brcyan */
- "#fdf6e3", /* 15: brwhite */
-+ "black",
- };
-
- /* Terminal colors for alternate (light) palette */
-@@ -122,6 +126,7 @@
- "#6c71c4", /* 13: brmagenta*/
- "#586e75", /* 14: brcyan */
- "#002b36", /* 15: brwhite */
-+ "black",
- };
-
- /*
-@@ -129,7 +134,7 @@
- * foreground, background, cursor, reverse cursor
- */
- static unsigned int defaultfg = 12;
--static unsigned int defaultbg = 8;
-+static unsigned int defaultbg = 257;
- static unsigned int defaultcs = 14;
- static unsigned int defaultrcs = 15;
-
---- st/config.mk 2018-01-17 23:51:03.804274540 -0700
-+++ st-transparent/config.mk 2018-01-19 12:56:45.323928617 -0700
-@@ -14,7 +14,7 @@
- INCS = -I. -I/usr/include -I${X11INC} \
- `pkg-config --cflags fontconfig` \
- `pkg-config --cflags freetype2`
--LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXft \
-+LIBS = -L/usr/lib -lc -L${X11LIB} -lm -lrt -lX11 -lutil -lXext -lXft -lXrender\
- `pkg-config --libs fontconfig` \
- `pkg-config --libs freetype2`
-
---- st/st.c 2018-01-18 19:01:56.693663129 -0700
-+++ st-transparent/st.c 2018-01-19 13:03:28.877184002 -0700
-@@ -61,6 +61,7 @@
- #define XK_ANY_MOD UINT_MAX
- #define XK_NO_MOD 0
- #define XK_SWITCH_MOD (1<<13)
-+#define OPAQUE 0Xff
- #define histsize 2000
-
- /* macros */
-@@ -83,6 +84,8 @@
- (t1.tv_nsec-t2.tv_nsec)/1E6)
- #define MODBIT(x, set, bit) ((set) ? ((x) |= (bit)) : ((x) &= ~(bit)))
-
-+#define USE_ARGB (alpha != OPAQUE && opt_embed == NULL)
-+
- #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
- #define IS_TRUECOL(x) (1 << 24 & (x))
- #define TRUERED(x) (((x) & 0xff0000) >> 8)
-@@ -281,6 +284,7 @@
- int w, h; /* window width and height */
- int ch; /* char height */
- int cw; /* char width */
-+ int depth; /* bit depth */
- int cyo; /* char y offset */
- char state; /* focus, redraw, visible */
- int cursor; /* cursor style */
-@@ -3326,7 +3330,7 @@
-
- XFreePixmap(xw.dpy, xw.buf);
- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
-- DefaultDepth(xw.dpy, xw.scr));
-+ xw.depth);
- XftDrawChange(xw.draw, xw.buf);
- xclear(0, 0, xw.w, xw.h);
- }
-@@ -3385,6 +3389,14 @@
- else
- die("Could not allocate color %d\n", i);
- }
-+
-+ /* set alpha value of bg color */
-+ if (USE_ARGB) {
-+ dc.col[defaultbg].color.alpha = (0xffff * alpha) / OPAQUE; //0xcccc;
-+ dc.col[defaultbg].pixel &= 0x00111111;
-+ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000;
-+ }
-+
- loaded = 1;
- }
-
-@@ -3405,6 +3417,15 @@
-
- return 0;
- }
-+void
-+xtermclear(int col1, int row1, int col2, int row2) {
-+ XftDrawRect(xw.draw,
-+ &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
-+ borderpx + col1 * xw.cw,
-+ borderpx + row1 * xw.ch,
-+ (col2-col1+1) * xw.cw,
-+ (row2-row1+1) * xw.ch);
-+}
-
- /*
- * Absolute coordinates.
-@@ -3677,7 +3698,38 @@
- if (!(xw.dpy = XOpenDisplay(NULL)))
- die("Can't open display\n");
- xw.scr = XDefaultScreen(xw.dpy);
-- xw.vis = XDefaultVisual(xw.dpy, xw.scr);
-+ xw.depth = (USE_ARGB) ? 32: XDefaultDepth(xw.dpy, xw.scr);
-+ if (! USE_ARGB)
-+ xw.vis = XDefaultVisual(xw.dpy, xw.scr);
-+ else {
-+ XVisualInfo *vis;
-+ XRenderPictFormat *fmt;
-+ int nvi;
-+ int i;
-+
-+ XVisualInfo tpl = {
-+ .screen = xw.scr,
-+ .depth = 32,
-+ .class = TrueColor
-+ };
-+
-+ vis = XGetVisualInfo(xw.dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
-+ xw.vis = NULL;
-+ for(i = 0; i < nvi; i ++) {
-+ fmt = XRenderFindVisualFormat(xw.dpy, vis[i].visual);
-+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
-+ xw.vis = vis[i].visual;
-+ break;
-+ }
-+ }
-+
-+ XFree(vis);
-+
-+ if (! xw.vis) {
-+ fprintf(stderr, "Couldn't find ARGB visual.\n");
-+ exit(1);
-+ }
-+ }
-
- /* font */
- if (!FcInit())
-@@ -3687,7 +3739,10 @@
- xloadfonts(usedfont, 0);
-
- /* colors */
-- xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
-+ if (! USE_ARGB)
-+ xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
-+ else
-+ xw.cmap = XCreateColormap(xw.dpy, XRootWindow(xw.dpy, xw.scr), xw.vis, None);
- xloadcols();
-
- /* adjust fixed window geometry */
-@@ -3710,16 +3765,17 @@
- if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
- parent = XRootWindow(xw.dpy, xw.scr);
- xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
-- xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
-+ xw.w, xw.h, 0, xw.depth, InputOutput,
- xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
- | CWEventMask | CWColormap, &xw.attrs);
-
- memset(&gcvalues, 0, sizeof(gcvalues));
- gcvalues.graphics_exposures = False;
-- dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
-+ xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h, xw.depth);
-+ dc.gc = XCreateGC(xw.dpy,
-+ (USE_ARGB)? xw.buf: parent,
-+ GCGraphicsExposures,
- &gcvalues);
-- xw.buf = XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
-- DefaultDepth(xw.dpy, xw.scr));
- XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
- XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
-