summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Guschin <saintruler@gmail.com>2021-09-22 13:26:49 +0400
committerAndrew Guschin <saintruler@gmail.com>2021-09-22 13:26:49 +0400
commit9259a44ab2d79d9e25770745d0279b69cf3188b8 (patch)
treed01e802176d30c5beb8318201721921225c071f4
parenta3497cf7663981359fdc727c4a27eae50098649e (diff)
Added alpha patch and changed color schemeHEADmaster
-rw-r--r--PKGBUILD6
-rw-r--r--config.h9
-rw-r--r--config.mk2
-rw-r--r--patches/alpha.diff122
-rw-r--r--tabbed.c63
5 files changed, 185 insertions, 17 deletions
diff --git a/PKGBUILD b/PKGBUILD
index da6db57..1239776 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -18,12 +18,12 @@ source=(
)
md5sums=(
'0f576a5a618691f34ef7d5a80c57a3dd'
- '8368af34b9168919abbdeda87d0ac483'
- '261da6221f9de32358abe496a5bdf601'
+ 'SKIP'
+ '2f5da40db1cceb0547c9fb129031725f'
'3b68a2f193620a75f06d4e58ba0d1859'
'45836d1e3046ec75f579db105611ee9c'
'e81e128bc6c468e78425163f1f7abb01'
- 'f07d7a9e0fef16f63281ddbbde87a069'
+ 'd7aac3e0c912301338f92610fcc798e8'
)
build() {
diff --git a/config.h b/config.h
index 9787344..6492daa 100644
--- a/config.h
+++ b/config.h
@@ -2,10 +2,11 @@
/* appearance */
static const char font[] = "monospace-10";
-static const char* normbgcolor = "#222222";
-static const char* normfgcolor = "#cccccc";
-static const char* selbgcolor = "#555555";
-static const char* selfgcolor = "#ffffff";
+static const char* normbgcolor = "#111416";
+static const char* normfgcolor = "#5f5f54";
+static const char* selbgcolor = "#111416";
+static const char* selfgcolor = "#eeeeec";
+
static const char before[] = "<";
static const char after[] = ">";
static const int tabwidth = 200;
diff --git a/config.mk b/config.mk
index 037f9d7..44df003 100644
--- a/config.mk
+++ b/config.mk
@@ -9,7 +9,7 @@ MANPREFIX = ${PREFIX}/share/man
# includes and libs
INCS = -I. -I/usr/include -I/usr/include/freetype2
-LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
+LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft -lXrender
# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_BSD_SOURCE
diff --git a/patches/alpha.diff b/patches/alpha.diff
new file mode 100644
index 0000000..3ce77a7
--- /dev/null
+++ b/patches/alpha.diff
@@ -0,0 +1,122 @@
+diff --git a/config.mk b/config.mk
+index 3a71529..095cead 100644
+--- a/config.mk
++++ b/config.mk
+@@ -9,7 +9,7 @@ MANPREFIX = ${PREFIX}/share/man
+
+ # includes and libs
+ INCS = -I. -I/usr/include -I/usr/include/freetype2
+-LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft
++LIBS = -L/usr/lib -lc -lX11 -lfontconfig -lXft -lXrender
+
+ # flags
+ CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE
+diff --git a/tabbed.c b/tabbed.c
+index 9a44795..b4d47d1 100644
+--- a/tabbed.c
++++ b/tabbed.c
+@@ -170,6 +170,9 @@ static char **cmd;
+ static char *wmname = "tabbed";
+ static const char *geometry;
+
++static Colormap cmap;
++static Visual *visual = NULL;
++
+ char *argv0;
+
+ /* configuration, allows nested code to access above variables */
+@@ -255,8 +258,8 @@ configurenotify(const XEvent *e)
+ ww = ev->width;
+ wh = ev->height;
+ XFreePixmap(dpy, dc.drawable);
+- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
+- DefaultDepth(dpy, screen));
++ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
++ 32);
+ if (sel > -1)
+ resize(sel, ww, wh - bh);
+ XSync(dpy, False);
+@@ -399,7 +402,7 @@ drawtext(const char *text, XftColor col[ColLast])
+ ;
+ }
+
+- d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
++ d = XftDrawCreate(dpy, dc.drawable, visual, cmap);
+ XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
+ XftDrawDestroy(d);
+ }
+@@ -564,7 +567,7 @@ getcolor(const char *colstr)
+ {
+ XftColor color;
+
+- if (!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
++ if (!XftColorAllocName(dpy, visual, cmap, colstr, &color))
+ die("%s: cannot allocate color '%s'\n", argv0, colstr);
+
+ return color;
+@@ -1016,18 +1019,60 @@ setup(void)
+ wy = dh + wy - wh - 1;
+ }
+
++ XVisualInfo *vis;
++ XRenderPictFormat *fmt;
++ int nvi;
++ int i;
++
++ XVisualInfo tpl = {
++ .screen = screen,
++ .depth = 32,
++ .class = TrueColor
++ };
++
++ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
++ for(i = 0; i < nvi; i ++) {
++ fmt = XRenderFindVisualFormat(dpy, vis[i].visual);
++ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
++ visual = vis[i].visual;
++ break;
++ }
++ }
++
++ XFree(vis);
++
++ if (! visual) {
++ fprintf(stderr, "Couldn't find ARGB visual.\n");
++ exit(1);
++ }
++
++ cmap = XCreateColormap( dpy, root, visual, None);
+ dc.norm[ColBG] = getcolor(normbgcolor);
+ dc.norm[ColFG] = getcolor(normfgcolor);
+ dc.sel[ColBG] = getcolor(selbgcolor);
+ dc.sel[ColFG] = getcolor(selfgcolor);
+ dc.urg[ColBG] = getcolor(urgbgcolor);
+ dc.urg[ColFG] = getcolor(urgfgcolor);
+- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
+- DefaultDepth(dpy, screen));
+- dc.gc = XCreateGC(dpy, root, 0, 0);
+
+- win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
+- dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
++ XSetWindowAttributes attrs;
++ attrs.background_pixel = dc.norm[ColBG].pixel;
++ attrs.border_pixel = dc.norm[ColFG].pixel;
++ attrs.bit_gravity = NorthWestGravity;
++ attrs.event_mask = FocusChangeMask | KeyPressMask
++ | ExposureMask | VisibilityChangeMask | StructureNotifyMask
++ | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
++ attrs.background_pixmap = None ;
++ attrs.colormap = cmap;
++
++ win = XCreateWindow(dpy, root, wx, wy,
++ ww, wh, 0, 32, InputOutput,
++ visual, CWBackPixmap | CWBorderPixel | CWBitGravity
++ | CWEventMask | CWColormap, &attrs);
++
++ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
++ 32);
++ dc.gc = XCreateGC(dpy, dc.drawable, 0, 0);
++
+ XMapRaised(dpy, win);
+ XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
+ ButtonPressMask | ExposureMask | KeyPressMask |
diff --git a/tabbed.c b/tabbed.c
index 6c3bf55..05191c8 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -164,6 +164,9 @@ static char **cmd = NULL;
static char *wmname = "tabbed";
static const char *geometry = NULL;
+static Colormap cmap;
+static Visual *visual = NULL;
+
char *argv0;
/* configuration, allows nested code to access above variables */
@@ -244,8 +247,7 @@ configurenotify(const XEvent *e) {
ww = ev->width;
wh = ev->height;
XFreePixmap(dpy, dc.drawable);
- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
- DefaultDepth(dpy, screen));
+ dc.drawable = XCreatePixmap(dpy, root, ww, wh, 32);
if(sel > -1)
resize(sel, ww, wh - bh);
XSync(dpy, False);
@@ -386,7 +388,7 @@ drawtext(const char *text, XftColor col[ColLast]) {
for(i = len; i && i > len - 3; buf[--i] = '.');
}
- d = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
+ d = XftDrawCreate(dpy, dc.drawable, visual, cmap);
XftDrawStringUtf8(d, &col[ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);
XftDrawDestroy(d);
@@ -523,7 +525,7 @@ XftColor
getcolor(const char *colstr) {
XftColor color;
- if(!XftColorAllocName(dpy, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen), colstr, &color))
+ if (!XftColorAllocName(dpy, visual, cmap, colstr, &color))
die("tabbed: cannot allocate color '%s'\n", colstr);
return color;
@@ -930,16 +932,59 @@ setup(void) {
wy = dh + wy - wh - 1;
}
+ XVisualInfo *vis;
+ XRenderPictFormat *fmt;
+ int nvi;
+ int i;
+
+ XVisualInfo tpl = {
+ .screen = screen,
+ .depth = 32,
+ .class = TrueColor
+ };
+
+ vis = XGetVisualInfo(dpy, VisualScreenMask | VisualDepthMask | VisualClassMask, &tpl, &nvi);
+ for(i = 0; i < nvi; i ++) {
+ fmt = XRenderFindVisualFormat(dpy, vis[i].visual);
+ if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
+ visual = vis[i].visual;
+ break;
+ }
+ }
+
+ XFree(vis);
+
+ if (! visual) {
+ fprintf(stderr, "Couldn't find ARGB visual.\n");
+ exit(1);
+ }
+
+ cmap = XCreateColormap( dpy, root, visual, None);
+
dc.norm[ColBG] = getcolor(normbgcolor);
dc.norm[ColFG] = getcolor(normfgcolor);
dc.sel[ColBG] = getcolor(selbgcolor);
dc.sel[ColFG] = getcolor(selfgcolor);
- dc.drawable = XCreatePixmap(dpy, root, ww, wh,
- DefaultDepth(dpy, screen));
- dc.gc = XCreateGC(dpy, root, 0, 0);
- win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0,
- dc.norm[ColFG].pixel, dc.norm[ColBG].pixel);
+ XSetWindowAttributes attrs;
+ attrs.background_pixel = dc.norm[ColBG].pixel;
+ attrs.border_pixel = dc.norm[ColFG].pixel;
+ attrs.bit_gravity = NorthWestGravity;
+ attrs.event_mask = FocusChangeMask | KeyPressMask
+ | ExposureMask | VisibilityChangeMask | StructureNotifyMask
+ | ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
+ attrs.background_pixmap = None ;
+ attrs.colormap = cmap;
+
+ win = XCreateWindow(dpy, root, wx, wy,
+ ww, wh, 0, 32, InputOutput,
+ visual, CWBackPixmap | CWBorderPixel | CWBitGravity
+ | CWEventMask | CWColormap, &attrs);
+
+ dc.drawable = XCreatePixmap(dpy, win, ww, wh,
+ 32);
+ dc.gc = XCreateGC(dpy, dc.drawable, 0, 0);
+
XMapRaised(dpy, win);
XSelectInput(dpy, win, SubstructureNotifyMask|FocusChangeMask|
ButtonPressMask|ExposureMask|KeyPressMask|PropertyChangeMask|