[wiki] [sites] Fixed this bug: https://bbs.archlinux.org/viewtopic.php?pid=1564850#p1564850 || Dave Kennedy

From: <git_AT_suckless.org>
Date: Tue, 24 Nov 2015 09:10:42 +0100

commit acadedd2aaead93535367a3559cb7e07c08d1096
Author: Dave Kennedy <dave-kennedy_AT_users.noreply.github.com>
Date: Tue Nov 24 01:11:43 2015 -0700

    Fixed this bug: https://bbs.archlinux.org/viewtopic.php?pid=1564850#p1564850

diff --git a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
index a92de7c..a266add 100644
--- a/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
+++ b/dwm.suckless.org/patches/dwm-6.1-statuscolors.diff
_AT_@ -1,17 +1,16 @@
 diff -up dwm/drw.c dwm-statuscolors/drw.c
---- dwm/drw.c 2015-11-22 14:15:47.147862717 -0700
-+++ dwm-statuscolors/drw.c 2015-11-22 14:21:00.437849971 -0700
-_AT_@ -206,12 +206,37 @@ drw_setscheme(Drw *drw, ClrScheme *schem
- drw->scheme = scheme;
+--- dwm/drw.c 2015-11-08 15:39:37.000000000 -0700
++++ dwm-statuscolors/drw.c 2015-11-24 00:43:15.735118401 -0700
+_AT_@ -207,11 +207,35 @@ drw_setscheme(Drw *drw, ClrScheme *schem
  }
  
-+int
++void
 +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;
++ return;
 +
-+ char *buf = text, *ptr = buf, c =1;
++ char *buf = text, *ptr = buf, c = 1;
 + int i;
 +
 + while (*ptr) {
_AT_@ -21,13 +20,12 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
 + c = *ptr;
 + *ptr = 0;
 + if (i)
-+ x = drw_text(drw, x, y, w, h, buf, 0);
++ x = drw_text(drw, x, y, w, h, buf) + drw->fonts[0]->h;
 + *ptr = c;
 + drw_setscheme(drw, &scheme[c-1]);
 + buf = ++ptr;
 + }
-+ drw_text(drw, x, y, w, h, buf, 0);
-+ return x;
++ drw_text(drw, x, y, w, h, buf);
 +}
 +
  void
_AT_@ -41,16 +39,16 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
          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
+_AT_@ -219,7 +243,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)
  {
          char buf[1024];
          int tx, ty, th;
-_AT_@ -242,8 +267,7 @@ drw_text(Drw *drw, int x, int y, unsigne
+_AT_@ -242,8 +266,7 @@ drw_text(Drw *drw, int x, int y, unsigne
          if (!(render = x || y || w || h)) {
                  w = ~w;
          } else {
_AT_@ -60,14 +58,9 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
                  XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
                  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;
-- ty = y + (h / 2) - (th / 2) + curfont->ascent;
-+ th = pad ? (curfont->ascent + curfont->descent) : 0;
-+ ty = y + ((h + curfont->ascent - curfont->descent) / 2);
+_AT_@ -292,7 +315,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);
_AT_@ -75,22 +68,24 @@ diff -up dwm/drw.c dwm-statuscolors/drw.c
                                  x += tex.w;
                                  w -= tex.w;
 diff -up dwm/drw.h dwm-statuscolors/drw.h
---- dwm/drw.h 2015-11-22 14:15:47.147862717 -0700
-+++ dwm-statuscolors/drw.h 2015-11-22 14:21:00.437849971 -0700
-_AT_@ -67,7 +67,8 @@ void drw_setfont(Drw *, Fnt *);
+--- dwm/drw.h 2015-11-08 15:39:37.000000000 -0700
++++ dwm-statuscolors/drw.h 2015-11-24 00:43:15.735118401 -0700
+_AT_@ -67,8 +67,9 @@ 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_colored_text(Drw *, ClrScheme *, int, int, int, unsigned int, unsigned int, char *);
+-int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *, int);
++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 *, int);
++int drw_text(Drw *, int, int, unsigned int, unsigned int, const char *);
  
  /* 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-22 14:15:47.147862717 -0700
-+++ dwm-statuscolors/dwm.c 2015-11-22 14:21:27.054515557 -0700
-_AT_@ -51,6 +51,7 @@
+--- dwm/dwm.c 2015-11-08 15:39:37.000000000 -0700
++++ dwm-statuscolors/dwm.c 2015-11-24 00:43:15.735118401 -0700
+_AT_@ -51,11 +51,12 @@
                                 * 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_@ -98,6 +93,12 @@ 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_@ -107,14 +108,14 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
  static Display *dpy;
  static Drw *drw;
  static Monitor *mons, *selmon;
-_AT_@ -718,14 +719,14 @@ drawbar(Monitor *m)
+_AT_@ -718,15 +719,15 @@ 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], 1);
++ drw_text(drw, x, 0, w, bh, tags[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);
_AT_@ -122,10 +123,12 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
          }
          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, 0);
++ drw_text(drw, x, 0, w, bh, m->ltsymbol);
          x += w;
          xx = x;
+ if (m == selmon) { /* status is only drawn on selected monitor */
 _AT_@ -736,18 +737,18 @@ drawbar(Monitor *m)
                          x = xx;
                          w = m->ww - xx;
_AT_@ -141,7 +144,7 @@ diff -up dwm/dwm.c dwm-statuscolors/dwm.c
 - 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, 1);
++ drw_text(drw, x, 0, w, bh, m->sel->name);
 + drw_rect(drw, x + 1, 1, dx, dx, m->sel->isfixed, m->sel->isfloating);
                  } else {
 - drw_setscheme(drw, &scheme[SchemeNorm]);
Received on Tue Nov 24 2015 - 09:10:42 CET

This archive was generated by hypermail 2.3.0 : Tue Nov 24 2015 - 09:12:12 CET