diff options
| -rw-r--r-- | config.def.h | 6 | ||||
| -rw-r--r-- | config.h | 6 | ||||
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | st.h | 1 | ||||
| -rw-r--r-- | x.c | 40 |
5 files changed, 13 insertions, 42 deletions
diff --git a/config.def.h b/config.def.h index 85a1d17..546edda 100644 --- a/config.def.h +++ b/config.def.h | |||
| @@ -82,9 +82,6 @@ char *termname = "st-256color"; | |||
| 82 | */ | 82 | */ |
| 83 | unsigned int tabspaces = 8; | 83 | unsigned int tabspaces = 8; |
| 84 | 84 | ||
| 85 | /* bg opacity */ | ||
| 86 | float alpha = 0.8; | ||
| 87 | |||
| 88 | /* Terminal colors (16 first used in escape sequence) */ | 85 | /* Terminal colors (16 first used in escape sequence) */ |
| 89 | static const char *colorname[] = { | 86 | static const char *colorname[] = { |
| 90 | /* 8 normal colors */ | 87 | /* 8 normal colors */ |
| @@ -112,7 +109,6 @@ static const char *colorname[] = { | |||
| 112 | /* more colors can be added after 255 to use with DefaultXX */ | 109 | /* more colors can be added after 255 to use with DefaultXX */ |
| 113 | "#cccccc", | 110 | "#cccccc", |
| 114 | "#555555", | 111 | "#555555", |
| 115 | "black", | ||
| 116 | }; | 112 | }; |
| 117 | 113 | ||
| 118 | 114 | ||
| @@ -121,7 +117,7 @@ static const char *colorname[] = { | |||
| 121 | * foreground, background, cursor, reverse cursor | 117 | * foreground, background, cursor, reverse cursor |
| 122 | */ | 118 | */ |
| 123 | unsigned int defaultfg = 7; | 119 | unsigned int defaultfg = 7; |
| 124 | unsigned int defaultbg = 258; | 120 | unsigned int defaultbg = 0; |
| 125 | static unsigned int defaultcs = 256; | 121 | static unsigned int defaultcs = 256; |
| 126 | static unsigned int defaultrcs = 257; | 122 | static unsigned int defaultrcs = 257; |
| 127 | 123 | ||
| @@ -87,9 +87,6 @@ char *termname = "st-256color"; | |||
| 87 | */ | 87 | */ |
| 88 | unsigned int tabspaces = 8; | 88 | unsigned int tabspaces = 8; |
| 89 | 89 | ||
| 90 | /* bg opacity */ | ||
| 91 | float alpha = 0.8; | ||
| 92 | |||
| 93 | /* Terminal colors (16 first used in escape sequence) */ | 90 | /* Terminal colors (16 first used in escape sequence) */ |
| 94 | static const char *colorname[] = { | 91 | static const char *colorname[] = { |
| 95 | /* 8 normal colors */ | 92 | /* 8 normal colors */ |
| @@ -117,7 +114,6 @@ static const char *colorname[] = { | |||
| 117 | /* more colors can be added after 255 to use with DefaultXX */ | 114 | /* more colors can be added after 255 to use with DefaultXX */ |
| 118 | "#cccccc", | 115 | "#cccccc", |
| 119 | "#555555", | 116 | "#555555", |
| 120 | "black", | ||
| 121 | }; | 117 | }; |
| 122 | 118 | ||
| 123 | 119 | ||
| @@ -126,7 +122,7 @@ static const char *colorname[] = { | |||
| 126 | * foreground, background, cursor, reverse cursor | 122 | * foreground, background, cursor, reverse cursor |
| 127 | */ | 123 | */ |
| 128 | unsigned int defaultfg = 7; | 124 | unsigned int defaultfg = 7; |
| 129 | unsigned int defaultbg = 258; | 125 | unsigned int defaultbg = 0; |
| 130 | static unsigned int defaultcs = 256; | 126 | static unsigned int defaultcs = 256; |
| 131 | static unsigned int defaultrcs = 257; | 127 | static unsigned int defaultrcs = 257; |
| 132 | 128 | ||
| @@ -16,7 +16,7 @@ PKG_CONFIG = pkg-config | |||
| 16 | INCS = -I$(X11INC) \ | 16 | INCS = -I$(X11INC) \ |
| 17 | `$(PKG_CONFIG) --cflags fontconfig` \ | 17 | `$(PKG_CONFIG) --cflags fontconfig` \ |
| 18 | `$(PKG_CONFIG) --cflags freetype2` | 18 | `$(PKG_CONFIG) --cflags freetype2` |
| 19 | LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\ | 19 | LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft \ |
| 20 | `$(PKG_CONFIG) --libs fontconfig` \ | 20 | `$(PKG_CONFIG) --libs fontconfig` \ |
| 21 | `$(PKG_CONFIG) --libs freetype2` | 21 | `$(PKG_CONFIG) --libs freetype2` |
| 22 | 22 | ||
| @@ -121,4 +121,3 @@ extern char *termname; | |||
| 121 | extern unsigned int tabspaces; | 121 | extern unsigned int tabspaces; |
| 122 | extern unsigned int defaultfg; | 122 | extern unsigned int defaultfg; |
| 123 | extern unsigned int defaultbg; | 123 | extern unsigned int defaultbg; |
| 124 | extern float alpha; | ||
| @@ -105,7 +105,6 @@ typedef struct { | |||
| 105 | XSetWindowAttributes attrs; | 105 | XSetWindowAttributes attrs; |
| 106 | int scr; | 106 | int scr; |
| 107 | int isfixed; /* is fixed geometry? */ | 107 | int isfixed; /* is fixed geometry? */ |
| 108 | int depth; /* bit depth */ | ||
| 109 | int l, t; /* left and top offset */ | 108 | int l, t; /* left and top offset */ |
| 110 | int gm; /* geometry mask */ | 109 | int gm; /* geometry mask */ |
| 111 | } XWindow; | 110 | } XWindow; |
| @@ -245,7 +244,6 @@ static char *usedfont = NULL; | |||
| 245 | static double usedfontsize = 0; | 244 | static double usedfontsize = 0; |
| 246 | static double defaultfontsize = 0; | 245 | static double defaultfontsize = 0; |
| 247 | 246 | ||
| 248 | static char *opt_alpha = NULL; | ||
| 249 | static char *opt_class = NULL; | 247 | static char *opt_class = NULL; |
| 250 | static char **opt_cmd = NULL; | 248 | static char **opt_cmd = NULL; |
| 251 | static char *opt_embed = NULL; | 249 | static char *opt_embed = NULL; |
| @@ -724,7 +722,7 @@ xresize(int col, int row) | |||
| 724 | 722 | ||
| 725 | XFreePixmap(xw.dpy, xw.buf); | 723 | XFreePixmap(xw.dpy, xw.buf); |
| 726 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, | 724 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, |
| 727 | xw.depth); | 725 | DefaultDepth(xw.dpy, xw.scr)); |
| 728 | XftDrawChange(xw.draw, xw.buf); | 726 | XftDrawChange(xw.draw, xw.buf); |
| 729 | xclear(0, 0, win.w, win.h); | 727 | xclear(0, 0, win.w, win.h); |
| 730 | 728 | ||
| @@ -784,13 +782,6 @@ xloadcols(void) | |||
| 784 | else | 782 | else |
| 785 | die("could not allocate color %d\n", i); | 783 | die("could not allocate color %d\n", i); |
| 786 | } | 784 | } |
| 787 | |||
| 788 | /* set alpha value of bg color */ | ||
| 789 | if (opt_alpha) | ||
| 790 | alpha = strtof(opt_alpha, NULL); | ||
| 791 | dc.col[defaultbg].color.alpha = (unsigned short)(0xffff * alpha); | ||
| 792 | dc.col[defaultbg].pixel &= 0x00FFFFFF; | ||
| 793 | dc.col[defaultbg].pixel |= (unsigned char)(0xff * alpha) << 24; | ||
| 794 | loaded = 1; | 785 | loaded = 1; |
| 795 | } | 786 | } |
| 796 | 787 | ||
| @@ -1196,23 +1187,11 @@ xinit(int cols, int rows) | |||
| 1196 | Window parent; | 1187 | Window parent; |
| 1197 | pid_t thispid = getpid(); | 1188 | pid_t thispid = getpid(); |
| 1198 | XColor xmousefg, xmousebg; | 1189 | XColor xmousefg, xmousebg; |
| 1199 | XWindowAttributes attr; | ||
| 1200 | XVisualInfo vis; | ||
| 1201 | 1190 | ||
| 1202 | if (!(xw.dpy = XOpenDisplay(NULL))) | 1191 | if (!(xw.dpy = XOpenDisplay(NULL))) |
| 1203 | die("can't open display\n"); | 1192 | die("can't open display\n"); |
| 1204 | xw.scr = XDefaultScreen(xw.dpy); | 1193 | xw.scr = XDefaultScreen(xw.dpy); |
| 1205 | 1194 | xw.vis = XDefaultVisual(xw.dpy, xw.scr); | |
| 1206 | if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) { | ||
| 1207 | parent = XRootWindow(xw.dpy, xw.scr); | ||
| 1208 | xw.depth = 32; | ||
| 1209 | } else { | ||
| 1210 | XGetWindowAttributes(xw.dpy, parent, &attr); | ||
| 1211 | xw.depth = attr.depth; | ||
| 1212 | } | ||
| 1213 | |||
| 1214 | XMatchVisualInfo(xw.dpy, xw.scr, xw.depth, TrueColor, &vis); | ||
| 1215 | xw.vis = vis.visual; | ||
| 1216 | 1195 | ||
| 1217 | /* font */ | 1196 | /* font */ |
| 1218 | if (!FcInit()) | 1197 | if (!FcInit()) |
| @@ -1225,7 +1204,7 @@ xinit(int cols, int rows) | |||
| 1225 | xloadsparefonts(); | 1204 | xloadsparefonts(); |
| 1226 | 1205 | ||
| 1227 | /* colors */ | 1206 | /* colors */ |
| 1228 | xw.cmap = XCreateColormap(xw.dpy, parent, xw.vis, None); | 1207 | xw.cmap = XDefaultColormap(xw.dpy, xw.scr); |
| 1229 | xloadcols(); | 1208 | xloadcols(); |
| 1230 | 1209 | ||
| 1231 | /* adjust fixed window geometry */ | 1210 | /* adjust fixed window geometry */ |
| @@ -1245,15 +1224,19 @@ xinit(int cols, int rows) | |||
| 1245 | | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; | 1224 | | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask; |
| 1246 | xw.attrs.colormap = xw.cmap; | 1225 | xw.attrs.colormap = xw.cmap; |
| 1247 | 1226 | ||
| 1227 | if (!(opt_embed && (parent = strtol(opt_embed, NULL, 0)))) | ||
| 1228 | parent = XRootWindow(xw.dpy, xw.scr); | ||
| 1248 | xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, | 1229 | xw.win = XCreateWindow(xw.dpy, parent, xw.l, xw.t, |
| 1249 | win.w, win.h, 0, xw.depth, InputOutput, | 1230 | win.w, win.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput, |
| 1250 | xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity | 1231 | xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity |
| 1251 | | CWEventMask | CWColormap, &xw.attrs); | 1232 | | CWEventMask | CWColormap, &xw.attrs); |
| 1252 | 1233 | ||
| 1253 | memset(&gcvalues, 0, sizeof(gcvalues)); | 1234 | memset(&gcvalues, 0, sizeof(gcvalues)); |
| 1254 | gcvalues.graphics_exposures = False; | 1235 | gcvalues.graphics_exposures = False; |
| 1255 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, xw.depth); | 1236 | dc.gc = XCreateGC(xw.dpy, parent, GCGraphicsExposures, |
| 1256 | dc.gc = XCreateGC(xw.dpy, xw.buf, GCGraphicsExposures, &gcvalues); | 1237 | &gcvalues); |
| 1238 | xw.buf = XCreatePixmap(xw.dpy, xw.win, win.w, win.h, | ||
| 1239 | DefaultDepth(xw.dpy, xw.scr)); | ||
| 1257 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); | 1240 | XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel); |
| 1258 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); | 1241 | XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, win.w, win.h); |
| 1259 | 1242 | ||
| @@ -2098,9 +2081,6 @@ main(int argc, char *argv[]) | |||
| 2098 | case 'a': | 2081 | case 'a': |
| 2099 | allowaltscreen = 0; | 2082 | allowaltscreen = 0; |
| 2100 | break; | 2083 | break; |
| 2101 | case 'A': | ||
| 2102 | opt_alpha = EARGF(usage()); | ||
| 2103 | break; | ||
| 2104 | case 'c': | 2084 | case 'c': |
| 2105 | opt_class = EARGF(usage()); | 2085 | opt_class = EARGF(usage()); |
| 2106 | break; | 2086 | break; |
