Compare commits
10 Commits
7473a8d1a5
...
04e51b1ef1
Author | SHA1 | Date |
---|---|---|
The Magician | 04e51b1ef1 | |
The Magician | 2e1c631b64 | |
Lucas de Sena | a0274bc20e | |
Hiltjo Posthuma | 5dbcca4926 | |
Hiltjo Posthuma | d63b9eb902 | |
DOGMAN | 497a756382 | |
Hiltjo Posthuma | 8c68ec5241 | |
Hiltjo Posthuma | 5ce9716281 | |
Hiltjo Posthuma | f20e169a20 | |
Tommi Hirvola | 95f22c5305 |
|
@ -0,0 +1,4 @@
|
|||
patches/
|
||||
st
|
||||
*.o
|
||||
config.h
|
|
@ -53,7 +53,7 @@ int allowwindowops = 0;
|
|||
* near minlatency, but it waits longer for slow updates to avoid partial draw.
|
||||
* low minlatency will tear/flicker more, as it can "detect" idle too early.
|
||||
*/
|
||||
static double minlatency = 8;
|
||||
static double minlatency = 2;
|
||||
static double maxlatency = 33;
|
||||
|
||||
/*
|
||||
|
@ -93,6 +93,9 @@ char *termname = "st-256color";
|
|||
*/
|
||||
unsigned int tabspaces = 8;
|
||||
|
||||
/* bg opacity */
|
||||
float alpha = 0.8;
|
||||
|
||||
/* Terminal colors (16 first used in escape sequence) */
|
||||
static const char *colorname[] = {
|
||||
/* 8 normal colors */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# st version
|
||||
VERSION = 0.9
|
||||
VERSION = 0.9.2
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
|
|||
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`
|
||||
|
||||
|
|
17
st.c
17
st.c
|
@ -86,8 +86,8 @@ enum escape_state {
|
|||
|
||||
typedef struct {
|
||||
Glyph attr; /* current char attributes */
|
||||
int x; /* terminal column */
|
||||
int y; /* terminal row */
|
||||
int x;
|
||||
int y;
|
||||
char state;
|
||||
} TCursor;
|
||||
|
||||
|
@ -1132,6 +1132,7 @@ csiparse(void)
|
|||
{
|
||||
char *p = csiescseq.buf, *np;
|
||||
long int v;
|
||||
int sep = ';'; /* colon or semi-colon, but not both */
|
||||
|
||||
csiescseq.narg = 0;
|
||||
if (*p == '?') {
|
||||
|
@ -1149,7 +1150,9 @@ csiparse(void)
|
|||
v = -1;
|
||||
csiescseq.arg[csiescseq.narg++] = v;
|
||||
p = np;
|
||||
if (*p != ';' || csiescseq.narg == ESC_ARG_SIZ)
|
||||
if (sep == ';' && *p == ':')
|
||||
sep = ':'; /* allow override to colon once */
|
||||
if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
|
@ -1643,7 +1646,7 @@ csihandle(void)
|
|||
ttywrite(vtiden, strlen(vtiden), 0);
|
||||
break;
|
||||
case 'b': /* REP -- if last char is printable print it <n> more times */
|
||||
DEFAULT(csiescseq.arg[0], 1);
|
||||
LIMIT(csiescseq.arg[0], 1, 65535);
|
||||
if (term.lastc)
|
||||
while (csiescseq.arg[0]-- > 0)
|
||||
tputc(term.lastc);
|
||||
|
@ -2175,16 +2178,12 @@ tstrsequence(uchar c)
|
|||
void
|
||||
tcontrolcode(uchar ascii)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
switch (ascii) {
|
||||
case '\t': /* HT */
|
||||
tputtab(1);
|
||||
return;
|
||||
case '\b': /* BS */
|
||||
for (i = 1; term.c.x && term.line[term.c.y][term.c.x - i].u == 0; ++i)
|
||||
;
|
||||
tmoveto(term.c.x - i, term.c.y);
|
||||
tmoveto(term.c.x-1, term.c.y);
|
||||
return;
|
||||
case '\r': /* CR */
|
||||
tmoveto(0, term.c.y);
|
||||
|
|
1
st.h
1
st.h
|
@ -124,3 +124,4 @@ extern unsigned int tabspaces;
|
|||
extern unsigned int defaultfg;
|
||||
extern unsigned int defaultbg;
|
||||
extern unsigned int defaultcs;
|
||||
extern float alpha;
|
||||
|
|
53
x.c
53
x.c
|
@ -105,6 +105,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;
|
||||
|
@ -243,6 +244,7 @@ static char *usedfont = NULL;
|
|||
static double usedfontsize = 0;
|
||||
static double defaultfontsize = 0;
|
||||
|
||||
static char *opt_alpha = NULL;
|
||||
static char *opt_class = NULL;
|
||||
static char **opt_cmd = NULL;
|
||||
static char *opt_embed = NULL;
|
||||
|
@ -752,7 +754,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);
|
||||
|
||||
|
@ -812,6 +814,13 @@ xloadcols(void)
|
|||
else
|
||||
die("could not allocate color %d\n", i);
|
||||
}
|
||||
|
||||
/* set alpha value of bg color */
|
||||
if (opt_alpha)
|
||||
alpha = strtof(opt_alpha, NULL);
|
||||
dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
|
||||
dc.col[defaultbg].pixel &= 0x00FFFFFF;
|
||||
dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
|
||||
loaded = 1;
|
||||
}
|
||||
|
||||
|
@ -1131,14 +1140,26 @@ xinit(int cols, int rows)
|
|||
{
|
||||
XGCValues gcvalues;
|
||||
Cursor cursor;
|
||||
Window parent;
|
||||
Window parent, root;
|
||||
pid_t thispid = getpid();
|
||||
XColor xmousefg, xmousebg;
|
||||
XWindowAttributes attr;
|
||||
XVisualInfo vis;
|
||||
|
||||
if (!(xw.dpy = XOpenDisplay(NULL)))
|
||||
die("can't open display\n");
|
||||
xw.scr = XDefaultScreen(xw.dpy);
|
||||
xw.vis = XDefaultVisual(xw.dpy, xw.scr);
|
||||
|
||||
if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
|
||||
parent = XRootWindow(xw.dpy, xw.scr);
|
||||
xw.depth = 32;
|
||||
} else {
|
||||
XGetWindowAttributes(xw.dpy, parent, &attr);
|
||||
xw.depth = attr.depth;
|
||||
}
|
||||
|
||||
XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
|
||||
xw.vis = vis.visual;
|
||||
|
||||
/* font */
|
||||
if (!FcInit())
|
||||
|
@ -1148,7 +1169,7 @@ xinit(int cols, int rows)
|
|||
xloadfonts(usedfont, 0);
|
||||
|
||||
/* colors */
|
||||
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
|
||||
xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
|
||||
xloadcols();
|
||||
|
||||
/* adjust fixed window geometry */
|
||||
|
@ -1168,19 +1189,20 @@ xinit(int cols, int rows)
|
|||
| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||
xw.attrs.colormap = xw.cmap;
|
||||
|
||||
root = XRootWindow(xw.dpy, xw.scr);
|
||||
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,
|
||||
parent = root;
|
||||
xw.win = XCreateWindow(xw.dpy, root, xw.l, xw.t,
|
||||
win.w, win.h, 0, xw.depth, InputOutput,
|
||||
xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
|
||||
| CWEventMask | CWColormap, &xw.attrs);
|
||||
if (parent != root)
|
||||
XReparentWindow(xw.dpy, xw.win, parent, xw.l, xw.t);
|
||||
|
||||
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, xw.buf, GCGraphicsExposures, &gcvalues);
|
||||
XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
|
||||
XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
|
||||
|
||||
|
@ -1617,6 +1639,9 @@ xseticontitle(char *p)
|
|||
XTextProperty prop;
|
||||
DEFAULT(p, opt_title);
|
||||
|
||||
if (p[0] == '\0')
|
||||
p = opt_title;
|
||||
|
||||
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
|
||||
&prop) != Success)
|
||||
return;
|
||||
|
@ -1631,6 +1656,9 @@ xsettitle(char *p)
|
|||
XTextProperty prop;
|
||||
DEFAULT(p, opt_title);
|
||||
|
||||
if (p[0] == '\0')
|
||||
p = opt_title;
|
||||
|
||||
if (Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
|
||||
&prop) != Success)
|
||||
return;
|
||||
|
@ -2038,6 +2066,9 @@ main(int argc, char *argv[])
|
|||
case 'a':
|
||||
allowaltscreen = 0;
|
||||
break;
|
||||
case 'A':
|
||||
opt_alpha = EARGF(usage());
|
||||
break;
|
||||
case 'c':
|
||||
opt_class = EARGF(usage());
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue