[wiki] [sites] [dwm][attachbottom] Fixed a bug causing dwm to freeze when moving clients to adjacent monitors || bakkeby

From: <git_AT_suckless.org>
Date: Thu, 23 Apr 2020 10:27:24 +0200

commit b333c98d91c7c0db5e165a599d9c321824858665
Author: bakkeby <bakkeby_AT_gmail.com>
Date: Thu Apr 23 10:27:13 2020 +0200

    [dwm][attachbottom] Fixed a bug causing dwm to freeze when moving clients to adjacent monitors
    
    The attachbottom patch did not consider that the client being processed may already have a c->next reference set. When moving clients between monitors with this patch enabled causes display issues at first, then a freeze of dwm.
    
    Explicitly setting c->next to NULL prevents this issue.

diff --git a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff
similarity index 52%
rename from dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff
rename to dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff
index 71d092fe..5e83e3ed 100644
--- a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff
+++ b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff
_AT_@ -1,60 +1,71 @@
-Binary files dwm/drw.o and dwm.patched/drw.o differ
-Binary files dwm/dwm and dwm.patched/dwm differ
-diff -ruN dwm/dwm.c dwm.patched/dwm.c
---- dwm/dwm.c 2018-05-22 20:05:47.208417141 -0700
-+++ dwm.patched/dwm.c 2018-06-20 15:08:07.380496725 -0700
-_AT_@ -147,6 +147,7 @@
+From 5db9b0d2860948ff42cbdae4031c90b3aa9c7d2f Mon Sep 17 00:00:00 2001
+From: bakkeby <bakkeby_AT_gmail.com>
+Date: Thu, 23 Apr 2020 10:06:18 +0200
+Subject: [PATCH] attachbottom patch
+
+New clients attach at the bottom of the stack instead of the top.
+---
+ dwm.c | 19 ++++++++++++++++---
+ 1 file changed, 16 insertions(+), 3 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 4465af1..bf13d15 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -147,6 +147,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 attachbelow(Client *c);
++static void attachbottom(Client *c);
  static void attachstack(Client *c);
  static void buttonpress(XEvent *e);
  static void checkotherwm(void);
-_AT_@ -407,6 +408,17 @@
+_AT_@ -406,6 +407,18 @@ attach(Client *c)
+ c->mon->clients = c;
  }
  
- void
-+attachbelow(Client *c)
++void
++attachbottom(Client *c)
 +{
 + Client *below = c->mon->clients;
 + for (; below && below->next; below = below->next);
++ c->next = NULL;
 + if (below)
 + below->next = c;
 + else
 + c->mon->clients = c;
 +}
 +
-+void
+ void
  attachstack(Client *c)
  {
- c->snext = c->mon->stack;
-_AT_@ -1065,7 +1077,7 @@
+_AT_@ -1062,7 +1075,7 @@ manage(Window w, XWindowAttributes *wa)
                  c->isfloating = c->oldstate = trans != None || c->isfixed;
          if (c->isfloating)
                  XRaiseWindow(dpy, c->win);
 - attach(c);
-+ attachbelow(c);
++ attachbottom(c);
          attachstack(c);
          XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
                  (unsigned char *) &(c->win), 1);
-_AT_@ -1420,7 +1432,7 @@
+_AT_@ -1417,7 +1430,7 @@ sendmon(Client *c, Monitor *m)
          detachstack(c);
          c->mon = m;
          c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
 - attach(c);
-+ attachbelow(c);
++ attachbottom(c);
          attachstack(c);
          focus(NULL);
          arrange(NULL);
-_AT_@ -1900,7 +1912,7 @@
+_AT_@ -1897,7 +1910,7 @@ updategeom(void)
                                          m->clients = c->next;
                                          detachstack(c);
                                          c->mon = mons;
 - attach(c);
-+ attachbelow(c);
++ attachbottom(c);
                                          attachstack(c);
                                  }
                                  if (m == selmon)
-Binary files dwm/dwm.o and dwm.patched/dwm.o differ
-Binary files dwm/util.o and dwm.patched/util.o differ
+--
+2.17.1
+
diff --git a/dwm.suckless.org/patches/attachbottom/index.md b/dwm.suckless.org/patches/attachbottom/index.md
index 6db5423e..90ba43b2 100644
--- a/dwm.suckless.org/patches/attachbottom/index.md
+++ b/dwm.suckless.org/patches/attachbottom/index.md
_AT_@ -10,7 +10,7 @@ clients are ever moved, only resized.
 
 Download
 --------
-* [dwm-attachbottom-6.1.diff](dwm-attachbottom-6.1.diff)
+* [dwm-attachbottom-6.2.diff](dwm-attachbottom-6.2.diff)
 
 Authors
 -------
Received on Thu Apr 23 2020 - 10:27:24 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 23 2020 - 10:36:53 CEST