[wiki] [sites] Update attachabove and attachaside diff files || Zachary Owen

From: <git_AT_suckless.org>
Date: Fri, 26 Jan 2018 23:17:58 +0100

commit b80ddc50177bdeaca5309e280b08fad48c3c1544
Author: Zachary Owen <penguinking1991_AT_gmail.com>
Date: Fri Jan 26 15:15:14 2018 -0700

    Update attachabove and attachaside diff files

diff --git a/dwm.suckless.org/patches/attachabove/dwm-attachabove-20180126-db22360.diff b/dwm.suckless.org/patches/attachabove/dwm-attachabove-20180126-db22360.diff
new file mode 100644
index 00000000..873a3453
--- /dev/null
+++ b/dwm.suckless.org/patches/attachabove/dwm-attachabove-20180126-db22360.diff
_AT_@ -0,0 +1,52 @@
+diff --git a/dwm.c b/dwm.c
+index ec6a27c..40e46bf 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -407,6 +407,20 @@ attach(Client *c)
+ c->mon->clients = c;
+ }
+
++void
++attachabove(Client *c)
++{
++ if(c->mon->sel == NULL || c->mon->sel == c->mon->clients || c->mon->sel->isfloating) {
++ attach(c);
++ return;
++ }
++
++ Client *at;
++ for(at = c->mon->clients; at->next != c->mon->sel; at = at->next);
++ c->next = at->next;
++ at->next = c;
++}
++
+ void
+ attachstack(Client *c)
+ {
+_AT_@ -1204,7 +1218,7 @@ void
+ pop(Client *c)
+ {
+ detach(c);
+- attach(c);
++ attachabove(c);
+ focus(c);
+ arrange(c->mon);
+ }
+_AT_@ -1418,7 +1432,7 @@ sendmon(Client *c, Monitor *m)
+ detachstack(c);
+ c->mon = m;
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ focus(NULL);
+ arrange(NULL);
+_AT_@ -1898,7 +1912,7 @@ updategeom(void)
+ m->clients = c->next;
+ detachstack(c);
+ c->mon = mons;
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ }
+ if (m == selmon)
diff --git a/dwm.suckless.org/patches/attachabove/index.md b/dwm.suckless.org/patches/attachabove/index.md
index 5b7be5c7..9e350c9e 100644
--- a/dwm.suckless.org/patches/attachabove/index.md
+++ b/dwm.suckless.org/patches/attachabove/index.md
_AT_@ -13,6 +13,7 @@ Download
  * [dwm-attachabove-6.0.diff](dwm-attachabove-6.0.diff)
  * [dwm-attachabove-6.1.diff](dwm-attachabove-6.1.diff)
  * [dwm-attachabove-20160713-56a31dc.diff](dwm-attachabove-20160713-56a31dc.diff)
+ * [dwm-attachabove-20180126-db22360.diff](dwm-attachabove-20180126-db22360.diff)
 
 Authors
 -------
diff --git a/dwm.suckless.org/patches/attachaside/dwm-attachaside-20180126-db22360.diff b/dwm.suckless.org/patches/attachaside/dwm-attachaside-20180126-db22360.diff
new file mode 100644
index 00000000..7e2ff0fb
--- /dev/null
+++ b/dwm.suckless.org/patches/attachaside/dwm-attachaside-20180126-db22360.diff
_AT_@ -0,0 +1,101 @@
+diff --git a/dwm.c b/dwm.c
+index ec6a27c..7b6ce67 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -49,7 +49,8 @@
+ #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
+ #define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
+ * 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 ISVISIBLEONTAG(C, T) ((C->tags & T))
++#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
+ #define LENGTH(X) (sizeof X / sizeof X[0])
+ #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
+ #define WIDTH(X) ((X)->w + 2 * (X)->bw)
+_AT_@ -148,6 +149,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
+ static void arrange(Monitor *m);
+ static void arrangemon(Monitor *m);
+ static void attach(Client *c);
++static void attachaside(Client *c);
+ static void attachstack(Client *c);
+ static void buttonpress(XEvent *e);
+ static void checkotherwm(void);
+_AT_@ -184,6 +186,7 @@ static void maprequest(XEvent *e);
+ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
++static Client *nexttagged(Client *c);
+ static Client *nexttiled(Client *c);
+ static void pop(Client *);
+ static void propertynotify(XEvent *e);
+_AT_@ -407,6 +410,18 @@ attach(Client *c)
+ c->mon->clients = c;
+ }
+
++void
++attachaside(Client *c) {
++ Client *at = nexttagged(c);
++ if(!at) {
++ attach(c);
++ return;
++ }
++ c->next = at->next;
++ at->next = c;
++}
++
++
+ void
+ attachstack(Client *c)
+ {
+_AT_@ -1063,7 +1078,7 @@ manage(Window w, XWindowAttributes *wa)
+ c->isfloating = c->oldstate = trans != None || c->isfixed;
+ if (c->isfloating)
+ XRaiseWindow(dpy, c->win);
+- attach(c);
++ attachaside(c);
+ attachstack(c);
+ XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
+ (unsigned char *) &(c->win), 1);
+_AT_@ -1193,6 +1208,16 @@ movemouse(const Arg *arg)
+ }
+ }
+
++ Client *
++nexttagged(Client *c) {
++ Client *walked = c->mon->clients;
++ for(;
++ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
++ walked = walked->next
++ );
++ return walked;
++}
++
+ Client *
+ nexttiled(Client *c)
+ {
+_AT_@ -1204,7 +1229,7 @@ void
+ pop(Client *c)
+ {
+ detach(c);
+- attach(c);
++ attachaside(c);
+ focus(c);
+ arrange(c->mon);
+ }
+_AT_@ -1418,7 +1443,7 @@ sendmon(Client *c, Monitor *m)
+ detachstack(c);
+ c->mon = m;
+ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+- attach(c);
++ attachaside(c);
+ attachstack(c);
+ focus(NULL);
+ arrange(NULL);
+_AT_@ -1899,6 +1924,7 @@ updategeom(void)
+ detachstack(c);
+ c->mon = mons;
+ attach(c);
++ attachaside(c);
+ attachstack(c);
+ }
+ if (m == selmon)
diff --git a/dwm.suckless.org/patches/attachaside/index.md b/dwm.suckless.org/patches/attachaside/index.md
index ad7896f7..87d29dae 100644
--- a/dwm.suckless.org/patches/attachaside/index.md
+++ b/dwm.suckless.org/patches/attachaside/index.md
_AT_@ -47,6 +47,8 @@ Download
 
 * [dwm-attachaside-6.1.diff](dwm-attachaside-6.1.diff)
 * [dwm-attachaside-20160718-56a31dc.diff](dwm-attachaside-20160718-56a31dc.diff)
+* [dwm-attachaside-20180126-db22360.diff](dwm-attachaside-20180126-db22360.diff)
+
 
 Authors
 -------
Received on Fri Jan 26 2018 - 23:17:58 CET

This archive was generated by hypermail 2.3.0 : Fri Jan 26 2018 - 23:24:21 CET