Skip to content

Commit b460e5a

Browse files
committed
Revert "add topbar alpha patch"
This reverts commit 1f43672. Not particularly using transparency.
1 parent b9a126f commit b460e5a

File tree

7 files changed

+26
-86
lines changed

7 files changed

+26
-86
lines changed

README.md

-5
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,13 @@ In my setup, for instance, if the current window is a tmux session, the Super ke
8383

8484
[Uselessgap](http://dwm.suckless.org/patches/uselessgap) is a dwm patch to insert gaps between windows in tiling mode alone. Currently included.
8585

86-
### Top bar transparency
87-
88-
Using [Alpha](http://dwm.suckless.org/patches/alpha) is a dwm patch to bring in transparency to the top bar. Be warned, this will not work without a separate compositing manager running. I use xcompmgr.
89-
9086
### Per Tag
9187

9288
Have separate layout per tag.
9389

9490
### List of Patches
9591
All included in the source. Listing here for future upgrade requirements.
9692

97-
+ uselessgap - http://dwm.suckless.org/patches/uselessgap
9893
+ alpha - http://dwm.suckless.org/patches/alpha
9994
+ pertag - http://dwm.suckless.org/patches/pertag
10095
+ nextprevtag - http://dwm.suckless.org/patches/nextprevtag

config.def.h

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ static const char normfgcolor[] = "#bbbbbb";
1111
static const char selbordercolor[] = "#005577";
1212
static const char selbgcolor[] = "#005577";
1313
static const char selfgcolor[] = "#eeeeee";
14-
static unsigned int baralpha = 0xd0;
15-
static unsigned int borderalpha = OPAQUE;
1614
static const unsigned int borderpx = 1; /* border pixel of windows */
1715
static const unsigned int snap = 32; /* snap pixel */
1816
static const int showbar = 1; /* 0 means no bar */

config.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ static const unsigned int snap = 32; /* snap pixel */
1616
static const int showbar = 1; /* 0 means no bar */
1717
static const int topbar = 1; /* 0 means bottom bar */
1818

19-
static const unsigned int gappx = 24; /* gap pixel between windows */
20-
static unsigned int baralpha = 0xBB;
21-
static unsigned int borderalpha = OPAQUE;
19+
static const unsigned int gappx = 24; /* gap pixel between windows */
2220

2321
/* tagging */
2422
static const char *tags[] = { "1", "2", "3", "4q", "5w", "6e", "7r", "o", "m" };

config.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
2222

2323
# includes and libs
2424
INCS = -I${X11INC} -I${FREETYPEINC}
25-
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lXrender
25+
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
2626

2727
# flags
2828
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}

drw.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ utf8decode(const char *c, long *u, size_t clen)
6161
}
6262

6363
Drw *
64-
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h, Visual *visual, unsigned int depth, Colormap cmap)
64+
drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h)
6565
{
6666
Drw *drw;
6767

@@ -71,11 +71,8 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h
7171
drw->root = root;
7272
drw->w = w;
7373
drw->h = h;
74-
drw->visual = visual;
75-
drw->depth = depth;
76-
drw->cmap = cmap;
77-
drw->drawable = XCreatePixmap(dpy, root, w, h, depth);
78-
drw->gc = XCreateGC(dpy, drw->drawable, 0, NULL);
74+
drw->drawable = XCreatePixmap(dpy, root, w, h, DefaultDepth(dpy, screen));
75+
drw->gc = XCreateGC(dpy, root, 0, NULL);
7976
drw->fontcount = 0;
8077
XSetLineAttributes(dpy, drw->gc, 1, LineSolid, CapButt, JoinMiter);
8178

@@ -89,7 +86,7 @@ drw_resize(Drw *drw, unsigned int w, unsigned int h)
8986
drw->h = h;
9087
if (drw->drawable)
9188
XFreePixmap(drw->dpy, drw->drawable);
92-
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, drw->depth);
89+
drw->drawable = XCreatePixmap(drw->dpy, drw->root, w, h, DefaultDepth(drw->dpy, drw->screen));
9390
}
9491

