dwm-savefloats-6.0.diff - sites - public wiki contents of suckless.org
(HTM) git clone git://git.suckless.org/sites
(DIR) Log
(DIR) Files
(DIR) Refs
---
dwm-savefloats-6.0.diff (1528B)
---
1 URL: http://dwm.suckless.org/patches/historical/save_floats
2 This patch saves size and position of every floating window before it is forced
3 into tiled mode. If the window is made floating again, the old dimensions will
4 be restored.
5
6 diff -r ec4baab78314 dwm.c
7 --- a/dwm.c Mon Dec 19 15:38:30 2011 +0100
8 +++ b/dwm.c Fri Apr 06 08:23:18 2012 +0200
9 @@ -86,6 +86,7 @@
10 char name[256];
11 float mina, maxa;
12 int x, y, w, h;
13 + int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode revert */
14 int oldx, oldy, oldw, oldh;
15 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
16 int bw, oldbw;
17 @@ -1149,6 +1150,10 @@
18 updatewindowtype(c);
19 updatesizehints(c);
20 updatewmhints(c);
21 + c->sfx = c->x;
22 + c->sfy = c->y;
23 + c->sfw = c->w;
24 + c->sfh = c->h;
25 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
26 grabbuttons(c, False);
27 if(!c->isfloating)
28 @@ -1741,8 +1746,16 @@
29 return;
30 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
31 if(selmon->sel->isfloating)
32 - resize(selmon->sel, selmon->sel->x, selmon->sel->y,
33 - selmon->sel->w, selmon->sel->h, False);
34 + /*restore last known float dimensions*/
35 + resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy,
36 + selmon->sel->sfw, selmon->sel->sfh, False);
37 + else {
38 + /*save last known float dimensions*/
39 + selmon->sel->sfx = selmon->sel->x;
40 + selmon->sel->sfy = selmon->sel->y;
41 + selmon->sel->sfw = selmon->sel->w;
42 + selmon->sel->sfh = selmon->sel->h;
43 + }
44 arrange(selmon);
45 }
46