applied Peter Hartlich's togglemax patch to allow toggling tiled clients to maximum

master
Anselm R. Garbe 2007-09-18 19:04:50 +02:00
parent fe2775a15b
commit 08c2d92480
2 changed files with 13 additions and 4 deletions

2
dwm.1
View File

@ -75,7 +75,7 @@ Focus previous window.
Increases the master area width about 5% (tiled layout only). Increases the master area width about 5% (tiled layout only).
.TP .TP
.B Mod1\-m .B Mod1\-m
Toggles maximization of current window (floating layout only). Toggles maximization of current window.
.TP .TP
.B Mod1\-Shift\-[1..n] .B Mod1\-Shift\-[1..n]
Apply Apply

15
dwm.c
View File

@ -64,7 +64,7 @@ struct Client {
int minax, maxax, minay, maxay; int minax, maxax, minay, maxay;
long flags; long flags;
unsigned int border, oldborder; unsigned int border, oldborder;
Bool isbanned, isfixed, ismax, isfloating; Bool isbanned, isfixed, ismax, isfloating, wasfloating;
Bool *tags; Bool *tags;
Client *next; Client *next;
Client *prev; Client *prev;
@ -1627,17 +1627,26 @@ void
togglemax(const char *arg) { togglemax(const char *arg) {
XEvent ev; XEvent ev;
if(!sel || (!isarrange(floating) && !sel->isfloating) || sel->isfixed) if(!sel || sel->isfixed)
return; return;
if((sel->ismax = !sel->ismax)) { if((sel->ismax = !sel->ismax)) {
if(isarrange(floating) || sel->isfloating)
sel->wasfloating = True;
else {
togglefloating(NULL);
sel->wasfloating = False;
}
sel->rx = sel->x; sel->rx = sel->x;
sel->ry = sel->y; sel->ry = sel->y;
sel->rw = sel->w; sel->rw = sel->w;
sel->rh = sel->h; sel->rh = sel->h;
resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True); resize(sel, wax, way, waw - 2 * sel->border, wah - 2 * sel->border, True);
} }
else else {
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True); resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
if (!sel->wasfloating)
togglefloating(NULL);
}
drawbar(); drawbar();
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
} }