dwm-savefloats-20181212-b69c870.diff - sites - public wiki contents of suckless… | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-savefloats-20181212-b69c870.diff (1342B) | |
--- | |
1 diff --git i/dwm.c w/dwm.c | |
2 index 4465af1..96b0b26 100644 | |
3 --- i/dwm.c | |
4 +++ w/dwm.c | |
5 @@ -88,6 +88,7 @@ struct Client { | |
6 char name[256]; | |
7 float mina, maxa; | |
8 int x, y, w, h; | |
9 + int sfx, sfy, sfw, sfh; /* stored float geometry, used on mode … | |
10 int oldx, oldy, oldw, oldh; | |
11 int basew, baseh, incw, inch, maxw, maxh, minw, minh; | |
12 int bw, oldbw; | |
13 @@ -1056,6 +1057,10 @@ manage(Window w, XWindowAttributes *wa) | |
14 updatewindowtype(c); | |
15 updatesizehints(c); | |
16 updatewmhints(c); | |
17 + c->sfx = c->x; | |
18 + c->sfy = c->y; | |
19 + c->sfw = c->w; | |
20 + c->sfh = c->h; | |
21 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyCh… | |
22 grabbuttons(c, 0); | |
23 if (!c->isfloating) | |
24 @@ -1714,8 +1719,16 @@ togglefloating(const Arg *arg) | |
25 return; | |
26 selmon->sel->isfloating = !selmon->sel->isfloating || selmon->s… | |
27 if (selmon->sel->isfloating) | |
28 - resize(selmon->sel, selmon->sel->x, selmon->sel->y, | |
29 - selmon->sel->w, selmon->sel->h, 0); | |
30 + /* restore last known float dimensions */ | |
31 + resize(selmon->sel, selmon->sel->sfx, selmon->sel->sfy, | |
32 + selmon->sel->sfw, selmon->sel->sfh, False); | |
33 + else { | |
34 + /* save last known float dimensions */ | |
35 + selmon->sel->sfx = selmon->sel->x; | |
36 + selmon->sel->sfy = selmon->sel->y; | |
37 + selmon->sel->sfw = selmon->sel->w; | |
38 + selmon->sel->sfh = selmon->sel->h; | |
39 + } | |
40 arrange(selmon); | |
41 } | |
42 |