[wiki] [sites] [dwm][patch]attachabove fix crash when setting master window || Kian Kasad

From: <git_AT_suckless.org>
Date: Wed, 22 Apr 2020 07:33:20 +0200

commit 163d4279b095b171d67ecfcfb30e3baf00813a54
Author: Kian Kasad <kdkasad_AT_gmail.com>
Date: Tue Apr 21 22:33:14 2020 -0700

    [dwm][patch]attachabove fix crash when setting master window

diff --git a/dwm.suckless.org/patches/attachabove/dwm-attachabove-6.2-20200421.diff b/dwm.suckless.org/patches/attachabove/dwm-attachabove-6.2-20200421.diff
new file mode 100644
index 00000000..198f293a
--- /dev/null
+++ b/dwm.suckless.org/patches/attachabove/dwm-attachabove-6.2-20200421.diff
_AT_@ -0,0 +1,60 @@
+diff --git a/local/src/dwm/dwm.c b/local/src/dwm/dwm.c
+index 83e44e0..94392b4 100644
+--- a/local/src/dwm/dwm.c
++++ b/local/src/dwm/dwm.c
+_AT_@ -164,6 +164,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 attachabove(Client *c);
+ static void attachstack(Client *c);
+ static void buttonpress(XEvent *e);
+ static void checkotherwm(void);
+_AT_@ -431,6 +432,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_@ -1272,7 +1287,7 @@ manage(Window w, XWindowAttributes *wa)
+ c->isfloating = c->oldstate = trans != None || c->isfixed;
+ if (c->isfloating)
+ XRaiseWindow(dpy, c->win);
+- attach(c);
++ attachabove(c);
+ attachstack(c);
+ XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
+ (unsigned char *) &(c->win), 1);
+_AT_@ -1633,7 +1648,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_@ -2122,7 +2137,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 468af2ef..1d7c014b 100644
--- a/dwm.suckless.org/patches/attachabove/index.md
+++ b/dwm.suckless.org/patches/attachabove/index.md
_AT_@ -12,9 +12,11 @@ Download
 * [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)
+* [dwm-attachabove-6.2-20200421.diff](dwm-attachabove-6.2-20200421.diff)
 
 Authors
 -------
 * Mate Nagy - <mnagy_AT_port70.net>
 * Jan Christoph Ebersbach - <jceb_AT_e-jc.de> (6.0, 6.1 ports)
 * Laslo Hunhold - <dev_AT_frign.de> (git port)
+* Kian Kasad - <kdkasad_AT_gmail.com> (6.2 port)
Received on Wed Apr 22 2020 - 07:33:20 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 22 2020 - 07:36:47 CEST