1 diff --git a/config.def.h b/config.def.h
2 index 91ab8ca..6af616e 100644
5 @@ -93,6 +93,9 @@ char *termname = "st-256color";
7 unsigned int tabspaces = 8;
12 /* Terminal colors (16 first used in escape sequence) */
13 static const char *colorname[] = {
15 diff --git a/config.mk b/config.mk
16 index 4c4c5d5..0114bad 100644
19 @@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config
21 `$(PKG_CONFIG) --cflags fontconfig` \
22 `$(PKG_CONFIG) --cflags freetype2`
23 -LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \
24 +LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
25 `$(PKG_CONFIG) --libs fontconfig` \
26 `$(PKG_CONFIG) --libs freetype2`
28 diff --git a/st.h b/st.h
29 index 519b9bd..8bb533d 100644
32 @@ -126,3 +126,4 @@ extern unsigned int tabspaces;
33 extern unsigned int defaultfg;
34 extern unsigned int defaultbg;
35 extern unsigned int defaultcs;
37 diff --git a/x.c b/x.c
38 index 8a16faa..ddf4178 100644
41 @@ -105,6 +105,7 @@ typedef struct {
42 XSetWindowAttributes attrs;
44 int isfixed; /* is fixed geometry? */
45 + int depth; /* bit depth */
46 int l, t; /* left and top offset */
47 int gm; /* geometry mask */
49 @@ -243,6 +244,7 @@ static char *usedfont = NULL;
50 static double usedfontsize = 0;
51 static double defaultfontsize = 0;
53 +static char *opt_alpha = NULL;
54 static char *opt_class = NULL;
55 static char **opt_cmd = NULL;
56 static char *opt_embed = NULL;
57 @@ -736,7 +738,7 @@ xresize(int col, int row)
59 XFreePixmap(xw.dpy, xw.buf);
60 xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
61 - DefaultDepth(xw.dpy, xw.scr));
63 XftDrawChange(xw.draw, xw.buf);
64 xclear(0, 0, win.w, win.h);
66 @@ -796,6 +798,13 @@ xloadcols(void)
68 die("could not allocate color %d\n", i);
71 + /* set alpha value of bg color */
73 + alpha = strtof(opt_alpha, NULL);
74 + dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha);
75 + dc.col[defaultbg].pixel &= 0x00FFFFFF;
76 + dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24;
80 @@ -1118,11 +1127,23 @@ xinit(int cols, int rows)
82 pid_t thispid = getpid();
83 XColor xmousefg, xmousebg;
84 + XWindowAttributes attr;
87 if (!(xw.dpy = XOpenDisplay(NULL)))
88 die("can't open display\n");
89 xw.scr = XDefaultScreen(xw.dpy);
90 - xw.vis = XDefaultVisual(xw.dpy, xw.scr);
92 + if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) {
93 + parent = XRootWindow(xw.dpy, xw.scr);
96 + XGetWindowAttributes(xw.dpy, parent, &attr);
97 + xw.depth = attr.depth;
100 + XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis);
101 + xw.vis = vis.visual;
105 @@ -1132,7 +1153,7 @@ xinit(int cols, int rows)
106 xloadfonts(usedfont, 0);
109 - xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
110 + xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None);
113 /* adjust fixed window geometry */
114 @@ -1152,19 +1173,15 @@ xinit(int cols, int rows)
115 | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
116 xw.attrs.colormap = xw.cmap;
118 - if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0))))
119 - parent = XRootWindow(xw.dpy, xw.scr);
120 xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t,
121 - win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
122 + win.w, win.h, 0, xw.depth, InputOutput,
123 xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
124 | CWEventMask | CWColormap, &xw.attrs);
126 memset(&gcvalues, 0, sizeof(gcvalues));
127 gcvalues.graphics_exposures = False;
128 - dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures,
130 - xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h,
131 - DefaultDepth(xw.dpy, xw.scr));
132 + xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth);
133 + dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues);
134 XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
135 XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h);
137 @@ -2019,6 +2036,9 @@ main(int argc, char *argv[])
142 + opt_alpha = EARGF(usage());
145 opt_class = EARGF(usage());