Re: [dwm] [patch] togglemax() on tiled windows (for dwm.c)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue, 18 Sep 2007 19:05:30 +0200

Well, I decided to apply this patch to mainstream dwm after a
while of careful testing.

Regards,
        Anselm

On Mon, Sep 17, 2007 at 01:04:30PM +0200, Peter Hartlich wrote:
> Hi,
>
> Here's the patch to allow calling togglemax() on tiled windows, ported
> to the new dwm.c. I've used Abel Darc's variable name wasfloating, which
> is less clumsy than my rtogglefloating.
>
> Regards,
> Peter

> diff -upr dwm~/dwm.1 dwm/dwm.1
> --- dwm~/dwm.1 2007-09-17 07:12:03.000000000 +0200
> +++ dwm/dwm.1 2007-09-17 07:15:47.000000000 +0200
> @@ -75,7 +75,7 @@ Focus previous window.
> Increases the master area width about 5% (tiled layout only).
> .TP
> .B Mod1\-m
> -Toggles maximization of current window (floating layout only).
> +Toggles maximization of current window.
> .TP
> .B Mod1\-Shift\-[1..n]
> Apply
> diff -upr dwm~/dwm.c dwm/dwm.c
> --- dwm~/dwm.c 2007-09-17 07:12:03.000000000 +0200
> +++ dwm/dwm.c 2007-09-17 09:46:52.000000000 +0200
> @@ -67,7 +67,7 @@ struct Client {
> int minax, maxax, minay, maxay;
> long flags;
> unsigned int border, oldborder;
> - Bool isbanned, isfixed, ismax, isfloating;
> + Bool isbanned, isfixed, ismax, isfloating, wasfloating;
> Bool *tags;
> Client *next;
> Client *prev;
> @@ -1630,17 +1630,26 @@ static void
> togglemax(const char *arg) {
> XEvent ev;
>
> - if(!sel || (!isarrange(floating) && !sel->isfloating) || sel->isfixed)
> + if(!sel || sel->isfixed)
> return;
> if((sel->ismax = !sel->ismax)) {
> + if(isarrange(floating) || sel->isfloating)
> + sel->wasfloating = True;
> + else {
> + togglefloating(NULL);
> + sel->wasfloating = False;
> + }
> sel->rx = sel->x;
> sel->ry = sel->y;
> sel->rw = sel->w;
> sel->rh = sel->h;
> 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);
> + if (!sel->wasfloating)
> + togglefloating(NULL);
> + }
> drawbar();
> while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
> }

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Tue Sep 18 2007 - 19:05:30 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:53:40 UTC