summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client.c41
-rw-r--r--config.arg.h1
-rw-r--r--config.default.h1
-rw-r--r--dwm.h4
-rw-r--r--event.c4
-rw-r--r--main.c1
-rw-r--r--view.c23
7 files changed, 25 insertions, 50 deletions
diff --git a/client.c b/client.c
index 725f70b..2f1e2b3 100644
--- a/client.c
+++ b/client.c
@@ -89,8 +89,6 @@ focus(Client *c) {
89 if(!sel) 89 if(!sel)
90 sel = c; 90 sel = c;
91 else if(sel != c) { 91 else if(sel != c) {
92 if(maximized)
93 togglemax(NULL);
94 old = sel; 92 old = sel;
95 sel = c; 93 sel = c;
96 if(old) { 94 if(old) {
@@ -208,6 +206,10 @@ manage(Window w, XWindowAttributes *wa) {
208 c->w = c->tw = wa->width; 206 c->w = c->tw = wa->width;
209 c->h = wa->height; 207 c->h = wa->height;
210 c->th = bh; 208 c->th = bh;
209 c->rx = sx;
210 c->ry = bh;
211 c->rw = sw;
212 c->rh = sh - bh;
211 213
212 c->border = 0; 214 c->border = 0;
213 updatesize(c); 215 updatesize(c);
@@ -370,41 +372,6 @@ updatetitle(Client *c) {
370} 372}
371 373
372void 374void
373togglemax(Arg *arg) {
374 int ox, oy, ow, oh;
375 Client *c;
376 XEvent ev;
377
378 if(!sel)
379 return;
380
381 if((maximized = !maximized)) {
382 ox = sel->x;
383 oy = sel->y;
384 ow = sel->w;
385 oh = sel->h;
386 sel->x = sx;
387 sel->y = sy + bh;
388 sel->w = sw - 2;
389 sel->h = sh - 2 - bh;
390
391 restack();
392 for(c = getnext(clients); c; c = getnext(c->next))
393 if(c != sel)
394 ban(c);
395 resize(sel, arrange == dofloat, TopLeft);
396
397 sel->x = ox;
398 sel->y = oy;
399 sel->w = ow;
400 sel->h = oh;
401 }
402 else
403 arrange(NULL);
404 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
405}
406
407void
408unmanage(Client *c) { 375unmanage(Client *c) {
409 Client *nc; 376 Client *nc;
410 377
diff --git a/config.arg.h b/config.arg.h
index 9bb581e..6f9aed2 100644
--- a/config.arg.h
+++ b/config.arg.h
@@ -33,7 +33,6 @@ static Key key[] = { \
33 { MODKEY, XK_j, focusnext, { 0 } }, \ 33 { MODKEY, XK_j, focusnext, { 0 } }, \
34 { MODKEY, XK_k, focusprev, { 0 } }, \ 34 { MODKEY, XK_k, focusprev, { 0 } }, \
35 { MODKEY, XK_Return, zoom, { 0 } }, \ 35 { MODKEY, XK_Return, zoom, { 0 } }, \
36 { MODKEY, XK_m, togglemax, { 0 } }, \
37 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 36 { MODKEY, XK_g, resizecol, { .i = 20 } }, \
38 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 37 { MODKEY, XK_s, resizecol, { .i = -20 } }, \
39 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ 38 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
diff --git a/config.default.h b/config.default.h
index ad048ae..9c67d98 100644
--- a/config.default.h
+++ b/config.default.h
@@ -28,7 +28,6 @@ static Key key[] = { \
28 { MODKEY, XK_Tab, focusnext, { 0 } }, \ 28 { MODKEY, XK_Tab, focusnext, { 0 } }, \
29 { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \ 29 { MODKEY|ShiftMask, XK_Tab, focusprev, { 0 } }, \
30 { MODKEY, XK_Return, zoom, { 0 } }, \ 30 { MODKEY, XK_Return, zoom, { 0 } }, \
31 { MODKEY, XK_m, togglemax, { 0 } }, \
32 { MODKEY, XK_g, resizecol, { .i = 20 } }, \ 31 { MODKEY, XK_g, resizecol, { .i = 20 } }, \
33 { MODKEY, XK_s, resizecol, { .i = -20 } }, \ 32 { MODKEY, XK_s, resizecol, { .i = -20 } }, \
34 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \ 33 { MODKEY|ShiftMask, XK_1, tag, { .i = 0 } }, \
diff --git a/dwm.h b/dwm.h
index c08388f..60f9201 100644
--- a/dwm.h
+++ b/dwm.h
@@ -78,6 +78,7 @@ struct Client {
78 int proto; 78 int proto;
79 int x, y, w, h; 79 int x, y, w, h;
80 int tx, ty, tw, th; /* title window geometry */ 80 int tx, ty, tw, th; /* title window geometry */
81 int rx, ry, rw, rh; /* revert geometry */
81 int basew, baseh, incw, inch, maxw, maxh, minw, minh; 82 int basew, baseh, incw, inch, maxw, maxh, minw, minh;
82 int grav; 83 int grav;
83 long flags; 84 long flags;
@@ -99,7 +100,7 @@ extern unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */
99extern void (*handler[LASTEvent])(XEvent *); /* event handler */ 100extern void (*handler[LASTEvent])(XEvent *); /* event handler */
100extern void (*arrange)(Arg *); /* arrange function, indicates mode */ 101extern void (*arrange)(Arg *); /* arrange function, indicates mode */
101extern Atom wmatom[WMLast], netatom[NetLast]; 102extern Atom wmatom[WMLast], netatom[NetLast];
102extern Bool running, issel, maximized, *seltag; /* seltag is array of Bool */ 103extern Bool running, issel, *seltag; /* seltag is array of Bool */
103extern Client *clients, *sel, *stack; /* global cleint list and stack */ 104extern Client *clients, *sel, *stack; /* global cleint list and stack */
104extern Cursor cursor[CurLast]; 105extern Cursor cursor[CurLast];
105extern DC dc; /* global draw context */ 106extern DC dc; /* global draw context */
@@ -117,7 +118,6 @@ extern void manage(Window w, XWindowAttributes *wa); /* manage new client */
117extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/ 118extern void resize(Client *c, Bool sizehints, Corner sticky); /* resize c*/
118extern void updatesize(Client *c); /* update the size structs of c */ 119extern void updatesize(Client *c); /* update the size structs of c */
119extern void updatetitle(Client *c); /* update the name of c */ 120extern void updatetitle(Client *c); /* update the name of c */
120extern void togglemax(Arg *arg); /* (un)maximize c */
121extern void unmanage(Client *c); /* destroy c */ 121extern void unmanage(Client *c); /* destroy c */
122 122
123/* draw.c */ 123/* draw.c */
diff --git a/event.c b/event.c
index 3783eb4..d5f4aa8 100644
--- a/event.c
+++ b/event.c
@@ -130,7 +130,7 @@ buttonpress(XEvent *e) {
130 } 130 }
131 else if((c = getclient(ev->window))) { 131 else if((c = getclient(ev->window))) {
132 focus(c); 132 focus(c);
133 if(maximized || CLEANMASK(ev->state) != MODKEY) 133 if(CLEANMASK(ev->state) != MODKEY)
134 return; 134 return;
135 if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { 135 if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) {
136 restack(c); 136 restack(c);
@@ -170,7 +170,7 @@ configurerequest(XEvent *e) {
170 XWindowChanges wc; 170 XWindowChanges wc;
171 171
172 if((c = getclient(ev->window))) { 172 if((c = getclient(ev->window))) {
173 if((c == sel) && !c->isfloat && (arrange != dofloat) && maximized) { 173 if((c == sel) && !c->isfloat && (arrange != dofloat)) {
174 synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width); 174 synconfig(c, sx, sy + bh, sw - 2, sh - 2 - bh, ev->border_width);
175 XSync(dpy, False); 175 XSync(dpy, False);
176 return; 176 return;
diff --git a/main.c b/main.c
index c6e67e9..b3c753e 100644
--- a/main.c
+++ b/main.c
@@ -24,7 +24,6 @@ unsigned int ntags, numlockmask;
24Atom wmatom[WMLast], netatom[NetLast]; 24Atom wmatom[WMLast], netatom[NetLast];
25Bool running = True; 25Bool running = True;
26Bool issel = True; 26Bool issel = True;
27Bool maximized = False;
28Client *clients = NULL; 27Client *clients = NULL;
29Client *sel = NULL; 28Client *sel = NULL;
30Client *stack = NULL; 29Client *stack = NULL;
diff --git a/view.c b/view.c
index 80d483a..fce7309 100644
--- a/view.c
+++ b/view.c
@@ -61,8 +61,6 @@ void
61dofloat(Arg *arg) { 61dofloat(Arg *arg) {
62 Client *c; 62 Client *c;
63 63
64 maximized = False;
65
66 for(c = clients; c; c = c->next) { 64 for(c = clients; c; c = c->next) {
67 if(isvisible(c)) { 65 if(isvisible(c)) {
68 resize(c, True, TopLeft); 66 resize(c, True, TopLeft);
@@ -82,8 +80,6 @@ dotile(Arg *arg) {
82 int h, i, n, w; 80 int h, i, n, w;
83 Client *c; 81 Client *c;
84 82
85 maximized = False;
86
87 w = sw - mw; 83 w = sw - mw;
88 for(n = 0, c = clients; c; c = c->next) 84 for(n = 0, c = clients; c; c = c->next)
89 if(isvisible(c) && !c->isfloat) 85 if(isvisible(c) && !c->isfloat)
@@ -190,7 +186,7 @@ resizecol(Arg *arg) {
190 for(n = 0, c = clients; c; c = c->next) 186 for(n = 0, c = clients; c; c = c->next)
191 if(isvisible(c) && !c->isfloat) 187 if(isvisible(c) && !c->isfloat)
192 n++; 188 n++;
193 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) 189 if(!sel || sel->isfloat || n < 2 || (arrange != dotile))
194 return; 190 return;
195 191
196 if(sel == getnext(clients)) { 192 if(sel == getnext(clients)) {
@@ -273,13 +269,28 @@ viewall(Arg *arg) {
273 269
274void 270void
275zoom(Arg *arg) { 271zoom(Arg *arg) {
272 int tmp;
276 unsigned int n; 273 unsigned int n;
277 Client *c; 274 Client *c;
275 XEvent ev;
276
277 if(!sel)
278 return;
279
280 if(sel->isfloat || (arrange == dofloat)) {
281 tmp = sel->x; sel->x = sel->rx; sel->rx = tmp;
282 tmp = sel->y; sel->y = sel->ry; sel->ry = tmp;
283 tmp = sel->w; sel->w = sel->rw; sel->rw = tmp;
284 tmp = sel->h; sel->h = sel->rh; sel->rh = tmp;
285 resize(sel, True, TopLeft);
286 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
287 return;
288 }
278 289
279 for(n = 0, c = clients; c; c = c->next) 290 for(n = 0, c = clients; c; c = c->next)
280 if(isvisible(c) && !c->isfloat) 291 if(isvisible(c) && !c->isfloat)
281 n++; 292 n++;
282 if(!sel || sel->isfloat || n < 2 || (arrange != dotile) || maximized) 293 if(n < 2 || (arrange != dotile))
283 return; 294 return;
284 295
285 if((c = sel) == nexttiled(clients)) 296 if((c = sel) == nexttiled(clients))