sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit b333c98d91c7c0db5e165a599d9c321824858665
parent bf35f717e684b5da49a5941bada7a0b7dc599671
Author: bakkeby <bakkeby@gmail.com>
Date:   Thu, 23 Apr 2020 10:27:13 +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.

Diffstat:
Ddwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff | 60------------------------------------------------------------
Adwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/attachbottom/index.md | 2+-
3 files changed, 72 insertions(+), 61 deletions(-)

diff --git a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.1.diff @@ -1,60 +0,0 @@ -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 -@@ -147,6 +147,7 @@ - static void arrange(Monitor *m); - static void arrangemon(Monitor *m); - static void attach(Client *c); -+static void attachbelow(Client *c); - static void attachstack(Client *c); - static void buttonpress(XEvent *e); - static void checkotherwm(void); -@@ -407,6 +408,17 @@ - } - - void -+attachbelow(Client *c) -+{ -+ Client *below = c->mon->clients; -+ for (; below && below->next; below = below->next); -+ if (below) -+ below->next = c; -+ else -+ c->mon->clients = c; -+} -+ -+void - attachstack(Client *c) - { - c->snext = c->mon->stack; -@@ -1065,7 +1077,7 @@ - c->isfloating = c->oldstate = trans != None || c->isfixed; - if (c->isfloating) - XRaiseWindow(dpy, c->win); -- attach(c); -+ attachbelow(c); - attachstack(c); - XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, - (unsigned char *) &(c->win), 1); -@@ -1420,7 +1432,7 @@ - detachstack(c); - c->mon = m; - c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ -- attach(c); -+ attachbelow(c); - attachstack(c); - focus(NULL); - arrange(NULL); -@@ -1900,7 +1912,7 @@ - m->clients = c->next; - detachstack(c); - c->mon = mons; -- attach(c); -+ attachbelow(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 diff --git a/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff b/dwm.suckless.org/patches/attachbottom/dwm-attachbottom-6.2.diff @@ -0,0 +1,71 @@ +From 5db9b0d2860948ff42cbdae4031c90b3aa9c7d2f Mon Sep 17 00:00:00 2001 +From: bakkeby <bakkeby@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 +@@ -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 attachbottom(Client *c); + static void attachstack(Client *c); + static void buttonpress(XEvent *e); + static void checkotherwm(void); +@@ -406,6 +407,18 @@ attach(Client *c) + c->mon->clients = 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 + attachstack(Client *c) + { +@@ -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); ++ attachbottom(c); + attachstack(c); + XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, + (unsigned char *) &(c->win), 1); +@@ -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); ++ attachbottom(c); + attachstack(c); + focus(NULL); + arrange(NULL); +@@ -1897,7 +1910,7 @@ updategeom(void) + m->clients = c->next; + detachstack(c); + c->mon = mons; +- attach(c); ++ attachbottom(c); + attachstack(c); + } + if (m == selmon) +-- +2.17.1 + diff --git a/dwm.suckless.org/patches/attachbottom/index.md b/dwm.suckless.org/patches/attachbottom/index.md @@ -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 -------