9592
void
@@ -183,15 +180,16 @@ drw_font_free(Fnt *font)
183180
}
184181

185182
Clr *
186-
drw_clr_create(Drw *drw, const char *clrname, unsigned int alpha)
183+
drw_clr_create(Drw *drw, const char *clrname)
187184
{
188185
Clr *clr;
189186

190187
clr = ecalloc(1, sizeof(Clr));
191-
if (!XftColorAllocName(drw->dpy, drw->visual, drw->cmap,
188+
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
189+
DefaultColormap(drw->dpy, drw->screen),
192190
clrname, &clr->rgb))
193191
die("error, cannot allocate color '%s'\n", clrname);
194-
clr->pix = (clr->rgb.pixel & 0x00ffffffU) | (alpha << 24);
192+
clr->pix = clr->rgb.pixel;
195193

196194
return clr;
197195
}
@@ -247,7 +245,9 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *tex
247245
XSetForeground(drw->dpy, drw->gc, invert ?
248246
drw->scheme->fg->pix : drw->scheme->bg->pix);
249247
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
250-
d = XftDrawCreate(drw->dpy, drw->drawable, drw->visual, drw->cmap);
248+
d = XftDrawCreate(drw->dpy, drw->drawable,
249+
DefaultVisual(drw->dpy, drw->screen),
250+
DefaultColormap(drw->dpy, drw->screen));
251251
}
252252

253253
curfont = drw->fonts[0];

drw.h

