sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 3636c7f6db3e62aeaa70d6b87088a2cf968e3aeb
parent 017834e486f7e364d0cb7759d974859aad74bd26
Author: FRIGN <dev@frign.de>
Date:   Wed, 27 Jul 2016 06:33:01 +0200

st: update patches

everything was trivial, except delkey.

Diffstat:
Mst.suckless.org/patches/alpha.md | 2+-
Mst.suckless.org/patches/clipboard.md | 2+-
Mst.suckless.org/patches/copyurl.md | 2+-
Mst.suckless.org/patches/delkey.md | 2+-
Mst.suckless.org/patches/externalpipe.md | 2+-
Mst.suckless.org/patches/hidecursor.md | 2+-
Mst.suckless.org/patches/openbsd.md | 2+-
Mst.suckless.org/patches/scrollback.md | 6+++---
Mst.suckless.org/patches/solarized.md | 8++++----
Mst.suckless.org/patches/spoiler.md | 2+-
Dst.suckless.org/patches/st-alpha-20160710-528241a.diff | 188-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-alpha-20160727-308bfbf.diff | 188+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rst.suckless.org/patches/st-clipboard-20160710-528241a.diff -> st.suckless.org/patches/st-clipboard-20160727-308bfbf.diff | 0
Dst.suckless.org/patches/st-copyurl-20160710-528241a.diff | 88-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-copyurl-20160727-308bfbf.diff | 88+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-delkey-20160710-528241a.diff | 45---------------------------------------------
Ast.suckless.org/patches/st-delkey-20160727-308bfbf.diff | 45+++++++++++++++++++++++++++++++++++++++++++++
Rst.suckless.org/patches/st-externalpipe-20160710-528241a.diff -> st.suckless.org/patches/st-externalpipe-20160727-308bfbf.diff | 0
Rst.suckless.org/patches/st-hidecursor-20160710-528241a.diff -> st.suckless.org/patches/st-hidecursor-20160727-308bfbf.diff | 0
Rst.suckless.org/patches/st-no_bold_colors-20160710-528241a.diff -> st.suckless.org/patches/st-no_bold_colors-20160727-308bfbf.diff | 0
Dst.suckless.org/patches/st-openbsd-20160710-528241a.diff | 27---------------------------
Ast.suckless.org/patches/st-openbsd-20160727-308bfbf.diff | 27+++++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-20160710-528241a.diff | 387-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-scrollback-20160727-308bfbf.diff | 387+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-scrollback-mouse-20160710-528241a.diff | 62--------------------------------------------------------------
Ast.suckless.org/patches/st-scrollback-mouse-20160727-308bfbf.diff | 62++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rst.suckless.org/patches/st-scrollback-mouse-altscreen-20160710-528241a.diff -> st.suckless.org/patches/st-scrollback-mouse-altscreen-20160727-308bfbf.diff | 0
Dst.suckless.org/patches/st-solarized-both-20160710-528241a.diff | 189-------------------------------------------------------------------------------
Ast.suckless.org/patches/st-solarized-both-20160727-308bfbf.diff | 189+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-solarized-dark-20160710-528241a.diff | 68--------------------------------------------------------------------
Ast.suckless.org/patches/st-solarized-dark-20160727-308bfbf.diff | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dst.suckless.org/patches/st-solarized-light-20160710-528241a.diff | 68--------------------------------------------------------------------
Ast.suckless.org/patches/st-solarized-light-20160727-308bfbf.diff | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rst.suckless.org/patches/st-spoiler-20160710-528241a.diff -> st.suckless.org/patches/st-spoiler-20160727-308bfbf.diff | 0
Rst.suckless.org/patches/st-visualbell-20160710-528241a.diff -> st.suckless.org/patches/st-visualbell-20160727-308bfbf.diff | 0
Mst.suckless.org/patches/visualbell.md | 2+-
36 files changed, 1138 insertions(+), 1138 deletions(-)

