[wiki] [sites] [dwm][PATCH] removed redundant code from attachtop and attachdirection. || MLquest8
commit ae7ce70a7d1012a73a6fc4d97d63b8a10f61ee0b
Author: MLquest8 <miskuzius_AT_gmail.com>
Date: Thu Jun 18 15:57:52 2020 +0400
[dwm][PATCH] removed redundant code from attachtop and attachdirection.
diff --git a/dwm.suckless.org/patches/attachdirection/dwm-attachdirection-6.2.diff b/dwm.suckless.org/patches/attachdirection/dwm-attachdirection-6.2.diff
index 609f6448..aab43b56 100644
--- a/dwm.suckless.org/patches/attachdirection/dwm-attachdirection-6.2.diff
+++ b/dwm.suckless.org/patches/attachdirection/dwm-attachdirection-6.2.diff
_AT_@ -1,4 +1,4 @@
-From 58f3937e7d2ac5d711244f9b0826b8ba32584a48 Mon Sep 17 00:00:00 2001
+From faa0d3a06229906b8cd30cdeb4360ee9608f74bd Mon Sep 17 00:00:00 2001
From: MLquest8 <miskuzius_AT_gmail.com>
Date: Thu, 18 Jun 2020 15:14:56 +0400
Subject: [PATCH] attachdirection updated. Added attachtop option(5) that
_AT_@ -6,8 +6,8 @@ Subject: [PATCH] attachdirection updated. Added attachtop option(5) that
---
config.def.h | 1 +
- dwm.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++--
- 2 files changed, 153 insertions(+), 4 deletions(-)
+ dwm.c | 146 +++++++++++++++++++++++++++++++++++++++++++++++++--
+ 2 files changed, 143 insertions(+), 4 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..d7c089b 100644
_AT_@ -22,7 +22,7 @@ index 1c0b587..d7c089b 100644
static const Layout layouts[] = {
/* symbol arrange function */
diff --git a/dwm.c b/dwm.c
-index 9fd0286..e128c31 100644
+index 9fd0286..2c1b143 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -49,7 +49,8 @@
_AT_@ -55,7 +55,7 @@ index 9fd0286..e128c31 100644
static Client *nexttiled(Client *c);
static void pop(Client *);
static void propertynotify(XEvent *e);
-_AT_@ -407,6 +414,83 @@ attach(Client *c)
+_AT_@ -407,6 +414,73 @@ attach(Client *c)
c->mon->clients = c;
}
_AT_@ -114,32 +114,22 @@ index 9fd0286..e128c31 100644
+ Monitor *m = selmon;
+ Client *below;
+
-+ if (m->nmaster == 0){
-+ for (below = c->mon->clients; below && below->next; below = below->next);
-+ c->next = NULL;
-+ if (below)
-+ below->next = c;
-+ else
-+ c->mon->clients = c;
-+ }
-+ else {
-+ for (n = 1, below = c->mon->clients;
-+ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
-+ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
-+ c->next = NULL;
-+ if (below) {
-+ c->next = below->next;
-+ below->next = c;
-+ }
-+ else
-+ c->mon->clients = c;
++ for (n = 1, below = c->mon->clients;
++ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
++ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
++ c->next = NULL;
++ if (below) {
++ c->next = below->next;
++ below->next = c;
+ }
++ else
++ c->mon->clients = c;
+}
+
void
attachstack(Client *c)
{
-_AT_@ -1063,7 +1147,25 @@ manage(Window w, XWindowAttributes *wa)
+_AT_@ -1063,7 +1137,25 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
_AT_@ -166,7 +156,7 @@ index 9fd0286..e128c31 100644
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
-_AT_@ -1193,6 +1295,16 @@ movemouse(const Arg *arg)
+_AT_@ -1193,6 +1285,16 @@ movemouse(const Arg *arg)
}
}
_AT_@ -183,7 +173,7 @@ index 9fd0286..e128c31 100644
Client *
nexttiled(Client *c)
{
-_AT_@ -1418,7 +1530,25 @@ sendmon(Client *c, Monitor *m)
+_AT_@ -1418,7 +1520,25 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
_AT_@ -210,7 +200,7 @@ index 9fd0286..e128c31 100644
attachstack(c);
focus(NULL);
arrange(NULL);
-_AT_@ -1900,7 +2030,25 @@ updategeom(void)
+_AT_@ -1900,7 +2020,25 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
diff --git a/dwm.suckless.org/patches/attachtop/dwm-attachtop-6.2.diff b/dwm.suckless.org/patches/attachtop/dwm-attachtop-6.2.diff
index 5900c52e..a3b959cf 100644
--- a/dwm.suckless.org/patches/attachtop/dwm-attachtop-6.2.diff
+++ b/dwm.suckless.org/patches/attachtop/dwm-attachtop-6.2.diff
_AT_@ -1,15 +1,15 @@
-From 852763830e1d245e954bf8a220867c76148694e3 Mon Sep 17 00:00:00 2001
+From 17acbdcb56d0d2f39507a3f67ef329c14a213ef6 Mon Sep 17 00:00:00 2001
From: MLquest8 <miskuzius_AT_gmail.com>
Date: Thu, 18 Jun 2020 15:34:18 +0400
Subject: [PATCH] attachtop. Attaches new client below the last master/on top
of the stack. In case of nmaster = 1 behaves like attachaside.
---
- dwm.c | 39 +++++++++++++++++++++++++++++++++++----
- 1 file changed, 35 insertions(+), 4 deletions(-)
+ dwm.c | 29 +++++++++++++++++++++++++----
+ 1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/dwm.c b/dwm.c
-index 9fd0286..4d0152f 100644
+index 9fd0286..7ced982 100644
--- a/dwm.c
+++ b/dwm.c
_AT_@ -49,7 +49,8 @@
_AT_@ -30,7 +30,7 @@ index 9fd0286..4d0152f 100644
static void attachstack(Client *c);
static void buttonpress(XEvent *e);
static void checkotherwm(void);
-_AT_@ -407,6 +409,35 @@ attach(Client *c)
+_AT_@ -407,6 +409,25 @@ attach(Client *c)
c->mon->clients = c;
}
_AT_@ -41,32 +41,22 @@ index 9fd0286..4d0152f 100644
+ Monitor *m = selmon;
+ Client *below;
+
-+ if (m->nmaster == 0){
-+ for (below = c->mon->clients; below && below->next; below = below->next);
-+ c->next = NULL;
-+ if (below)
-+ below->next = c;
-+ else
-+ c->mon->clients = c;
-+ }
-+ else {
-+ for (n = 1, below = c->mon->clients;
-+ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
-+ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
-+ c->next = NULL;
-+ if (below) {
-+ c->next = below->next;
-+ below->next = c;
-+ }
-+ else
-+ c->mon->clients = c;
++ for (n = 1, below = c->mon->clients;
++ below && below->next && (below->isfloating || !ISVISIBLEONTAG(below, c->tags) || n != m->nmaster);
++ n = below->isfloating || !ISVISIBLEONTAG(below, c->tags) ? n + 0 : n + 1, below = below->next);
++ c->next = NULL;
++ if (below) {
++ c->next = below->next;
++ below->next = c;
+ }
++ else
++ c->mon->clients = c;
+}
+
void
attachstack(Client *c)
{
-_AT_@ -1063,7 +1094,7 @@ manage(Window w, XWindowAttributes *wa)
+_AT_@ -1063,7 +1084,7 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating)
XRaiseWindow(dpy, c->win);
_AT_@ -75,7 +65,7 @@ index 9fd0286..4d0152f 100644
attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1);
-_AT_@ -1418,7 +1449,7 @@ sendmon(Client *c, Monitor *m)
+_AT_@ -1418,7 +1439,7 @@ sendmon(Client *c, Monitor *m)
detachstack(c);
c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
_AT_@ -84,7 +74,7 @@ index 9fd0286..4d0152f 100644
attachstack(c);
focus(NULL);
arrange(NULL);
-_AT_@ -1900,7 +1931,7 @@ updategeom(void)
+_AT_@ -1900,7 +1921,7 @@ updategeom(void)
m->clients = c->next;
detachstack(c);
c->mon = mons;
Received on Thu Jun 18 2020 - 13:59:31 CEST
This archive was generated by hypermail 2.3.0
: Thu Jun 18 2020 - 14:00:45 CEST