diff options
| author | bakkeby <[email protected]> | 2019-09-05 00:32:39 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2019-09-05 13:35:52 +0200 |
| commit | 2c9a889b22fd0e92f64ab6d35584f24e4076ddd8 (patch) | |
| tree | 946d823737e0f4f48aec481b9b7c6b0e90510ee9 /patch | |
| parent | c34c536f3eabd0ede74b3e3de5fc7119984d5f5f (diff) | |
| download | dwm-flexipatch-2c9a889b22fd0e92f64ab6d35584f24e4076ddd8.tar.gz dwm-flexipatch-2c9a889b22fd0e92f64ab6d35584f24e4076ddd8.zip | |
Adding README.md
Diffstat (limited to 'patch')
| -rw-r--r-- | patch/alpha.c | 42 | ||||
| -rw-r--r-- | patch/alpha.h | 3 | ||||
| -rw-r--r-- | patch/include.c | 5 | ||||
| -rw-r--r-- | patch/include.h | 5 |
4 files changed, 55 insertions, 0 deletions
diff --git a/patch/alpha.c b/patch/alpha.c new file mode 100644 index 0000000..7da7215 --- /dev/null +++ b/patch/alpha.c @@ -0,0 +1,42 @@ + +static int useargb = 0; +static Visual *visual; +static int depth; +static Colormap cmap; + +void +xinitvisual() +{ + XVisualInfo *infos; + XRenderPictFormat *fmt; + int nitems; + int i; + + XVisualInfo tpl = { + .screen = screen, + .depth = 32, + .class = TrueColor + }; + long masks = VisualScreenMask | VisualDepthMask | VisualClassMask; + + infos = XGetVisualInfo(dpy, masks, &tpl, &nitems); + visual = NULL; + for (i = 0; i < nitems; i ++) { + fmt = XRenderFindVisualFormat(dpy, infos[i].visual); + if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) { + visual = infos[i].visual; + depth = infos[i].depth; + cmap = XCreateColormap(dpy, root, visual, AllocNone); + useargb = 1; + break; + } + } + + XFree(infos); + + if (! visual) { + visual = DefaultVisual(dpy, screen); + depth = DefaultDepth(dpy, screen); + cmap = DefaultColormap(dpy, screen); + } +} diff --git a/patch/alpha.h b/patch/alpha.h new file mode 100644 index 0000000..3c81522 --- /dev/null +++ b/patch/alpha.h @@ -0,0 +1,3 @@ +#define OPAQUE 0xffU + +static void xinitvisual(); diff --git a/patch/include.c b/patch/include.c new file mode 100644 index 0000000..de31d1e --- /dev/null +++ b/patch/include.c @@ -0,0 +1,5 @@ + +#if ALPHA_PATCH +#include "alpha.c" +#endif + diff --git a/patch/include.h b/patch/include.h new file mode 100644 index 0000000..c5c8947 --- /dev/null +++ b/patch/include.h @@ -0,0 +1,5 @@ + +#if ALPHA_PATCH +#include "alpha.h" +#endif + |
