dwm-meillo
changeset 473:2d8af0d7920d
implemented the maximization as I described on the mailinglist, this feels better to me.
author | arg@mmvi |
---|---|
date | Fri, 22 Sep 2006 07:37:56 +0200 |
parents | 298be2d65d2e |
children | f57b92d6bc1d |
files | client.c config.arg.h config.default.h dwm.h event.c main.c view.c |
diffstat | 7 files changed, 25 insertions(+), 50 deletions(-) [+] |
line diff
1.1 --- a/client.c Wed Sep 20 09:53:21 2006 +0200 1.2 +++ b/client.c Fri Sep 22 07:37:56 2006 +0200 1.3 @@ -89,8 +89,6 @@ 1.4 if(!sel) 1.5 sel = c; 1.6 else if(sel != c) { 1.7 - if(maximized) 1.8 - togglemax(NULL); 1.9 old = sel; 1.10 sel = c; 1.11 if(old) { 1.12 @@ -208,6 +206,10 @@ 1.13 c->w = c->tw = wa->width; 1.14 c->h = wa->height; 1.15 c->th = bh; 1.16 + c->rx = sx; 1.17 + c->ry = bh; 1.18 + c->rw = sw; 1.19 + c->rh = sh - bh; 1.20 1.21 c->border = 0; 1.22 updatesize(c); 1.23 @@ -370,41 +372,6 @@ 1.24 } 1.25 1.26 void 1.27 -togglemax(Arg *arg) { 1.28 - int ox, oy, ow, oh; 1.29 - Client *c; 1.30 - XEvent ev; 1.31 - 1.32 - if(!sel) 1.33 - return; 1.34 - 1.35 - if((maximized = !maximized)) { 1.36 - ox = sel->x; 1.37 - oy = sel->y; 1.38 - ow = sel->w; 1.39 - oh = sel->h; 1.40 - sel->x = sx; 1.41 - sel->y = sy + bh; 1.42 - sel->w = sw - 2; 1.43 - sel->h = sh - 2 - bh; 1.44 - 1.45 - restack(); 1.46 - for(c = getnext(clients); c; c = getnext(c->next)) 1.47 - if(c != sel) 1.48 - ban(c); 1.49 - resize(sel, arrange == dofloat, TopLeft); 1.50 - 1.51 - sel->x = ox; 1.52 - sel->y = oy; 1.53 - sel->w = ow; 1.54 - sel->h = oh; 1.55 - } 1.56 - else 1.57 - arrange(NULL); 1.58 - while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 1.59 -} 1.60 - 1.61 -void 1.62 unmanage(Client *c) { 1.63 Client *nc; 1.64
2.1 --- a/config.arg.h Wed Sep 20 09:53:21 2006 +0200 2.2 +++ b/config.arg.h Fri Sep 22 07:37:56 2006 +0200 2.3 @@ -33,7 +33,6 @@ 2.4 { MODKEY, XK_j, focusnext, { 0 } }, \ 2.5 { MODKEY, XK_k, focusprev, { 0 } }, \ 2.6 { MODKEY, XK_Return, zoom, { 0 } }, \ 2.7 - { MODKEY, XK_m, togglemax, { 0 } }, \ 2.8 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 2.9 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 2.10 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
3.1 --- a/config.default.h Wed Sep 20 09:53:21 2006 +0200 3.2 +++ b/config.default.h Fri Sep 22 07:37:56 2006 +0200 3.3 @@ -28,7 +28,6 @@ 3.4 { MODKEY, XK_Tab, focusnext, { 0 } }, \ 3.5 { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ 3.6 { MODKEY, XK_Return, zoom, { 0 } }, \ 3.7 - { MODKEY, XK_m, togglemax, { 0 } }, \ 3.8 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 3.9 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 3.10 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
4.1 --- a/dwm.h Wed Sep 20 09:53:21 2006 +0200 4.2 +++ b/dwm.h Fri Sep 22 07:37:56 2006 +0200 4.3 @@ -78,6 +78,7 @@ 4.4 int proto; 4.5 int x, y, w, h; 4.6 int tx, ty, tw, th; /* title window geometry */ 4.7 + int rx, ry, rw, rh; /* revert geometry */ 4.8 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 4.9 int grav; 4.10 long flags; 4.11 @@ -99,7 +100,7 @@ 4.12 extern void (*handler[LASTEvent])(XEvent *); /* event handler */ 4.13 extern void (*arrange)(Arg *); /* arrange function, indicates mode */ 4.14 extern Atom wmatom[WMLast], netatom[NetLast]; 4.15 -extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */ 4.16 +extern Bool running, issel, *seltag; /* seltag is array of Bool */ 4.17 extern Client *clients, *sel, *stack; /* global cleint list and stack */ 4.18 extern Cursor cursor[CurLast]; 4.19 extern DC dc; /* global draw context */ 4.20 @@ -117,7 +118,6 @@ 4.21 extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ 4.22 extern void updatesize(Client *c); /* update the size structs of c */ 4.23 extern void updatetitle(Client *c); /* update the name of c */ 4.24 -extern void togglemax(Arg *arg); /* (un)maximize c */ 4.25 extern void unmanage(Client *c); /* destroy c */ 4.26 4.27 /* draw.c */
5.1 --- a/event.c Wed Sep 20 09:53:21 2006 +0200 5.2 +++ b/event.c Fri Sep 22 07:37:56 2006 +0200 5.3 @@ -130,7 +130,7 @@ 5.4 } 5.5 else if((c = getclient(ev->window))) { 5.6 focus(c); 5.7 - if(maximized || CLEANMASK(ev->state) != MODKEY) 5.8 + if(CLEANMASK(ev->state) != MODKEY) 5.9 return; 5.10 if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { 5.11 restack(c); 5.12 @@ -170,7 +170,7 @@ 5.13 XWindowChanges wc; 5.14 5.15 if((c = getclient(ev->window))) { 5.16 - if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) { 5.17 + if((c == sel) && !c->isfloat && (arrange != dofloat)) { 5.18 synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width); 5.19 XSync(dpy, False); 5.20 return;
6.1 --- a/main.c Wed Sep 20 09:53:21 2006 +0200 6.2 +++ b/main.c Fri Sep 22 07:37:56 2006 +0200 6.3 @@ -24,7 +24,6 @@ 6.4 Atom wmatom[WMLast], netatom[NetLast]; 6.5 Bool running = True; 6.6 Bool issel = True; 6.7 -Bool maximized = False; 6.8 Client *clients = NULL; 6.9 Client *sel = NULL; 6.10 Client *stack = NULL;
7.1 --- a/view.c Wed Sep 20 09:53:21 2006 +0200 7.2 +++ b/view.c Fri Sep 22 07:37:56 2006 +0200 7.3 @@ -61,8 +61,6 @@ 7.4 dofloat(Arg *arg) { 7.5 Client *c; 7.6 7.7 - maximized = False; 7.8 - 7.9 for(c = clients; c; c = c->next) { 7.10 if(isvisible(c)) { 7.11 resize(c, True, TopLeft); 7.12 @@ -82,8 +80,6 @@ 7.13 int h, i, n, w; 7.14 Client *c; 7.15 7.16 - maximized = False; 7.17 - 7.18 w = sw - mw; 7.19 for(n = 0, c = clients; c; c = c->next) 7.20 if(isvisible(c) && !c->isfloat) 7.21 @@ -190,7 +186,7 @@ 7.22 for(n = 0, c = clients; c; c = c->next) 7.23 if(isvisible(c) && !c->isfloat) 7.24 n++; 7.25 - if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) 7.26 + if(!sel || sel->isfloat || n < 2 || (arrange != dotile)) 7.27 return; 7.28 7.29 if(sel == getnext(clients)) { 7.30 @@ -273,13 +269,28 @@ 7.31 7.32 void 7.33 zoom(Arg *arg) { 7.34 + int tmp; 7.35 unsigned int n; 7.36 Client *c; 7.37 + XEvent ev; 7.38 + 7.39 + if(!sel) 7.40 + return; 7.41 + 7.42 + if(sel->isfloat || (arrange == dofloat)) { 7.43 + tmp = sel->x; sel->x = sel->rx; sel->rx = tmp; 7.44 + tmp = sel->y; sel->y = sel->ry; sel->ry = tmp; 7.45 + tmp = sel->w; sel->w = sel->rw; sel->rw = tmp; 7.46 + tmp = sel->h; sel->h = sel->rh; sel->rh = tmp; 7.47 + resize(sel, True, TopLeft); 7.48 + while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); 7.49 + return; 7.50 + } 7.51 7.52 for(n = 0, c = clients; c; c = c->next) 7.53 if(isvisible(c) && !c->isfloat) 7.54 n++; 7.55 - if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) 7.56 + if(n < 2 || (arrange != dotile)) 7.57 return; 7.58 7.59 if((c = sel) == nexttiled(clients))