[wiki] [sites] Update fancybar patch to hg revision c794a9f5ae5e. || Charles Svitlik
changeset: 982:212a6d467e7a
tag: tip
user: Charles Svitlik <staticsunn_AT_gmail.com>
date: Sun Sep 30 17:12:04 2012 -0400
files: dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch dwm.suckless.org/patches/fancybar.md
description:
Update fancybar patch to hg revision c794a9f5ae5e.
diff -r a3ee723693b6 -r 212a6d467e7a dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm.suckless.org/patches/fancybar-c794a9f5ae5e.patch Sun Sep 30 17:12:04 2012 -0400
_AT_@ -0,0 +1,124 @@
+--- dwm.c.orig 2012-09-30 16:19:00.251353990 -0400
++++ dwm.c 2012-09-30 16:18:06.436026937 -0400
+_AT_@ -179,6 +179,7 @@
+ static Monitor *dirtomon(int dir);
+ static void drawbar(Monitor *m);
+ static void drawbars(void);
++static void drawline(unsigned long col[ColLast]);
+ static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]);
+ static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
+ static void enternotify(XEvent *e);
+_AT_@ -721,12 +722,15 @@
+
+ void
+ drawbar(Monitor *m) {
+- int x;
+- unsigned int i, occ = 0, urg = 0;
++ int x, ow, mw = 0, extra, tw;
++ unsigned int i, n = 0, occ = 0, urg = 0;
+ unsigned long *col;
+- Client *c;
++ Client *c, *firstvis, *lastvis = NULL;
++ DC seldc;
+
+ for(c = m->clients; c; c = c->next) {
++ if(ISVISIBLE(c))
++ n++;
+ occ |= c->tags;
+ if(c->isurgent)
+ urg |= c->tags;
+_AT_@ -755,16 +759,61 @@
+ }
+ else
+ dc.x = m->ww;
+- if((dc.w = dc.x - x) > bh) {
+- dc.x = x;
+- if(m->sel) {
+- col = m == selmon ? dc.sel : dc.norm;
+- drawtext(m->sel->name, col, False);
+- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
++ for(c = m->clients; c && !ISVISIBLE(c); c = c->next);
++ firstvis = c;
++
++ col = m == selmon ? dc.sel : dc.norm;
++ dc.w = dc.x - x;
++ dc.x = x;
++
++ if(n > 0) {
++ mw = dc.w / n;
++ extra = 0;
++ seldc = dc;
++ i = 0;
++
++ while(c) {
++ lastvis = c;
++ tw = TEXTW(c->name);
++ if(tw < mw) extra += (mw - tw); else i++;
++ for(c = c->next; c && !ISVISIBLE(c); c = c->next);
+ }
+- else
++
++ if(i > 0) mw += extra / i;
++
++ c = firstvis;
++ x = dc.x;
++ }
++
++ while(dc.w > bh) {
++ if(c) {
++ ow = dc.w;
++ tw = TEXTW(c->name);
++ dc.w = MIN(ow, tw);
++
++ if(dc.w > mw) dc.w = mw;
++ if(m->sel ==c) seldc = dc;
++ if(c == lastvis) dc.w = ow;
++
++ drawtext(c->name, col, False);
++ if(c != firstvis) drawline(col);
++ drawsquare(c->isfixed, c->isfloating, False, col);
++
++ dc.x += dc.w;
++ dc.w = ow - dc.w;
++ for(c = c->next; c&& !ISVISIBLE(c); c = c->next);
++ } else {
+ drawtext(NULL, dc.norm, False);
++ break;
++ }
+ }
++
++ if(m == selmon && m->sel && ISVISIBLE(m->sel)) {
++ dc = seldc;
++ drawtext(m->sel->name, col, True);
++ drawsquare(m->sel->isfixed, m->sel->isfloating, True, col);
++ }
++
+ XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
+ XSync(dpy, False);
+ }
+_AT_@ -778,6 +827,15 @@
+ }
+
+ void
++drawline(unsigned long col[ColLast]) {
++ XGCValues gcv;
++
++ gcv.foreground = col[ColFG];
++ XChangeGC(dpy, dc.gc, GCForeground, &gcv);
++ XDrawLine(dpy, dc.drawable, dc.gc, dc.x, dc.y, dc.x, dc.y + (dc.font.ascent + dc.font.descent + 2));
++}
++
++void
+ drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]) {
+ int x;
+
+_AT_@ -1327,8 +1385,7 @@
+ }
+ if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
+ updatetitle(c);
+- if(c == c->mon->sel)
+- drawbar(c->mon);
++ drawbar(c->mon);
+ }
+ if(ev->atom == netatom[NetWMWindowType])
+ updatewindowtype(c);
diff -r a3ee723693b6 -r 212a6d467e7a dwm.suckless.org/patches/fancybar.md
--- a/dwm.suckless.org/patches/fancybar.md Sat Sep 29 22:37:53 2012 +0200
+++ b/dwm.suckless.org/patches/fancybar.md Sun Sep 30 17:12:04 2012 -0400
_AT_@ -14,6 +14,7 @@
* [fancybar-5.6.1.diff](historical/fancybar-5.6.1.diff) (dwm 5.6.1) (20090824)
* [fancybar-r1496.diff](fancybar-r1496.diff) (dwm 5.7) (20090922)
+ * [fancybar-c794a9f5ae5e.patch](fancybar-c794a9f5ae5e.patch) (hg rev c794a9f5ae5e) (20120708)
## Author
Received on Sun Sep 30 2012 - 23:11:34 CEST
This archive was generated by hypermail 2.3.0
: Sun Sep 30 2012 - 23:12:07 CEST