[wiki] [official] Update pertag patch for dwm 5.2 || jpic

From: <hg_AT_suckless.org>
Date: Tue, 14 Oct 2008 08:13:39 +0100 (BST)

changeset: 162:ba6673c7feb4
tag: tip
user: jpic
date: Mon Oct 13 00:52:18 2008 +0200
files: dwm/patches/dwm-5.2-pertag.patch dwm/patches/pertag.md
description:
Update pertag patch for dwm 5.2


diff -r a44f480ba6fc -r ba6673c7feb4 dwm/patches/dwm-5.2-pertag.patch
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/dwm/patches/dwm-5.2-pertag.patch Mon Oct 13 00:52:18 2008 +0200
_AT_@ -0,0 +1,123 @@
+--- dwm-5.2/dwm.c 2008-09-09 21:46:17.000000000 +0200
++++ dwm-5.2-pertag/dwm.c 2008-10-12 23:53:30.000000000 +0200
+_AT_@ -240,6 +240,11 @@
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+
++static int curtag = 1, prevtag = 1;
++static Layout *lts[LENGTH(tags) + 1];
++static double mfacts[LENGTH(tags) + 1];
++static Bool showbars[LENGTH(tags) + 1];
++
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[sizeof(unsigned int) * 8 < LENGTH(tags) ? -1 : 1]; };
+
+_AT_@ -1272,7 +1277,7 @@
+ if(!arg || !arg->v || arg->v != lt[sellt])
+ sellt ^= 1;
+ if(arg && arg->v)
+- lt[sellt] = (Layout *)arg->v;
++ lt[sellt] = lts[curtag] = (Layout *)arg->v;
+ if(sel)
+ arrange();
+ else
+_AT_@ -1289,7 +1294,7 @@
+ f = arg->f < 1.0 ? arg->f + mfact : arg->f - 1.0;
+ if(f < 0.1 || f > 0.9)
+ return;
+- mfact = f;
++ mfact = mfacts[curtag] = f;
+ arrange();
+ }
+
+_AT_@ -1337,12 +1342,27 @@
+ if(!dc.font.set)
+ XSetFont(dpy, dc.gc, dc.font.xfont->fid);
+
++ /* init mfacts */
++ for(i=0; i < LENGTH(tags) + 1 ; i++) {
++ mfacts[i] = mfact;
++ }
++
++ /* init layouts */
++ for(i=0; i < LENGTH(tags) + 1; i++) {
++ lts[i] = &layouts[0];
++ }
++
++
+ /* init bar */
+ for(blw = i = 0; LENGTH(layouts) > 1 && i < LENGTH(layouts); i++) {
+ w = TEXTW(layouts[i].symbol);
+ blw = MAX(blw, w);
+ }
+
++ for(i=0; i < LENGTH(tags) + 1; i++) {
++ showbars[i] = showbar;
++ }
++
+ wa.override_redirect = 1;
+ wa.background_pixmap = ParentRelative;
+ wa.event_mask = ButtonPressMask|ExposureMask;
+_AT_@ -1457,7 +1477,7 @@
+
+ void
+ togglebar(const Arg *arg) {
+- showbar = !showbar;
++ showbar = showbars[curtag] = !showbar;
+ updategeom();
+ updatebar();
+ arrange();
+_AT_@ -1490,9 +1510,23 @@
+ void
+ toggleview(const Arg *arg) {
+ unsigned int mask = tagset[seltags] ^ (arg->ui & TAGMASK);
++ unsigned int i;
+
+ if(mask) {
++ if(mask == ~0) {
++ prevtag = curtag;
++ curtag = 0;
++ }
++ if(!(mask & 1 << (curtag - 1))) {
++ prevtag = curtag;
++ for (i=0; !(mask & 1 << i); i++);
++ curtag = i + 1;
++ }
+ tagset[seltags] = mask;
++ lt[sellt] = lts[curtag];
++ mfact = mfacts[curtag];
++ if (showbar != showbars[curtag])
++ togglebar(NULL);
+ clearurgent();
+ arrange();
+ }
+_AT_@ -1661,11 +1695,28 @@
+
+ void
+ view(const Arg *arg) {
++ unsigned int i;
+ if((arg->ui & TAGMASK) == tagset[seltags])
+ return;
+ seltags ^= 1; /* toggle sel tagset */
+- if(arg->ui & TAGMASK)
++ if(arg->ui & TAGMASK) {
+ tagset[seltags] = arg->ui & TAGMASK;
++ prevtag = curtag;
++ if(arg->ui == ~0)
++ curtag = 0;
++ else {
++ for (i=0; !(arg->ui & 1 << i); i++);
++ curtag = i + 1;
++ }
++ } else {
++ prevtag= curtag ^ prevtag;
++ curtag^= prevtag;
++ prevtag= curtag ^ prevtag;
++ }
++ lt[sellt]= lts[curtag];
++ mfact = mfacts[curtag];
++ if(showbar != showbars[curtag])
++ togglebar(NULL);
+ clearurgent();
+ arrange();
+ }
diff -r a44f480ba6fc -r ba6673c7feb4 dwm/patches/pertag.md
--- a/dwm/patches/pertag.md Mon Oct 13 00:51:57 2008 +0200
+++ b/dwm/patches/pertag.md Mon Oct 13 00:52:18 2008 +0200
_AT_@ -6,6 +6,7 @@
 installed) per tag.
 
 ## Download ##
+ * [dwm-5.2-pertag.diff][6]
  * [dwm-5.1-pertag.diff][5]
  * [dwm-5.0-pertag.diff][4]
  * [dwm-4.6-pertag.diff][1]
_AT_@ -21,4 +22,4 @@
 [3]: /dwm/patches/taglayouts.html
 [4]: http://www.e-jc.de/dwm/5.0/current/dwm-5.0-pertag.diff
 [5]: http://v4hn.de/patches/dwm-5.1-pertag.diff
-
+[6]: http://www.suckless.org/dwm/patches/dwm-5.2-pertag.diff
Received on Tue Oct 14 2008 - 09:13:39 CEST

This archive was generated by hypermail 2.3.0 : Thu Sep 13 2012 - 19:30:26 CEST