[wiki] [sites] Replaced invert parameter on drw_rect and drw_text - why were these removed in the first place? It messed up the middle section of the status bar || Dave Kennedy
commit a160501cd899c7061dc136d9914a5f39aad02586
Author: Dave Kennedy <dave-kennedy_AT_users.noreply.github.com>
Date: Sat Nov 28 15:54:36 2015 -0700
Replaced invert parameter on drw_rect and drw_text - why were these
removed in the first place? It messed up the middle section of the
status bar
diff --git a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
index d841712..3aead49 100644
--- a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
+++ b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
_AT_@ -1,7 +1,7 @@
diff -up dwm/drw.c dwm-statuscolors/drw.c
--- dwm/drw.c 2015-11-08 15:39:37.000000000 -0700
-+++ dwm-statuscolors/drw.c 2015-11-28 13:47:09.814892374 -0700
-_AT_@ -206,12 +206,74 @@ drw_setscheme(Drw *drw, ClrScheme *schem
++++ dwm-statuscolors/drw.c 2015-11-28 15:42:28.534399525 -0700
+_AT_@ -206,6 +206,68 @@ drw_setscheme(Drw *drw, ClrScheme *schem
drw->scheme = scheme;
}
_AT_@ -10,7 +10,7 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
+{
+ int i;
+ Fnt *curfont = drw->fonts[0];
-+ int w = drw_text(drw, 0, 0, 0, 0, text) + curfont->h;
++ int w = drw_text(drw, 0, 0, 0, 0, text, 0) + curfont->h;
+
+ for (i = 0; i < strlen(text); i++) {
+ if (text[i] > 0 && text[i] <= numcolors) {
_AT_@ -59,73 +59,33 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
+ c = *ptr;
+ *ptr = 0;
+ if (i)
-+ x = drw_text(drw, x, y, w, h, buf) + drw->fonts[0]->h;
++ x = drw_text(drw, x, y, w, h, buf, 0) + drw->fonts[0]->h;
+ *ptr = c;
+ drw_setscheme(drw, &scheme[c-1]);
+ buf = ++ptr;
+ }
-+ drw_text(drw, x, y, w, h, buf);
++ drw_text(drw, x, y, w, h, buf, 0);
+}
+
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)
+ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert)
{
- 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);
- if (filled)
- XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w + 1, h + 1);
- else if (empty)
-_AT_@ -219,7 +281,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)
- {
- char buf[1024];
- int tx, ty, th;
-_AT_@ -242,8 +304,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);
- d = XftDrawCreate(drw->dpy, drw->drawable,
- DefaultVisual(drw->dpy, drw->screen),
-_AT_@ -292,7 +353,7 @@ drw_text(Drw *drw, int x, int y, unsigne
- th = curfont->ascent + curfont->descent;
- ty = y + (h / 2) - (th / 2) + curfont->ascent;
- tx = x + (h / 2);
-- 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;
- w -= tex.w;
diff -up dwm/drw.h dwm-statuscolors/drw.h
--- dwm/drw.h 2015-11-08 15:39:37.000000000 -0700
-+++ dwm-statuscolors/drw.h 2015-11-28 13:47:26.411558366 -0700
-_AT_@ -67,8 +67,10 @@ void drw_setfont(Drw *, Fnt *);
++++ dwm-statuscolors/drw.h 2015-11-28 15:39:44.427726312 -0700
+_AT_@ -67,6 +67,8 @@ void drw_setfont(Drw *, Fnt *);
void drw_setscheme(Drw *, ClrScheme *);
/* Drawing functions */
--void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
--int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
+int drw_get_width(Drw *, int, const char *);
+void 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 *);
+ void drw_rect(Drw *, int, int, unsigned int, unsigned int, int, int, int);
+ int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
- /* Map functions */
- void drw_map(Drw *, Window, int, int, unsigned int, unsigned int);
diff -up dwm/dwm.c dwm-statuscolors/dwm.c
--- dwm/dwm.c 2015-11-08 15:39:37.000000000 -0700
-+++ dwm-statuscolors/dwm.c 2015-11-28 13:44:22.744899168 -0700
-_AT_@ -51,11 +51,12 @@
++++ dwm-statuscolors/dwm.c 2015-11-28 15:45:32.134406853 -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]))
#define LENGTH(X) (sizeof X / sizeof X[0])
_AT_@ -133,12 +93,6 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
- #define TAGMASK ((1 << LENGTH(tags)) - 1)
--#define TEXTW(X) (drw_text(drw, 0, 0, 0, 0, (X), 0) + drw->fonts[0]->h)
-+#define TEXTW(X) (drw_text(drw, 0, 0, 0, 0, (X)) + drw->fonts[0]->h)
-
- /* enums */
- enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
_AT_@ -261,7 +262,7 @@ static void (*handler[LASTEvent]) (XEven
static Atom wmatom[WMLast], netatom[NetLast];
static int running = 1;
_AT_@ -148,24 +102,23 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
-_AT_@ -718,36 +719,36 @@ drawbar(Monitor *m)
+_AT_@ -718,35 +719,35 @@ drawbar(Monitor *m)
x = 0;
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]);
++ 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], 0);
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);
++ occ & 1 << i, 0);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
- drw_setscheme(drw, &scheme[SchemeNorm]);
-- drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
+ drw_setscheme(drw, &scheme[0]);
-+ drw_text(drw, x, 0, w, bh, m->ltsymbol);
+ drw_text(drw, x, 0, w, bh, m->ltsymbol, 0);
x += w;
xx = x;
if (m == selmon) { /* status is only drawn on selected monitor */
_AT_@ -184,19 +137,15 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
x = xx;
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 + 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);
-+ drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating);
+ drw_text(drw, x, 0, w, bh, m->sel->name, 0);
+ drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating, 0);
} else {
- drw_setscheme(drw, &scheme[SchemeNorm]);
-- drw_rect(drw, x, 0, w, bh, 1, 0, 1);
+ drw_setscheme(drw, &scheme[0]);
-+ drw_rect(drw, x, 0, w, bh, 1, 0);
+ drw_rect(drw, x, 0, w, bh, 1, 0, 1);
}
}
- drw_map(drw, m->barwin, 0, 0, m->ww, bh);
_AT_@ -807,7 +808,7 @@ focus(Client *c)
detachstack(c);
attachstack(c);
Received on Sat Nov 28 2015 - 23:54:08 CET
This archive was generated by hypermail 2.3.0
: Sun Nov 29 2015 - 00:00:31 CET