[wiki] [sites] Updated to work with latest version of dwm || Dave Kennedy
commit 48e4a7bc88451d473b368a6f194d62eff614f783
Author: Dave Kennedy <dave-kennedy_AT_users.noreply.github.com>
Date: Sun Nov 22 12:53:47 2015 -0700
Updated to work with latest version of dwm
diff --git a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
index 1b3676f..86678db 100644
--- a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
+++ b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
_AT_@ -1,28 +1,27 @@
-Only in dwm: config.def.h
-diff -up dwm/drw.c dwm_git_colors/drw.c
---- dwm/drw.c 2015-03-24 10:00:33.865796838 -0700
-+++ dwm_git_colors/drw.c 2015-03-24 09:56:59.542647284 -0700
-_AT_@ -202,13 +202,38 @@ drw_setscheme(Drw *drw, ClrScheme *schem
- drw->scheme = scheme;
+diff -up dwm/drw.c.orig dwm/drw.c
+--- dwm/drw.c.orig 2015-11-22 10:46:53.141705984 -0700
++++ dwm/drw.c 2015-11-22 12:15:35.051489467 -0700
+_AT_@ -206,12 +206,37 @@ drw_setscheme(Drw *drw, ClrScheme *schem
+ drw->scheme = scheme;
}
+int
-+drw_colored_text(Drw *drw, ClrScheme *scheme, int numcolors, int x, int y, unsigned int w, unsigned int h, char *text) {
-+ if(!drw || !drw->fontcount || !drw->scheme)
++drw_colored_text(Drw *drw, ClrScheme *scheme, int numcolors, int x, int y, unsigned int w, unsigned int h, char *text)
++{
++ if (!drw || !drw->fontcount || !drw->scheme)
+ return 0;
+
+ char *buf = text, *ptr = buf, c =1;
+ int i;
+
-+ while(*ptr) {
-+ for(i = 0; *ptr < 0 || *ptr > numcolors; i++, ptr++);
-+ if(!*ptr)
++ while (*ptr) {
++ for (i = 0; *ptr < 0 || *ptr > numcolors; i++, ptr++);
++ if (!*ptr)
+ break;
+ c = *ptr;
+ *ptr = 0;
-+ if(i) {
++ if (i)
+ x = drw_text(drw, x, y, w, h, buf, 0);
-+ }
+ *ptr = c;
+ drw_setscheme(drw, &scheme[c-1]);
+ buf = ++ptr;
_AT_@ -32,37 +31,37 @@ diff -up dwm/drw.c dwm_git_colors/drw.c
+}
+
void
--drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert) {
-+drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty) {
- int dx;
-
- if(!drw || !drw->fontcount || !drw->scheme)
+-drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert)
++drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty)
+ {
+ if (!drw->scheme)
return;
- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix);
+ XSetForeground(drw->dpy, drw->gc, drw->scheme->fg->pix);
- dx = (drw->fonts[0]->ascent + drw->fonts[0]->descent + 2) / 4;
- if(filled)
- XFillRectangle(drw->dpy, drw->drawable, drw->gc, x+1, y+1, dx+1, dx+1);
-_AT_@ -217,7 +242,7 @@ drw_rect(Drw *drw, int x, int y, unsigne
+ if (filled)
+ XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w + 1, h + 1);
+ else if (empty)
+_AT_@ -219,7 +244,7 @@ drw_rect(Drw *drw, int x, int y, unsigne
}
int
--drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert) {
-+drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int pad) {
+-drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert)
++drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int pad)
+ {
char buf[1024];
int tx, ty, th;
- Extnts tex;
-_AT_@ -242,7 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigne
- if (!drw || !drw->scheme) {
- return 0;
- } else if (render) {
-- XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->fg->pix : drw->scheme->bg->pix);
+_AT_@ -242,8 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigne
+ if (!(render = x || y || w || h)) {
+ w = ~w;
+ } else {
+- XSetForeground(drw->dpy, drw->gc, invert ?
+- drw->scheme->fg->pix : drw->scheme->bg->pix);
+ XSetForeground(drw->dpy, drw->gc, drw->scheme->bg->pix);
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
- }
-
-_AT_@ -294,10 +319,10 @@ drw_text(Drw *drw, int x, int y, unsigne
- for(i = len; i && i > len - 3; buf[--i] = '.');
+ d = XftDrawCreate(drw->dpy, drw->drawable,
+ DefaultVisual(drw->dpy, drw->screen),
+_AT_@ -289,10 +313,10 @@ drw_text(Drw *drw, int x, int y, unsigne
+ for (i = len; i && i > len - 3; buf[--i] = '.');
if (render) {
- th = curfont->ascent + curfont->descent;
_AT_@ -73,28 +72,24 @@ diff -up dwm/drw.c dwm_git_colors/drw.c
- XftDrawStringUtf8(d, invert ? &drw->scheme->bg->rgb : &drw->scheme->fg->rgb, curfont->xfont, tx, ty, (XftChar8 *)buf, len);
+ XftDrawStringUtf8(d, &drw->scheme->fg->rgb, curfont->xfont, tx, ty, (XftChar8 *)buf, len);
}
-
x += tex.w;
-diff -up dwm/drw.h dwm_git_colors/drw.h
---- dwm/drw.h 2015-03-24 10:00:33.865796838 -0700
-+++ dwm_git_colors/drw.h 2015-03-24 09:22:03.216317586 -0700
-_AT_@ -67,8 +67,9 @@ void drw_setfont(Drw *drw, Fnt *font);
- void drw_setscheme(Drw *drw, ClrScheme *scheme);
+ w -= tex.w;
+diff -up dwm/drw.h.orig dwm/drw.h
+--- dwm/drw.h.orig 2015-11-22 10:46:53.141705984 -0700
++++ dwm/drw.h 2015-11-22 12:17:17.434818635 -0700
+_AT_@ -67,7 +67,8 @@ void drw_setfont(Drw *, Fnt *);
+ void drw_setscheme(Drw *, ClrScheme *);
/* Drawing functions */
--void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert);
--int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int invert);
-+int drw_colored_text(Drw *drw, ClrScheme *scheme, int numcolors, int x, int y, unsigned int w, unsigned int h, char *text);
-+void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty);
-+int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *text, int pad);
+-void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
++int drw_colored_text(Drw *, ClrScheme *, int, int, int, unsigned int, unsigned int, char *);
++void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int);
+ int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
/* Map functions */
- void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);
-Binary files dwm/drw.o and dwm_git_colors/drw.o differ
-Binary files dwm/dwm and dwm_git_colors/dwm differ
-diff -up dwm/dwm.c dwm_git_colors/dwm.c
---- dwm/dwm.c 2015-03-24 10:02:59.752217939 -0700
-+++ dwm_git_colors/dwm.c 2015-03-24 09:23:22.826334134 -0700
+diff -up dwm/dwm.c.orig dwm/dwm.c
+--- dwm/dwm.c.orig 2015-11-22 10:46:53.141705984 -0700
++++ dwm/dwm.c 2015-11-22 12:33:19.198112839 -0700
_AT_@ -51,6 +51,7 @@
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
_AT_@ -103,24 +98,24 @@ diff -up dwm/dwm.c dwm_git_colors/dwm.c
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
-_AT_@ -261,7 +263,7 @@ static void (*handler[LASTEvent]) (XEven
+_AT_@ -261,7 +262,7 @@ static void (*handler[LASTEvent]) (XEven
static Atom wmatom[WMLast], netatom[NetLast];
- static Bool running = True;
+ static int running = 1;
static Cur *cursor[CurLast];
-static ClrScheme scheme[SchemeLast];
+static ClrScheme scheme[MAXCOLORS];
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
-_AT_@ -703,14 +716,14 @@ drawbar(Monitor *m) {
+_AT_@ -718,14 +719,14 @@ drawbar(Monitor *m)
x = 0;
- for(i = 0; i < LENGTH(tags); i++) {
+ for (i = 0; i < LENGTH(tags); i++) {
w = TEXTW(tags[i]);
- drw_setscheme(drw, m->tagset[m->seltags] & 1 << i ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, tags[i], urg & 1 << i);
+ drw_setscheme(drw, &scheme[(m->tagset[m->seltags] & 1 << i) ? 1 : (urg & 1 << i ? 2:0)]);
+ drw_text(drw, x, 0, w, bh, tags[i], 1);
- drw_rect(drw, x, 0, w, bh, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
+ drw_rect(drw, x + 1, 1, dx, dx, m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- occ & 1 << i, urg & 1 << i);
+ occ & 1 << i);
x += w;
_AT_@ -131,41 +126,39 @@ diff -up dwm/dwm.c dwm_git_colors/dwm.c
drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
x += w;
xx = x;
-_AT_@ -721,19 +734,19 @@ drawbar(Monitor *m) {
+_AT_@ -736,17 +737,17 @@ drawbar(Monitor *m)
x = xx;
w = m->ww - xx;
}
- drw_text(drw, x, 0, w, bh, stext, 0);
+ drw_colored_text(drw, scheme, NUMCOLORS, x, 0, w, bh, stext);
- }
- else
+ } else
x = m->ww;
- if((w = x - xx) > bh) {
+ if ((w = x - xx) > bh) {
x = xx;
- if(m->sel) {
+ if (m->sel) {
- drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]);
- drw_text(drw, x, 0, w, bh, m->sel->name, 0);
-- drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0);
+- drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating, 0);
+ drw_setscheme(drw, &scheme[m == selmon ? 1 : 0]);
+ drw_text(drw, x, 0, w, bh, m->sel->name, 1);
-+ drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating);
- }
- else {
++ drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating);
+ } else {
- drw_setscheme(drw, &scheme[SchemeNorm]);
+ drw_setscheme(drw, &scheme[0]);
- drw_text(drw, x, 0, w, bh, NULL, 0);
+ drw_rect(drw, x, 0, w, bh, 1, 0, 1);
}
}
-_AT_@ -791,7 +804,7 @@ focus(Client *c) {
+_AT_@ -807,7 +808,7 @@ focus(Client *c)
detachstack(c);
attachstack(c);
- grabbuttons(c, True);
+ grabbuttons(c, 1);
- XSetWindowBorder(dpy, c->win, scheme[SchemeSel].border->pix);
+ XSetWindowBorder(dpy, c->win, scheme[1].border->pix);
setfocus(c);
- }
- else {
-_AT_@ -1039,7 +1052,7 @@ manage(Window w, XWindowAttributes *wa)
+ } else {
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
+_AT_@ -1065,7 +1066,7 @@ manage(Window w, XWindowAttributes *wa)
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
_AT_@ -174,7 +167,7 @@ diff -up dwm/dwm.c dwm_git_colors/dwm.c
configure(c); /* propagates border_width, if size doesn't change */
updatewindowtype(c);
updatesizehints(c);
-_AT_@ -1531,12 +1544,12 @@ setup(void) {
+_AT_@ -1580,12 +1581,12 @@ setup(void)
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
cursor[CurMove] = drw_cur_create(drw, XC_fleur);
/* init appearance */
_AT_@ -193,14 +186,12 @@ diff -up dwm/dwm.c dwm_git_colors/dwm.c
/* init bars */
updatebars();
updatestatus();
-_AT_@ -1685,7 +1698,7 @@ unfocus(Client *c, Bool setfocus) {
- if(!c)
+_AT_@ -1745,7 +1746,7 @@ unfocus(Client *c, int setfocus)
+ if (!c)
return;
- grabbuttons(c, False);
+ grabbuttons(c, 0);
- XSetWindowBorder(dpy, c->win, scheme[SchemeNorm].border->pix);
+ XSetWindowBorder(dpy, c->win, scheme[0].border->pix);
- if(setfocus) {
+ if (setfocus) {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
-Binary files dwm/dwm.o and dwm_git_colors/dwm.o differ
-Common subdirectories: dwm/.git and dwm_git_colors/.git
Received on Sun Nov 22 2015 - 20:52:47 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 22 2015 - 21:00:13 CET