diff --git a/st.suckless.org/patches/alpha.md b/st.suckless.org/patches/alpha.md @@ -23,7 +23,7 @@ Download * [st-alpha-0.4.1.diff](st-alpha-0.4.1.diff) * [st-alpha-0.5.diff](st-alpha-0.5.diff) * [st-alpha-0.6.diff](st-alpha-0.6.diff) - * [st-alpha-20160710-528241a.diff](st-alpha-20160710-528241a.diff) + * [st-alpha-20160727-308bfbf.diff](st-alpha-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/clipboard.md b/st.suckless.org/patches/clipboard.md @@ -16,7 +16,7 @@ Download -------- * [st-clipboard-0.6.diff](st-clipboard-0.6.diff) -* [st-clipboard-20160710-528241a.diff](st-clipboard-20160710-528241a.diff) +* [st-clipboard-20160727-308bfbf.diff](st-clipboard-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/copyurl.md b/st.suckless.org/patches/copyurl.md @@ -17,7 +17,7 @@ Download -------- * [st-copyurl-0.6.diff](st-copyurl-0.6.diff) - * [st-copyurl-20160710-528241a.diff](st-copyurl-20160710-528241a.diff) + * [st-copyurl-20160727-308bfbf.diff](st-copyurl-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/delkey.md b/st.suckless.org/patches/delkey.md @@ -10,7 +10,7 @@ Download -------- * [st-delkey-0.6.diff](st-delkey-0.6.diff) - * [st-delkey-20160710-528241a.diff](st-delkey-20160710-528241a.diff) + * [st-delkey-20160727-308bfbf.diff](st-delkey-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/externalpipe.md b/st.suckless.org/patches/externalpipe.md @@ -27,7 +27,7 @@ Download * [st-externalpipe-0.4.1.diff](st-externalpipe-0.4.1.diff) * [st-externalpipe-0.5.diff](st-externalpipe-0.5.diff) * [st-externalpipe-0.6.diff](st-externalpipe-0.6.diff) -* [st-externalpipe-20160710-528241a.diff](st-externalpipe-20160710-528241a.diff) +* [st-externalpipe-20160727-308bfbf.diff](st-externalpipe-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/hidecursor.md b/st.suckless.org/patches/hidecursor.md @@ -12,7 +12,7 @@ Download * [st-hidecursor-0.5.diff](st-hidecursor-0.5.diff) * [st-hidecursor-0.6.diff](st-hidecursor-0.6.diff) -* [st-hidecursor-20160710-528241a.diff](st-hidecursor-20160710-528241a.diff) +* [st-hidecursor-20160727-308bfbf.diff](st-hidecursor-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/openbsd.md b/st.suckless.org/patches/openbsd.md @@ -27,7 +27,7 @@ More information on this issue can be found in this Download -------- -* [st-openbsd-20160710-528241a.diff](st-openbsd-20160710-528241a.diff) +* [st-openbsd-20160727-308bfbf.diff](st-openbsd-20160727-308bfbf.diff) Authors diff --git a/st.suckless.org/patches/scrollback.md b/st.suckless.org/patches/scrollback.md @@ -9,12 +9,12 @@ Scroll back through terminal output using Shift+{PageUp, PageDown}. Download -------- -* [st-scrollback-20160710-528241a.diff](st-scrollback-20160710-528241a.diff) +* [st-scrollback-20160727-308bfbf.diff](st-scrollback-20160727-308bfbf.diff) Apply the following patch on top of the previous to allow scrolling using `Shift+MouseWheel`. -* [st-scrollback-mouse-20160710-528241a.diff](st-scrollback-mouse-20160710-528241a.diff) +* [st-scrollback-mouse-20160727-308bfbf.diff](st-scrollback-mouse-20160727-308bfbf.diff) Apply the following patch on top of the previous two to allow scrollback using mouse wheel only when not in `MODE_ALTSCREEN`. eg. The content is being @@ -22,7 +22,7 @@ scrolled instead of the scrollback buffer in `less`. Consequently the Shift modifier for scrolling is not needed anymore. **Note: It might break other mkeys excluding scrolling functions.** -* [st-scrollback-mouse-altscreen-20160710-528241a.diff](st-scrollback-mouse-altscreen-20160710-528241a.diff) +* [st-scrollback-mouse-altscreen-20160727-308bfbf.diff](st-scrollback-mouse-altscreen-20160727-308bfbf.diff) Authors ------- diff --git a/st.suckless.org/patches/solarized.md b/st.suckless.org/patches/solarized.md @@ -34,7 +34,7 @@ to disable lighting up bold colors. * [st-no_bold_colors-0.5.diff](st-no_bold_colors-0.5.diff) * [st-no_bold_colors-0.6.diff](st-no_bold_colors-0.6.diff) - * [st-no_bold_colors-20160710-528241a.diff](st-no_bold_colors-20160710-528241a.diff) + * [st-no_bold_colors-20160727-308bfbf.diff](st-no_bold_colors-20160727-308bfbf.diff) Choose one of the following patches to get either the light or the dark color scheme: @@ -43,17 +43,17 @@ or the dark color scheme: * [st-solarized-light-0.5.diff](st-solarized-light-0.5.diff) * [st-solarized-light-0.6.diff](st-solarized-light-0.6.diff) - * [st-solarized-light-20160710-528241a.diff](st-solarized-light-20160710-528241a.diff) + * [st-solarized-light-20160727-308bfbf.diff](st-solarized-light-20160727-308bfbf.diff) *Dark*: * [st-solarized-dark-0.5.diff](st-solarized-dark-0.5.diff) * [st-solarized-dark-0.6.diff](st-solarized-dark-0.6.diff) - * [st-solarized-dark-20160710-528241a.diff](st-solarized-dark-20160710-528241a.diff) + * [st-solarized-dark-20160727-308bfbf.diff](st-solarized-dark-20160727-308bfbf.diff) *Both (swap between light/dark with F6)*: - * [st-solarized-both-20160709-528241a.diff](st-solarized-both-20160710-528241a.diff) + * [st-solarized-both-20160709-528241a.diff](st-solarized-both-20160727-308bfbf.diff) Authors diff --git a/st.suckless.org/patches/spoiler.md b/st.suckless.org/patches/spoiler.md @@ -20,7 +20,7 @@ Download -------- * [st-spoiler-0.6.diff](st-spoiler-0.6.diff) - * [st-spoiler-20160710-528241a.diff](st-spoiler-20160710-528241a.diff) + * [st-spoiler-20160727-308bfbf.diff](st-spoiler-20160727-308bfbf.diff) Author ------ diff --git a/st.suckless.org/patches/st-alpha-20160710-528241a.diff b/st.suckless.org/patches/st-alpha-20160710-528241a.diff @@ -1,188 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..2ab4f57 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -67,6 +67,9 @@ static char termname[] = "st-256color"; - - static unsigned int tabspaces = 8; - -+/* bg opacity */ -+static const int alpha = 0xdd; -+ - /* Terminal colors (16 first used in escape sequence) */ - static const char *colorname[] = { - /* 8 normal colors */ -@@ -94,6 +97,7 @@ static const char *colorname[] = { - /* more colors can be added after 255 to use with DefaultXX */ - "#cccccc", - "#555555", -+ "black", - }; - - -@@ -102,7 +106,7 @@ static const char *colorname[] = { - * foreground, background, cursor, reverse cursor - */ - static unsigned int defaultfg = 7; --static unsigned int defaultbg = 0; -+static unsigned int defaultbg = 257; - static unsigned int defaultcs = 256; - static unsigned int defaultrcs = 257; - -diff --git a/config.mk b/config.mk -index 81e3e47..005b1c6 100644 ---- a/config.mk -+++ b/config.mk -@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib - 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` - -diff --git a/st.c b/st.c -index 2594c65..f9ba75b 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 OPAQUE 0Xff - - /* macros */ - #define MIN(a, b) ((a) < (b) ? (a) : (b)) -@@ -81,6 +82,8 @@ char *argv0; - (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) -@@ -268,6 +271,7 @@ typedef struct { - int w, h; /* window width and height */ - int ch; /* char height */ - int cw; /* char width */ -+ int depth; /* bit depth */ - char state; /* focus, redraw, visible */ - int cursor; /* cursor style */ - } XWindow; -@@ -3137,7 +3141,7 @@ xresize(int col, int row) - - 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); - } -@@ -3191,6 +3195,14 @@ 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; //0xcccc; -+ dc.col[defaultbg].pixel &= 0x00111111; -+ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000; -+ } -+ - loaded = 1; - } - -@@ -3212,6 +3224,16 @@ 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 * xw.cw, -+ borderpx + row1 * xw.ch, -+ (col2-col1+1) * xw.cw, -+ (row2-row1+1) * xw.ch); -+} -+ - /* - * Absolute coordinates. - */ -@@ -3443,7 +3465,38 @@ xinit(void) - 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()) -@@ -3453,7 +3506,10 @@ xinit(void) - 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 */ -@@ -3476,16 +3532,17 @@ xinit(void) - 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); - diff --git a/st.suckless.org/patches/st-alpha-20160727-308bfbf.diff b/st.suckless.org/patches/st-alpha-20160727-308bfbf.diff @@ -0,0 +1,188 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..e22ebd2 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -82,6 +82,9 @@ static char termname[] = "st-256color"; + */ + static unsigned int tabspaces = 8; + ++/* bg opacity */ ++static const int alpha = 0xdd; ++ + /* Terminal colors (16 first used in escape sequence) */ + static const char *colorname[] = { + /* 8 normal colors */ +@@ -109,6 +112,7 @@ static const char *colorname[] = { + /* more colors can be added after 255 to use with DefaultXX */ + "#cccccc", + "#555555", ++ "black", + }; + + +@@ -117,7 +121,7 @@ static const char *colorname[] = { + * foreground, background, cursor, reverse cursor + */ + static unsigned int defaultfg = 7; +-static unsigned int defaultbg = 0; ++static unsigned int defaultbg = 257; + static unsigned int defaultcs = 256; + static unsigned int defaultrcs = 257; + +diff --git a/config.mk b/config.mk +index 81e3e47..005b1c6 100644 +--- a/config.mk ++++ b/config.mk +@@ -14,7 +14,7 @@ X11LIB = /usr/X11R6/lib + 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` + +diff --git a/st.c b/st.c +index 2594c65..f9ba75b 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 OPAQUE 0Xff + + /* macros */ + #define MIN(a, b) ((a) < (b) ? (a) : (b)) +@@ -81,6 +82,8 @@ char *argv0; + (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) +@@ -268,6 +271,7 @@ typedef struct { + int w, h; /* window width and height */ + int ch; /* char height */ + int cw; /* char width */ ++ int depth; /* bit depth */ + char state; /* focus, redraw, visible */ + int cursor; /* cursor style */ + } XWindow; +@@ -3137,7 +3141,7 @@ xresize(int col, int row) + + 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); + } +@@ -3191,6 +3195,14 @@ 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; //0xcccc; ++ dc.col[defaultbg].pixel &= 0x00111111; ++ dc.col[defaultbg].pixel |= alpha << 24; // 0xcc000000; ++ } ++ + loaded = 1; + } + +@@ -3212,6 +3224,16 @@ 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 * xw.cw, ++ borderpx + row1 * xw.ch, ++ (col2-col1+1) * xw.cw, ++ (row2-row1+1) * xw.ch); ++} ++ + /* + * Absolute coordinates. + */ +@@ -3443,7 +3465,38 @@ xinit(void) + 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()) +@@ -3453,7 +3506,10 @@ xinit(void) + 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 */ +@@ -3476,16 +3532,17 @@ xinit(void) + 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); + diff --git a/st.suckless.org/patches/st-clipboard-20160710-528241a.diff b/st.suckless.org/patches/st-clipboard-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-copyurl-20160710-528241a.diff b/st.suckless.org/patches/st-copyurl-20160710-528241a.diff @@ -1,88 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..c88bb0b 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -157,6 +157,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} }, -+ { MODKEY, XK_l, copyurl, {.i = 0} }, - }; - - /* -diff --git a/st.c b/st.c -index 2594c65..78201ff 100644 ---- a/st.c -+++ b/st.c -@@ -336,6 +336,7 @@ static void printsel(const Arg *); - static void printscreen(const Arg *) ; - static void toggleprinter(const Arg *); - static void sendbreak(const Arg *); -+static void copyurl(const Arg *); - - /* Config.h for applying patches and the configuration. */ - #include "config.h" -@@ -4402,3 +4403,63 @@ run: - return 0; - } - -+/* select and copy the previous url on screen (do nothing if there's no url). -+ * known bug: doesn't handle urls that span multiple lines (wontfix) -+ * known bug: only finds first url on line (mightfix) -+ */ -+void -+copyurl(const Arg *arg) { -+ /* () and [] can appear in urls, but excluding them here will reduce false -+ * positives when figuring out where a given url ends. -+ */ -+ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -+ "abcdefghijklmnopqrstuvwxyz" -+ "0123456789-._~:/?#@!$&'*+,;=%"; -+ -+ int i, row, startrow; -+ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ -+ char *c, *match = NULL; -+ -+ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot; -+ LIMIT(row, term.top, term.bot); -+ startrow = row; -+ -+ /* find the start of the last url before selection */ -+ do { -+ for (i = 0; i < term.col; ++i) { -+ if (term.line[row][i].u > 127) /* assume ascii */ -+ continue; -+ linestr[i] = term.line[row][i].u; -+ } -+ linestr[term.col] = '\0'; -+ if ((match = strstr(linestr, "http://")) -+ || (match = strstr(linestr, "https://"))) -+ break; -+ if (--row < term.top) -+ row = term.bot; -+ } while (row != startrow); -+ -+ if (match) { -+ /* must happen before trim */ -+ selclear(NULL); -+ sel.ob.x = strlen(linestr) - strlen(match); -+ -+ /* trim the rest of the line from the url match */ -+ for (c = match; *c != '\0'; ++c) -+ if (!strchr(URLCHARS, *c)) { -+ *c = '\0'; -+ break; -+ } -+ -+ /* select and copy */ -+ sel.mode = 1; -+ sel.type = SEL_REGULAR; -+ sel.oe.x = sel.ob.x + strlen(match)-1; -+ sel.ob.y = sel.oe.y = row; -+ selnormalize(); -+ tsetdirt(sel.nb.y, sel.ne.y); -+ selcopy(0); -+ } -+ -+ free(linestr); -+} diff --git a/st.suckless.org/patches/st-copyurl-20160727-308bfbf.diff b/st.suckless.org/patches/st-copyurl-20160727-308bfbf.diff @@ -0,0 +1,88 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..50321db 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -172,6 +172,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} }, ++ { MODKEY, XK_l, copyurl, {.i = 0} }, + }; + + /* +diff --git a/st.c b/st.c +index 2594c65..78201ff 100644 +--- a/st.c ++++ b/st.c +@@ -336,6 +336,7 @@ static void printsel(const Arg *); + static void printscreen(const Arg *) ; + static void toggleprinter(const Arg *); + static void sendbreak(const Arg *); ++static void copyurl(const Arg *); + + /* Config.h for applying patches and the configuration. */ + #include "config.h" +@@ -4402,3 +4403,63 @@ run: + return 0; + } + ++/* select and copy the previous url on screen (do nothing if there's no url). ++ * known bug: doesn't handle urls that span multiple lines (wontfix) ++ * known bug: only finds first url on line (mightfix) ++ */ ++void ++copyurl(const Arg *arg) { ++ /* () and [] can appear in urls, but excluding them here will reduce false ++ * positives when figuring out where a given url ends. ++ */ ++ static char URLCHARS[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ++ "abcdefghijklmnopqrstuvwxyz" ++ "0123456789-._~:/?#@!$&'*+,;=%"; ++ ++ int i, row, startrow; ++ char *linestr = calloc(sizeof(char), term.col+1); /* assume ascii */ ++ char *c, *match = NULL; ++ ++ row = (sel.ob.x >= 0 && sel.nb.y > 0) ? sel.nb.y-1 : term.bot; ++ LIMIT(row, term.top, term.bot); ++ startrow = row; ++ ++ /* find the start of the last url before selection */ ++ do { ++ for (i = 0; i < term.col; ++i) { ++ if (term.line[row][i].u > 127) /* assume ascii */ ++ continue; ++ linestr[i] = term.line[row][i].u; ++ } ++ linestr[term.col] = '\0'; ++ if ((match = strstr(linestr, "http://")) ++ || (match = strstr(linestr, "https://"))) ++ break; ++ if (--row < term.top) ++ row = term.bot; ++ } while (row != startrow); ++ ++ if (match) { ++ /* must happen before trim */ ++ selclear(NULL); ++ sel.ob.x = strlen(linestr) - strlen(match); ++ ++ /* trim the rest of the line from the url match */ ++ for (c = match; *c != '\0'; ++c) ++ if (!strchr(URLCHARS, *c)) { ++ *c = '\0'; ++ break; ++ } ++ ++ /* select and copy */ ++ sel.mode = 1; ++ sel.type = SEL_REGULAR; ++ sel.oe.x = sel.ob.x + strlen(match)-1; ++ sel.ob.y = sel.oe.y = row; ++ selnormalize(); ++ tsetdirt(sel.nb.y, sel.ne.y); ++ selcopy(0); ++ } ++ ++ free(linestr); ++} diff --git a/st.suckless.org/patches/st-delkey-20160710-528241a.diff b/st.suckless.org/patches/st-delkey-20160710-528241a.diff @@ -1,45 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..458f397 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -246,7 +246,7 @@ static Key key[] = { - { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0, 0}, - { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, - { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, -- { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, -+ { XK_KP_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, - { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0, 0}, - { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0, 0}, - { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0, 0}, -@@ -301,8 +301,7 @@ static Key key[] = { - { XK_Delete, ShiftMask, "\033[2K", -1, 0, 0}, - { XK_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, - { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, -- { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, -- { XK_BackSpace, XK_NO_MOD, "\177", 0, 0, 0}, -+ { XK_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, - { XK_Home, ShiftMask, "\033[2J", 0, -1, 0}, - { XK_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, - { XK_Home, XK_ANY_MOD, "\033[H", 0, -1, 0}, -diff --git a/st.info b/st.info -index b70fefa..d979946 100644 ---- a/st.info -+++ b/st.info -@@ -53,7 +53,7 @@ st| simpleterm, - ka3=\E[5~, - kc1=\E[4~, - kc3=\E[6~, -- kbs=\177, -+ kbs=\010, - kcbt=\E[Z, - kb2=\EOu, - kcub1=\EOD, -@@ -73,7 +73,7 @@ st| simpleterm, - kri=\E[1;2A, - kclr=\E[3;5~, - kdl1=\E[3;2~, -- kdch1=\E[3~, -+ kdch1=\177~, - kich1=\E[2~, - kend=\E[4~, - kf1=\EOP, diff --git a/st.suckless.org/patches/st-delkey-20160727-308bfbf.diff b/st.suckless.org/patches/st-delkey-20160727-308bfbf.diff @@ -0,0 +1,45 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..1b52a86 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -261,7 +261,7 @@ static Key key[] = { + { XK_KP_Delete, ShiftMask, "\033[2K", -1, 0, 0}, + { XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, + { XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, +- { XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, ++ { XK_KP_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, + { XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0, 0}, + { XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0, 0}, + { XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0, 0}, +@@ -316,8 +316,7 @@ static Key key[] = { + { XK_Delete, ShiftMask, "\033[2K", -1, 0, 0}, + { XK_Delete, ShiftMask, "\033[3;2~", +1, 0, 0}, + { XK_Delete, XK_ANY_MOD, "\033[P", -1, 0, 0}, +- { XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0, 0}, +- { XK_BackSpace, XK_NO_MOD, "\177", 0, 0, 0}, ++ { XK_Delete, XK_ANY_MOD, "\177", +1, 0, 0}, + { XK_BackSpace, Mod1Mask, "\033\177", 0, 0, 0}, + { XK_Home, ShiftMask, "\033[2J", 0, -1, 0}, + { XK_Home, ShiftMask, "\033[1;2H", 0, +1, 0}, +diff --git a/st.info b/st.info +index b70fefa..d979946 100644 +--- a/st.info ++++ b/st.info +@@ -53,7 +53,7 @@ st| simpleterm, + ka3=\E[5~, + kc1=\E[4~, + kc3=\E[6~, +- kbs=\177, ++ kbs=\010, + kcbt=\E[Z, + kb2=\EOu, + kcub1=\EOD, +@@ -73,7 +73,7 @@ st| simpleterm, + kri=\E[1;2A, + kclr=\E[3;5~, + kdl1=\E[3;2~, +- kdch1=\E[3~, ++ kdch1=\177~, + kich1=\E[2~, + kend=\E[4~, + kf1=\EOP, diff --git a/st.suckless.org/patches/st-externalpipe-20160710-528241a.diff b/st.suckless.org/patches/st-externalpipe-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-hidecursor-20160710-528241a.diff b/st.suckless.org/patches/st-hidecursor-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-no_bold_colors-20160710-528241a.diff b/st.suckless.org/patches/st-no_bold_colors-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-openbsd-20160710-528241a.diff b/st.suckless.org/patches/st-openbsd-20160710-528241a.diff @@ -1,27 +0,0 @@ -diff --git a/Makefile b/Makefile -index 6158ab2..9b81f88 100644 ---- a/Makefile -+++ b/Makefile -@@ -49,7 +49,8 @@ install: all - @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 - @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 - @echo Please see the README file regarding the terminfo entry of st. -- @tic -s st.info -+ @sed 's/st\([^t].*\)/st-git\1/g' st.info > st-git.info -+ @tic -s st-git.info - - uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin -diff --git a/config.def.h b/config.def.h -index 9e61010..9c33167 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2; - static int bellvolume = 0; - - /* default TERM value */ --static char termname[] = "st-256color"; -+static char termname[] = "st-git-256color"; - - static unsigned int tabspaces = 8; - diff --git a/st.suckless.org/patches/st-openbsd-20160727-308bfbf.diff b/st.suckless.org/patches/st-openbsd-20160727-308bfbf.diff @@ -0,0 +1,27 @@ +diff --git a/Makefile b/Makefile +index 6158ab2..9b81f88 100644 +--- a/Makefile ++++ b/Makefile +@@ -49,7 +49,8 @@ install: all + @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 + @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 + @echo Please see the README file regarding the terminfo entry of st. +- @tic -s st.info ++ @sed 's/st\([^t].*\)/st-git\1/g' st.info > st-git.info ++ @tic -s st-git.info + + uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin +diff --git a/config.def.h b/config.def.h +index b41747f..60ffcb6 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -63,7 +63,7 @@ static unsigned int cursorthickness = 2; + static int bellvolume = 0; + + /* default TERM value */ +-static char termname[] = "st-256color"; ++static char termname[] = "st-git-256color"; + + /* + * spaces per tab diff --git a/st.suckless.org/patches/st-scrollback-20160710-528241a.diff b/st.suckless.org/patches/st-scrollback-20160710-528241a.diff @@ -1,387 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..0bfa5aa 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -7,6 +7,7 @@ - */ - static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; - static int borderpx = 2; -+#define histsize 2000 - - /* - * What program is execed by st depends of these precedence rules: -@@ -157,6 +158,8 @@ static Shortcut shortcuts[] = { - { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, - { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, - { MODKEY, XK_Num_Lock, numlock, {.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 2594c65..233d301 100644 ---- a/st.c -+++ b/st.c -@@ -86,6 +86,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]) - - - enum glyph_attribute { -@@ -228,26 +230,6 @@ typedef struct { - int narg; /* nb of args */ - } STREscape; - --/* Internal representation of the screen */ --typedef struct { -- int row; /* nb row */ -- int col; /* nb col */ -- Line *line; /* screen */ -- Line *alt; /* alternate screen */ -- int *dirty; /* dirtyness of lines */ -- XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */ -- TCursor c; /* cursor */ -- int top; /* top scroll limit */ -- int bot; /* bottom scroll limit */ -- int mode; /* terminal mode flags */ -- int esc; /* escape state flags */ -- char trantbl[4]; /* charset table translation */ -- int charset; /* current charset */ -- int icharset; /* selected charset for sequence */ -- int numlock; /* lock numbers in keyboard */ -- int *tabs; --} Term; -- - /* Purely graphic info */ - typedef struct { - Display *dpy; -@@ -327,6 +309,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 *); -@@ -340,6 +324,29 @@ static void sendbreak(const Arg *); - /* Config.h for applying patches and the configuration. */ - #include "config.h" - -+/* Internal representation of the screen */ -+typedef struct { -+ int row; /* nb row */ -+ int col; /* nb col */ -+ Line *line; /* screen */ -+ Line *alt; /* alternate screen */ -+ 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 */ -+ TCursor c; /* cursor */ -+ int top; /* top scroll limit */ -+ int bot; /* bottom scroll limit */ -+ int mode; /* terminal mode flags */ -+ int esc; /* escape state flags */ -+ char trantbl[4]; /* charset table translation */ -+ int charset; /* current charset */ -+ int icharset; /* selected charset for sequence */ -+ int numlock; /* lock numbers in keyboard */ -+ int *tabs; -+} Term; -+ - /* Font structure */ - typedef struct { - int height; -@@ -399,8 +406,8 @@ 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); -@@ -731,10 +738,10 @@ tlinelen(int y) - { - int i = term.col; - -- if (term.line[y][i - 1].mode & ATTR_WRAP) -+ if (TLINE(y)[i - 1].mode & ATTR_WRAP) - return i; - -- while (i > 0 && term.line[y][i - 1].u == ' ') -+ while (i > 0 && TLINE(y)[i - 1].u == ' ') - --i; - - return i; -@@ -796,7 +803,7 @@ selsnap(int *x, int *y, int direction) - * Snap around if the word wraps around at the end or - * beginning of a line. - */ -- prevgp = &term.line[*y][*x]; -+ prevgp = &TLINE(*y)[*x]; - prevdelim = ISDELIM(prevgp->u); - for (;;) { - newx = *x + direction; -@@ -811,14 +818,14 @@ selsnap(int *x, int *y, int direction) - yt = *y, xt = *x; - else - yt = newy, xt = newx; -- if (!(term.line[yt][xt].mode & ATTR_WRAP)) -+ if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) - break; - } - - if (newx >= tlinelen(newy)) - break; - -- gp = &term.line[newy][newx]; -+ gp = &TLINE(newy)[newx]; - delim = ISDELIM(gp->u); - if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim - || (delim && gp->u != prevgp->u))) -@@ -839,14 +846,14 @@ selsnap(int *x, int *y, int direction) - *x = (direction < 0) ? 0 : term.col - 1; - if (direction < 0) { - for (; *y > 0; *y += direction) { -- if (!(term.line[*y-1][term.col-1].mode -+ if (!(TLINE(*y-1)[term.col-1].mode - & ATTR_WRAP)) { - break; - } - } - } else if (direction > 0) { - for (; *y < term.row-1; *y += direction) { -- if (!(term.line[*y][term.col-1].mode -+ if (!(TLINE(*y)[term.col-1].mode - & ATTR_WRAP)) { - break; - } -@@ -1012,13 +1019,13 @@ getsel(void) - } - - if (sel.type == SEL_RECTANGULAR) { -- gp = &term.line[y][sel.nb.x]; -+ gp = &TLINE(y)[sel.nb.x]; - lastx = sel.ne.x; - } else { -- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; -+ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; - lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; - } -- last = &term.line[y][MIN(lastx, linelen-1)]; -+ last = &TLINE(y)[MIN(lastx, linelen-1)]; - while (last >= gp && last->u == ' ') - --last; - -@@ -1490,6 +1497,9 @@ ttyread(void) - /* keep any uncomplete utf8 char for the next call */ - memmove(buf, ptr, buflen); - -+ if (term.scr > 0 && term.scr < histsize-1) -+ term.scr++; -+ - return ret; - } - -@@ -1499,6 +1509,9 @@ ttywrite(const char *s, size_t n) - fd_set wfd, rfd; - ssize_t r; - size_t lim = 256; -+ Arg arg = (Arg){ .i = term.scr }; -+ -+ kscrolldown(&arg); - - /* - * Remember that we are using a pty, which might be a modem line. -@@ -1690,13 +1703,53 @@ tswapscreen(void) - } - - void --tscrolldown(int orig, int n) -+kscrolldown(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (n > term.scr) -+ n = term.scr; -+ -+ if (term.scr > 0) { -+ term.scr -= n; -+ selscroll(0, -n); -+ tfulldirt(); -+ } -+} -+ -+void -+kscrollup(const Arg* a) -+{ -+ int n = a->i; -+ -+ if (n < 0) -+ n = term.row + n; -+ -+ if (term.scr <= histsize - n) { -+ term.scr += n; -+ selscroll(0, n); -+ tfulldirt(); -+ } -+} -+ -+void -+tscrolldown(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ 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; -+ } -+ - tsetdirt(orig, term.bot-n); - tclearregion(0, term.bot-n+1, term.col-1, term.bot); - -@@ -1710,13 +1763,20 @@ tscrolldown(int orig, int n) - } - - void --tscrollup(int orig, int n) -+tscrollup(int orig, int n, int copyhist) - { - int i; - Line temp; - - LIMIT(n, 0, term.bot-orig+1); - -+ if (copyhist) { -+ term.histi = (term.histi + 1) % histsize; -+ temp = term.hist[term.histi]; -+ term.hist[term.histi] = term.line[orig]; -+ term.line[orig] = temp; -+ } -+ - tclearregion(0, orig, term.col-1, orig+n-1); - tsetdirt(orig+n, term.bot); - -@@ -1765,7 +1825,7 @@ tnewline(int first_col) - int y = term.c.y; - - if (y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - y++; - } -@@ -1930,14 +1990,14 @@ void - tinsertblankline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrolldown(term.c.y, n); -+ tscrolldown(term.c.y, n, 0); - } - - void - tdeleteline(int n) - { - if (BETWEEN(term.c.y, term.top, term.bot)) -- tscrollup(term.c.y, n); -+ tscrollup(term.c.y, n, 0); - } - - int32_t -@@ -2371,11 +2431,11 @@ csihandle(void) - break; - case 'S': /* SU -- Scroll <n> line up */ - DEFAULT(csiescseq.arg[0], 1); -- tscrollup(term.top, csiescseq.arg[0]); -+ tscrollup(term.top, csiescseq.arg[0], 0); - break; - case 'T': /* SD -- Scroll <n> line down */ - DEFAULT(csiescseq.arg[0], 1); -- tscrolldown(term.top, csiescseq.arg[0]); -+ tscrolldown(term.top, csiescseq.arg[0], 0); - break; - case 'L': /* IL -- Insert <n> blank lines */ - DEFAULT(csiescseq.arg[0], 1); -@@ -2871,7 +2931,7 @@ eschandle(uchar ascii) - return 0; - case 'D': /* IND -- Linefeed */ - if (term.c.y == term.bot) { -- tscrollup(term.top, 1); -+ tscrollup(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y+1); - } -@@ -2884,7 +2944,7 @@ eschandle(uchar ascii) - break; - case 'M': /* RI -- Reverse index */ - if (term.c.y == term.top) { -- tscrolldown(term.top, 1); -+ tscrolldown(term.top, 1, 1); - } else { - tmoveto(term.c.x, term.c.y-1); - } -@@ -3047,7 +3107,7 @@ tputc(Rune u) - void - tresize(int col, int row) - { -- int i; -+ int i, j; - int minrow = MIN(row, term.row); - int mincol = MIN(col, term.col); - int *bp; -@@ -3087,6 +3147,14 @@ 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++) { -+ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); -+ for (j = mincol; j < col; j++) { -+ term.hist[i][j] = term.c.attr; -+ term.hist[i][j].u = ' '; -+ } -+ } -+ - /* resize each row to new width, zero-pad if needed */ - for (i = 0; i < minrow; i++) { - term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); -@@ -3976,11 +4044,11 @@ drawregion(int x1, int y1, int x2, int y2) - term.dirty[y] = 0; - - specs = term.specbuf; -- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y); -+ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y); - - 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)) -@@ -4000,7 +4068,8 @@ drawregion(int x1, int y1, int x2, int y2) - if (i > 0) - xdrawglyphfontspecs(specs, base, i, ox, y); - } -- xdrawcursor(); -+ if (term.scr == 0) -+ xdrawcursor(); - } - - void diff --git a/st.suckless.org/patches/st-scrollback-20160727-308bfbf.diff b/st.suckless.org/patches/st-scrollback-20160727-308bfbf.diff @@ -0,0 +1,387 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..eae969e 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -7,6 +7,7 @@ + */ + static char font[] = "Liberation Mono:pixelsize=12:antialias=true:autohint=true"; + static int borderpx = 2; ++#define histsize 2000 + + /* + * What program is execed by st depends of these precedence rules: +@@ -172,6 +173,8 @@ static Shortcut shortcuts[] = { + { MODKEY|ShiftMask, XK_C, clipcopy, {.i = 0} }, + { MODKEY|ShiftMask, XK_V, clippaste, {.i = 0} }, + { MODKEY, XK_Num_Lock, numlock, {.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 2594c65..233d301 100644 +--- a/st.c ++++ b/st.c +@@ -86,6 +86,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]) + + + enum glyph_attribute { +@@ -228,26 +230,6 @@ typedef struct { + int narg; /* nb of args */ + } STREscape; + +-/* Internal representation of the screen */ +-typedef struct { +- int row; /* nb row */ +- int col; /* nb col */ +- Line *line; /* screen */ +- Line *alt; /* alternate screen */ +- int *dirty; /* dirtyness of lines */ +- XftGlyphFontSpec *specbuf; /* font spec buffer used for rendering */ +- TCursor c; /* cursor */ +- int top; /* top scroll limit */ +- int bot; /* bottom scroll limit */ +- int mode; /* terminal mode flags */ +- int esc; /* escape state flags */ +- char trantbl[4]; /* charset table translation */ +- int charset; /* current charset */ +- int icharset; /* selected charset for sequence */ +- int numlock; /* lock numbers in keyboard */ +- int *tabs; +-} Term; +- + /* Purely graphic info */ + typedef struct { + Display *dpy; +@@ -327,6 +309,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 *); +@@ -340,6 +324,29 @@ static void sendbreak(const Arg *); + /* Config.h for applying patches and the configuration. */ + #include "config.h" + ++/* Internal representation of the screen */ ++typedef struct { ++ int row; /* nb row */ ++ int col; /* nb col */ ++ Line *line; /* screen */ ++ Line *alt; /* alternate screen */ ++ 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 */ ++ TCursor c; /* cursor */ ++ int top; /* top scroll limit */ ++ int bot; /* bottom scroll limit */ ++ int mode; /* terminal mode flags */ ++ int esc; /* escape state flags */ ++ char trantbl[4]; /* charset table translation */ ++ int charset; /* current charset */ ++ int icharset; /* selected charset for sequence */ ++ int numlock; /* lock numbers in keyboard */ ++ int *tabs; ++} Term; ++ + /* Font structure */ + typedef struct { + int height; +@@ -399,8 +406,8 @@ 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); +@@ -731,10 +738,10 @@ tlinelen(int y) + { + int i = term.col; + +- if (term.line[y][i - 1].mode & ATTR_WRAP) ++ if (TLINE(y)[i - 1].mode & ATTR_WRAP) + return i; + +- while (i > 0 && term.line[y][i - 1].u == ' ') ++ while (i > 0 && TLINE(y)[i - 1].u == ' ') + --i; + + return i; +@@ -796,7 +803,7 @@ selsnap(int *x, int *y, int direction) + * Snap around if the word wraps around at the end or + * beginning of a line. + */ +- prevgp = &term.line[*y][*x]; ++ prevgp = &TLINE(*y)[*x]; + prevdelim = ISDELIM(prevgp->u); + for (;;) { + newx = *x + direction; +@@ -811,14 +818,14 @@ selsnap(int *x, int *y, int direction) + yt = *y, xt = *x; + else + yt = newy, xt = newx; +- if (!(term.line[yt][xt].mode & ATTR_WRAP)) ++ if (!(TLINE(yt)[xt].mode & ATTR_WRAP)) + break; + } + + if (newx >= tlinelen(newy)) + break; + +- gp = &term.line[newy][newx]; ++ gp = &TLINE(newy)[newx]; + delim = ISDELIM(gp->u); + if (!(gp->mode & ATTR_WDUMMY) && (delim != prevdelim + || (delim && gp->u != prevgp->u))) +@@ -839,14 +846,14 @@ selsnap(int *x, int *y, int direction) + *x = (direction < 0) ? 0 : term.col - 1; + if (direction < 0) { + for (; *y > 0; *y += direction) { +- if (!(term.line[*y-1][term.col-1].mode ++ if (!(TLINE(*y-1)[term.col-1].mode + & ATTR_WRAP)) { + break; + } + } + } else if (direction > 0) { + for (; *y < term.row-1; *y += direction) { +- if (!(term.line[*y][term.col-1].mode ++ if (!(TLINE(*y)[term.col-1].mode + & ATTR_WRAP)) { + break; + } +@@ -1012,13 +1019,13 @@ getsel(void) + } + + if (sel.type == SEL_RECTANGULAR) { +- gp = &term.line[y][sel.nb.x]; ++ gp = &TLINE(y)[sel.nb.x]; + lastx = sel.ne.x; + } else { +- gp = &term.line[y][sel.nb.y == y ? sel.nb.x : 0]; ++ gp = &TLINE(y)[sel.nb.y == y ? sel.nb.x : 0]; + lastx = (sel.ne.y == y) ? sel.ne.x : term.col-1; + } +- last = &term.line[y][MIN(lastx, linelen-1)]; ++ last = &TLINE(y)[MIN(lastx, linelen-1)]; + while (last >= gp && last->u == ' ') + --last; + +@@ -1490,6 +1497,9 @@ ttyread(void) + /* keep any uncomplete utf8 char for the next call */ + memmove(buf, ptr, buflen); + ++ if (term.scr > 0 && term.scr < histsize-1) ++ term.scr++; ++ + return ret; + } + +@@ -1499,6 +1509,9 @@ ttywrite(const char *s, size_t n) + fd_set wfd, rfd; + ssize_t r; + size_t lim = 256; ++ Arg arg = (Arg){ .i = term.scr }; ++ ++ kscrolldown(&arg); + + /* + * Remember that we are using a pty, which might be a modem line. +@@ -1690,13 +1703,53 @@ tswapscreen(void) + } + + void +-tscrolldown(int orig, int n) ++kscrolldown(const Arg* a) ++{ ++ int n = a->i; ++ ++ if (n < 0) ++ n = term.row + n; ++ ++ if (n > term.scr) ++ n = term.scr; ++ ++ if (term.scr > 0) { ++ term.scr -= n; ++ selscroll(0, -n); ++ tfulldirt(); ++ } ++} ++ ++void ++kscrollup(const Arg* a) ++{ ++ int n = a->i; ++ ++ if (n < 0) ++ n = term.row + n; ++ ++ if (term.scr <= histsize - n) { ++ term.scr += n; ++ selscroll(0, n); ++ tfulldirt(); ++ } ++} ++ ++void ++tscrolldown(int orig, int n, int copyhist) + { + int i; + Line temp; + + LIMIT(n, 0, term.bot-orig+1); + ++ if (copyhist) { ++ 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; ++ } ++ + tsetdirt(orig, term.bot-n); + tclearregion(0, term.bot-n+1, term.col-1, term.bot); + +@@ -1710,13 +1763,20 @@ tscrolldown(int orig, int n) + } + + void +-tscrollup(int orig, int n) ++tscrollup(int orig, int n, int copyhist) + { + int i; + Line temp; + + LIMIT(n, 0, term.bot-orig+1); + ++ if (copyhist) { ++ term.histi = (term.histi + 1) % histsize; ++ temp = term.hist[term.histi]; ++ term.hist[term.histi] = term.line[orig]; ++ term.line[orig] = temp; ++ } ++ + tclearregion(0, orig, term.col-1, orig+n-1); + tsetdirt(orig+n, term.bot); + +@@ -1765,7 +1825,7 @@ tnewline(int first_col) + int y = term.c.y; + + if (y == term.bot) { +- tscrollup(term.top, 1); ++ tscrollup(term.top, 1, 1); + } else { + y++; + } +@@ -1930,14 +1990,14 @@ void + tinsertblankline(int n) + { + if (BETWEEN(term.c.y, term.top, term.bot)) +- tscrolldown(term.c.y, n); ++ tscrolldown(term.c.y, n, 0); + } + + void + tdeleteline(int n) + { + if (BETWEEN(term.c.y, term.top, term.bot)) +- tscrollup(term.c.y, n); ++ tscrollup(term.c.y, n, 0); + } + + int32_t +@@ -2371,11 +2431,11 @@ csihandle(void) + break; + case 'S': /* SU -- Scroll <n> line up */ + DEFAULT(csiescseq.arg[0], 1); +- tscrollup(term.top, csiescseq.arg[0]); ++ tscrollup(term.top, csiescseq.arg[0], 0); + break; + case 'T': /* SD -- Scroll <n> line down */ + DEFAULT(csiescseq.arg[0], 1); +- tscrolldown(term.top, csiescseq.arg[0]); ++ tscrolldown(term.top, csiescseq.arg[0], 0); + break; + case 'L': /* IL -- Insert <n> blank lines */ + DEFAULT(csiescseq.arg[0], 1); +@@ -2871,7 +2931,7 @@ eschandle(uchar ascii) + return 0; + case 'D': /* IND -- Linefeed */ + if (term.c.y == term.bot) { +- tscrollup(term.top, 1); ++ tscrollup(term.top, 1, 1); + } else { + tmoveto(term.c.x, term.c.y+1); + } +@@ -2884,7 +2944,7 @@ eschandle(uchar ascii) + break; + case 'M': /* RI -- Reverse index */ + if (term.c.y == term.top) { +- tscrolldown(term.top, 1); ++ tscrolldown(term.top, 1, 1); + } else { + tmoveto(term.c.x, term.c.y-1); + } +@@ -3047,7 +3107,7 @@ tputc(Rune u) + void + tresize(int col, int row) + { +- int i; ++ int i, j; + int minrow = MIN(row, term.row); + int mincol = MIN(col, term.col); + int *bp; +@@ -3087,6 +3147,14 @@ 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++) { ++ term.hist[i] = xrealloc(term.hist[i], col * sizeof(Glyph)); ++ for (j = mincol; j < col; j++) { ++ term.hist[i][j] = term.c.attr; ++ term.hist[i][j].u = ' '; ++ } ++ } ++ + /* resize each row to new width, zero-pad if needed */ + for (i = 0; i < minrow; i++) { + term.line[i] = xrealloc(term.line[i], col * sizeof(Glyph)); +@@ -3976,11 +4044,11 @@ drawregion(int x1, int y1, int x2, int y2) + term.dirty[y] = 0; + + specs = term.specbuf; +- numspecs = xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, y); ++ numspecs = xmakeglyphfontspecs(specs, &TLINE(y)[x1], x2 - x1, x1, y); + + 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)) +@@ -4000,7 +4068,8 @@ drawregion(int x1, int y1, int x2, int y2) + if (i > 0) + xdrawglyphfontspecs(specs, base, i, ox, y); + } +- xdrawcursor(); ++ if (term.scr == 0) ++ xdrawcursor(); + } + + void diff --git a/st.suckless.org/patches/st-scrollback-mouse-20160710-528241a.diff b/st.suckless.org/patches/st-scrollback-mouse-20160710-528241a.diff @@ -1,62 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..f69b7d1 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -136,8 +136,14 @@ static unsigned int defaultunderline = 7; - */ - static MouseShortcut mshortcuts[] = { - /* button mask string */ -- { Button4, XK_ANY_MOD, "\031" }, -- { Button5, XK_ANY_MOD, "\005" }, -+ { Button4, XK_NO_MOD, "\031" }, -+ { Button5, XK_NO_MOD, "\005" }, -+}; -+ -+static 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 2594c65..9744bcf 100644 ---- a/st.c -+++ b/st.c -@@ -318,6 +318,13 @@ typedef union { - } Arg; - - typedef struct { -+ uint b; -+ uint mask; -+ void (*func)(const Arg *); -+ const Arg arg; -+} MouseKey; -+ -+typedef struct { - uint mod; - KeySym keysym; - void (*func)(const Arg *); -@@ -946,6 +953,7 @@ bpress(XEvent *e) - { - struct timespec now; - MouseShortcut *ms; -+ MouseKey *mk; - - if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { - mousereport(e); -@@ -960,6 +968,14 @@ bpress(XEvent *e) - } - } - -+ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { -+ if (e->xbutton.button == mk->b -+ && match(mk->mask, e->xbutton.state)) { -+ mk->func(&mk->arg); -+ return; -+ } -+ } -+ - if (e->xbutton.button == Button1) { - clock_gettime(CLOCK_MONOTONIC, &now); - diff --git a/st.suckless.org/patches/st-scrollback-mouse-20160727-308bfbf.diff b/st.suckless.org/patches/st-scrollback-mouse-20160727-308bfbf.diff @@ -0,0 +1,62 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..5ab8d2e 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -151,8 +151,14 @@ static unsigned int defaultunderline = 7; + */ + static MouseShortcut mshortcuts[] = { + /* button mask string */ +- { Button4, XK_ANY_MOD, "\031" }, +- { Button5, XK_ANY_MOD, "\005" }, ++ { Button4, XK_NO_MOD, "\031" }, ++ { Button5, XK_NO_MOD, "\005" }, ++}; ++ ++static 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 2594c65..9744bcf 100644 +--- a/st.c ++++ b/st.c +@@ -318,6 +318,13 @@ typedef union { + } Arg; + + typedef struct { ++ uint b; ++ uint mask; ++ void (*func)(const Arg *); ++ const Arg arg; ++} MouseKey; ++ ++typedef struct { + uint mod; + KeySym keysym; + void (*func)(const Arg *); +@@ -946,6 +953,7 @@ bpress(XEvent *e) + { + struct timespec now; + MouseShortcut *ms; ++ MouseKey *mk; + + if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) { + mousereport(e); +@@ -960,6 +968,14 @@ bpress(XEvent *e) + } + } + ++ for (mk = mkeys; mk < mkeys + LEN(mkeys); mk++) { ++ if (e->xbutton.button == mk->b ++ && match(mk->mask, e->xbutton.state)) { ++ mk->func(&mk->arg); ++ return; ++ } ++ } ++ + if (e->xbutton.button == Button1) { + clock_gettime(CLOCK_MONOTONIC, &now); + diff --git a/st.suckless.org/patches/st-scrollback-mouse-altscreen-20160710-528241a.diff b/st.suckless.org/patches/st-scrollback-mouse-altscreen-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-solarized-both-20160710-528241a.diff b/st.suckless.org/patches/st-solarized-both-20160710-528241a.diff @@ -1,189 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..064f5e9 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -69,42 +69,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 -@@ -157,6 +169,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/st.suckless.org/patches/st-solarized-both-20160727-308bfbf.diff b/st.suckless.org/patches/st-solarized-both-20160727-308bfbf.diff @@ -0,0 +1,189 @@ +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/st.suckless.org/patches/st-solarized-dark-20160710-528241a.diff b/st.suckless.org/patches/st-solarized-dark-20160710-528241a.diff @@ -1,68 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..df5beb8 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -69,31 +69,23 @@ 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 */ - }; - - -@@ -101,10 +93,10 @@ static const char *colorname[] = { - * 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 diff --git a/st.suckless.org/patches/st-solarized-dark-20160727-308bfbf.diff b/st.suckless.org/patches/st-solarized-dark-20160727-308bfbf.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..8bdcc87 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -84,31 +84,23 @@ 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 */ + }; + + +@@ -116,10 +108,10 @@ static const char *colorname[] = { + * 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 diff --git a/st.suckless.org/patches/st-solarized-light-20160710-528241a.diff b/st.suckless.org/patches/st-solarized-light-20160710-528241a.diff @@ -1,68 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 9e61010..a389c04 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -69,31 +69,23 @@ 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 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 */ - }; - - -@@ -101,10 +93,10 @@ static const char *colorname[] = { - * 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 diff --git a/st.suckless.org/patches/st-solarized-light-20160727-308bfbf.diff b/st.suckless.org/patches/st-solarized-light-20160727-308bfbf.diff @@ -0,0 +1,68 @@ +diff --git a/config.def.h b/config.def.h +index b41747f..5a87570 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -84,31 +84,23 @@ 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 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 */ + }; + + +@@ -116,10 +108,10 @@ static const char *colorname[] = { + * 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 diff --git a/st.suckless.org/patches/st-spoiler-20160710-528241a.diff b/st.suckless.org/patches/st-spoiler-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/st-visualbell-20160710-528241a.diff b/st.suckless.org/patches/st-visualbell-20160727-308bfbf.diff diff --git a/st.suckless.org/patches/visualbell.md b/st.suckless.org/patches/visualbell.md @@ -16,7 +16,7 @@ monitor. Download -------- - * [st-visualbell-20160710-528241a.diff](st-visualbell-20160710-528241a.diff) + * [st-visualbell-20160727-308bfbf.diff](st-visualbell-20160727-308bfbf.diff) Authors -------