[wiki] [sites] [dwm][patch][zoomswap] Fix warning, clean || aleks
commit c36c778d81115e35d2a7447bf68114bed794c324
Author: aleks <aleks.stier_AT_icloud.com>
Date: Mon Jul 22 13:32:37 2019 +0200
[dwm][patch][zoomswap] Fix warning, clean
Fix warning regarding the pop-function which is not needed anymore by
removing it. Also pull the zoomswap.c file into dwm.c so you do not need
to include it in config.def.h. Additionally, fix some style-issues.
diff --git a/dwm.suckless.org/patches/zoomswap/dwm-zoomswap-6.2.diff b/dwm.suckless.org/patches/zoomswap/dwm-zoomswap-6.2.diff
new file mode 100644
index 00000000..f159d8bf
--- /dev/null
+++ b/dwm.suckless.org/patches/zoomswap/dwm-zoomswap-6.2.diff
_AT_@ -0,0 +1,119 @@
+From 9fa1edf9f616e2579a386e8d51e0690f0a96e78c Mon Sep 17 00:00:00 2001
+From: aleks <aleks.stier_AT_icloud.com>
+Date: Mon, 22 Jul 2019 13:06:50 +0200
+Subject: [PATCH] Put master to exact position of zoomed client
+
+The default behaviour when zooming a client is to put the previous
+master on top of the client-stack. This patch puts the master to the
+exact position of the zoomed client in the stack.
+---
+ dwm.c | 54 ++++++++++++++++++++++++++++++++++++++++--------------
+ 1 file changed, 40 insertions(+), 14 deletions(-)
+
+diff --git a/dwm.c b/dwm.c
+index 4465af1..b5bcf41 100644
+--- a/dwm.c
++++ b/dwm.c
+_AT_@ -165,6 +165,7 @@ static void drawbar(Monitor *m);
+ static void drawbars(void);
+ static void enternotify(XEvent *e);
+ static void expose(XEvent *e);
++static Client *findbefore(Client *c);
+ static void focus(Client *c);
+ static void focusin(XEvent *e);
+ static void focusmon(const Arg *arg);
+_AT_@ -184,7 +185,6 @@ static void monocle(Monitor *m);
+ static void motionnotify(XEvent *e);
+ static void movemouse(const Arg *arg);
+ static Client *nexttiled(Client *c);
+-static void pop(Client *);
+ static void propertynotify(XEvent *e);
+ static void quit(const Arg *arg);
+ static Monitor *recttomon(int x, int y, int w, int h);
+_AT_@ -235,6 +235,7 @@ static int xerrorstart(Display *dpy, XErrorEvent *ee);
+ static void zoom(const Arg *arg);
+
+ /* variables */
++static Client *prevzoom = NULL;
+ static const char broken[] = "broken";
+ static char stext[256];
+ static int screen;
+_AT_@ -780,6 +781,16 @@ expose(XEvent *e)
+ drawbar(m);
+ }
+
++Client *
++findbefore(Client *c)
++{
++ Client *tmp;
++ if (c == selmon->clients)
++ return NULL;
++ for (tmp = selmon->clients; tmp && tmp->next != c; tmp = tmp->next);
++ return tmp;
++}
++
+ void
+ focus(Client *c)
+ {
+_AT_@ -1199,15 +1210,6 @@ nexttiled(Client *c)
+ return c;
+ }
+
+-void
+-pop(Client *c)
+-{
+- detach(c);
+- attach(c);
+- focus(c);
+- arrange(c->mon);
+-}
+-
+ void
+ propertynotify(XEvent *e)
+ {
+_AT_@ -2114,14 +2116,38 @@ void
+ zoom(const Arg *arg)
+ {
+ Client *c = selmon->sel;
++ Client *at = NULL, *cold, *cprevious = NULL;
+
+ if (!selmon->lt[selmon->sellt]->arrange
+ || (selmon->sel && selmon->sel->isfloating))
+ return;
+- if (c == nexttiled(selmon->clients))
+- if (!c || !(c = nexttiled(c->next)))
+- return;
+- pop(c);
++ if (c == nexttiled(selmon->clients)) {
++ at = findbefore(prevzoom);
++ if (at)
++ cprevious = nexttiled(at->next);
++ if (!cprevious || cprevious != prevzoom) {
++ prevzoom = NULL;
++ if (!c || !(c = nexttiled(c->next)))
++ return;
++ } else
++ c = cprevious;
++ }
++ cold = nexttiled(selmon->clients);
++ if (c != cold && !at)
++ at = findbefore(c);
++ detach(c);
++ attach(c);
++ /* swap windows instead of pushing the previous one down */
++ if (c != cold && at) {
++ prevzoom = cold;
++ if(cold && at != cold) {
++ detach(cold);
++ cold->next = at->next;
++ at->next = cold;
++ }
++ }
++ focus(c);
++ arrange(c->mon);
+ }
+
+ int
+--
+2.22.0
+
diff --git a/dwm.suckless.org/patches/zoomswap/index.md b/dwm.suckless.org/patches/zoomswap/index.md
index a7584f6b..f5b86986 100644
--- a/dwm.suckless.org/patches/zoomswap/index.md
+++ b/dwm.suckless.org/patches/zoomswap/index.md
_AT_@ -41,6 +41,7 @@ zooming.
Download
--------
+* [dwm-zoomswap-6.2.diff](dwm-zoomswap-6.2.diff)
* [dwm-zoomswap-20160731-56a31dc.diff](dwm-zoomswap-20160731-56a31dc.diff)
* [dwm-6.1-zoomswap.diff](dwm-6.1-zoomswap.diff) (2585b) (20120406)
* [dwm-zoomswap-6.0.diff](dwm-zoomswap-6.0.diff) (1.6K) (20120406)
_AT_@ -48,3 +49,4 @@ Download
Author
------
* Jan Christoph Ebersbach - `<jceb at e-jc dot de>`
+* Aleksandrs Stier (6.2)
Received on Mon Jul 22 2019 - 13:40:39 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 22 2019 - 13:48:29 CEST