commit 16fe76f7934965a50deb93aca049769bf77ed697
parent d10bb59387fa9de545ab94c96a504a6bc0f10be5
Author: Jan Christoph Ebersbach <jceb@e-jc.de>
Date: Sun, 9 Feb 2014 20:03:49 +0100
update save floats patch
Diffstat:
2 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/dwm.suckless.org/patches/dwm-6.1-save_floats.diff b/dwm.suckless.org/patches/dwm-6.1-save_floats.diff
@@ -0,0 +1,47 @@
+URL: http://dwm.suckless.org/patches/historical/save_floats
+This patch saves size and position of every floating window before it is forced
+into tiled mode. If the window is made floating again, the old dimensions will
+be restored.
+
+Index: dwm/dwm.c
+===================================================================
+--- dwm/dwm.c.orig 2014-02-09 15:24:10.344116918 +0100
++++ dwm/dwm.c 2014-02-09 15:24:10.336116918 +0100
+@@ -87,6 +87,7 @@
+ char name[256];
+ float mina, maxa;
+ int x, y, w, h;
++ int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
+ int oldx, oldy, oldw, oldh;
+ int basew, baseh, incw, inch, maxw, maxh, minw, minh;
+ int bw, oldbw;
+@@ -1045,6 +1046,10 @@
+ updatewindowtype(c);
+ updatesizehints(c);
+ updatewmhints(c);
++ c->sfx = c->x;
++ c->sfy = c->y;
++ c->sfw = c->w;
++ c->sfh = c->h;
+ XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
+ grabbuttons(c, False);
+ if(!c->isfloating)
+@@ -1641,8 +1646,16 @@
+ return;
+ selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
+ if(selmon->sel->isfloating)
+- resize(selmon->sel, selmon->sel->x, selmon->sel->y,
+- selmon->sel->w, selmon->sel->h, False);
++ /*restore last known float dimensions*/
++ resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
++ selmon->sel->sfw, selmon->sel->sfh, False);
++ else {
++ /*save last known float dimensions*/
++ selmon->sel->sfx = selmon->sel->x;
++ selmon->sel->sfy = selmon->sel->y;
++ selmon->sel->sfw = selmon->sel->w;
++ selmon->sel->sfh = selmon->sel->h;
++ }
+ arrange(selmon);
+ }
+
diff --git a/dwm.suckless.org/patches/save_floats.md b/dwm.suckless.org/patches/save_floats.md
@@ -7,8 +7,9 @@ be restored.
## Download ##
Patches against different versions of dwm are available at
-[dwm-clean-patches](https://bitbucket.org/jceb81/dwm-clean-patches/src).
+[dwm-clean-patches](https://github.com/jceb/dwm-clean-patches).
+ * [dwm-6.1-save_floats.diff](dwm-6.1-save_floats.diff) (1605b) (20140209)
* [dwm-10e232f9ace7-save_floats.diff](dwm-10e232f9ace7-save_floats.diff) (1604b) (20120406)
* [dwm-6.0-save_floats.diff](dwm-6.0-save_floats.diff) (1528b) (20120406)