+2-5
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ typedef struct {
3030
Display *dpy;
3131
int screen;
3232
Window root;
33-
Visual *visual;
34-
unsigned int depth;
35-
Colormap cmap;
3633
Drawable drawable;
3734
GC gc;
3835
ClrScheme *scheme;
@@ -46,7 +43,7 @@ typedef struct {
4643
} Extnts;
4744

4845
/* Drawable abstraction */
49-
Drw *drw_create(Display *, int, Window, unsigned int, unsigned int, Visual*, unsigned int, Colormap);
46+
Drw *drw_create(Display *, int, Window, unsigned int, unsigned int);
5047
void drw_resize(Drw *, unsigned int, unsigned int);
5148
void drw_free(Drw *);
5249

@@ -58,7 +55,7 @@ void drw_font_getexts(Fnt *, const char *, unsigned int, Extnts *);
5855
unsigned int drw_font_getexts_width(Fnt *, const char *, unsigned int);
5956

6057
/* Colour abstraction */
61-
Clr *drw_clr_create(Drw *, const char *, unsigned int);
58+
Clr *drw_clr_create(Drw *, const char *);
6259
void drw_clr_free(Clr *);
6360

6461
/* Cursor abstraction */

dwm.c

+11-59
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@
5757
#define TAGMASK ((1 << LENGTH(tags)) - 1)
5858
#define TEXTW(X) (drw_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h)
5959

60-
#define OPAQUE 0xffU
61-
6260
/* enums */
6361
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
6462
enum { SchemeNorm, SchemeSel, SchemeLast }; /* color schemes */
@@ -237,7 +235,6 @@ static Monitor *wintomon(Window w);
237235
static int xerror(Display *dpy, XErrorEvent *ee);
238236
static int xerrordummy(Display *dpy, XErrorEvent *ee);
239237
static int xerrorstart(Display *dpy, XErrorEvent *ee);
240-
static void xinitvisual();
241238
static void zoom(const Arg *arg);
242239

243240
/* variables */
@@ -273,11 +270,6 @@ static Drw *drw;
273270
static Monitor *mons, *selmon;
274271
static Window root;
275272

276-
static int useargb = 0;
277-
static Visual *visual;
278-
static int depth;
279-
static Colormap cmap;
280-
281273
/* configuration, allows nested code to access above variables */
282274
#include "config.h"
283275

@@ -1636,8 +1628,7 @@ setup(void)
16361628
sw = DisplayWidth(dpy, screen);
16371629
sh = DisplayHeight(dpy, screen);
16381630
root = RootWindow(dpy, screen);
1639-
xinitvisual();
1640-
drw = drw_create(dpy, screen, root, sw, sh, visual, depth, cmap);
1631+
drw = drw_create(dpy, screen, root, sw, sh);
16411632
drw_load_fonts(drw, fonts, LENGTH(fonts));
16421633
if (!drw->fontcount)
16431634
die("no fonts could be loaded.\n");
@@ -1661,12 +1652,12 @@ setup(void)
16611652
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
16621653
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
16631654
/* init appearance */
1664-
scheme[SchemeNorm].border = drw_clr_create(drw, normbordercolor, borderalpha);
1665-
scheme[SchemeNorm].bg = drw_clr_create(drw, normbgcolor, baralpha);
1666-
scheme[SchemeNorm].fg = drw_clr_create(drw, normfgcolor, OPAQUE);
1667-
scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor, borderalpha);
1668-
scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor, baralpha);
1669-
scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor, OPAQUE);
1655+
scheme[SchemeNorm].border = drw_clr_create(drw, normbordercolor);
1656+
scheme[SchemeNorm].bg = drw_clr_create(drw, normbgcolor);
1657+
scheme[SchemeNorm].fg = drw_clr_create(drw, normfgcolor);
1658+
scheme[SchemeSel].border = drw_clr_create(drw, selbordercolor);
1659+
scheme[SchemeSel].bg = drw_clr_create(drw, selbgcolor);
1660+
scheme[SchemeSel].fg = drw_clr_create(drw, selfgcolor);
16701661
/* init bars */
16711662
updatebars();
16721663
updatestatus();
@@ -1899,17 +1890,15 @@ updatebars(void)
18991890
Monitor *m;
19001891
XSetWindowAttributes wa = {
19011892
.override_redirect = True,
1902-
.background_pixel = 0,
1903-
.border_pixel = 0,
1904-
.colormap = cmap,
1893+
.background_pixmap = ParentRelative,
19051894
.event_mask = ButtonPressMask|ExposureMask
19061895
};
19071896
for (m = mons; m; m = m->next) {
19081897
if (m->barwin)
19091898
continue;
1910-
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
1911-
InputOutput, visual,
1912-
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
1899+
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
1900+
CopyFromParent, DefaultVisual(dpy, screen),
1901+
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
19131902
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
19141903
XMapRaised(dpy, m->barwin);
19151904
}
@@ -2253,43 +2242,6 @@ xerrorstart(Display *dpy, XErrorEvent *ee)
22532242
return -1;
22542243
}
22552244

2256-
void
2257-
xinitvisual()
2258-
{
2259-
XVisualInfo *infos;
2260-
XRenderPictFormat *fmt;
2261-
int nitems;
2262-
int i;
2263-
2264-
XVisualInfo tpl = {
2265-
.screen = screen,
2266-
.depth = 32,
2267-
.class = TrueColor
2268-
};
2269-
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
2270-
2271-
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
2272-
visual = NULL;
2273-
for(i = 0; i < nitems; i ++) {
2274-
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
2275-
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
2276-
visual = infos[i].visual;
2277-
depth = infos[i].depth;
2278-
cmap = XCreateColormap(dpy, root, visual, AllocNone);
2279-
useargb = 1;
2280-
break;
2281-
}
2282-
}
2283-
2284-
XFree(infos);
2285-
2286-
if (! visual) {
2287-
visual = DefaultVisual(dpy, screen);
2288-
depth = DefaultDepth(dpy, screen);
2289-
cmap = DefaultColormap(dpy, screen);
2290-
}
2291-
}
2292-
22932245
void
22942246
zoom(const Arg *arg)
22952247
{

0 commit comments

Comments
 (0)