Re: [dwm] Updated bottomstack patch for 4.2

From: Ross Mohn <rpmohn_AT_waxandwane.org>
Date: Wed, 27 Jun 2007 16:00:05 -0400

I've been busy not paying attention to the dwm list recently. Will dwm
v4.3 be released soon for me to make a new patch against?
Thanks! -Ross

On Sat, 2007-06-16 at 16:00 -0400, James Turner wrote:
> On Sat, Jun 16, 2007 at 03:55:13PM -0400, James Turner wrote:
> > On Sat, Jun 16, 2007 at 07:44:18PM +0200, Anydot wrote:
> > > On (16/06/07 10:26), James Turner wrote:
> > > > Attached is a patch to add the bottomstack layouts to a clean 4.2 install.
> > > > I also changed somethings in the portrait layout in order to remove the
> > > > gap between the master and other windows.
> > > >
> > >
> > > please, use ban/unban functions to ban/unban client. See tile() for
> > > example of use :)
> > >
> > > --
> > > Premysl "Anydot" Hruby >> http://na.srck.net <<
> >
> > Thanks, attached is a new diff. Hopefully I made the correct fixes.
> > I'm sure if the original patch created released a new diff it would be
> > ten times better then mine :).
> >
> > --
> > James Turner
> > BSD Group Consulting
> > http://www.bsdgroup.org
>
> > --- layout.c Wed May 30 06:20:42 2007
> > +++ layout.c Sat Jun 16 15:50:31 2007
> > @@ -28,7 +28,7 @@ unban(Client *c) {
> > }
> >
> > static void
> > -tile(void) {
> > +_tile(const Bool right) {
> > unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
> > Client *c;
> >
> > @@ -49,6 +49,8 @@ tile(void) {
> > nx = wax;
> > ny = way;
> > if(i < nmaster) {
> > + if(!right)
> > + nx += tw;
> > ny += i * mh;
> > nw = mw - 2 * c->border;
> > nh = mh;
> > @@ -57,7 +59,8 @@ tile(void) {
> > nh -= 2 * c->border;
> > }
> > else { /* tile window */
> > - nx += mw;
> > + if(right)
> > + nx += mw;
> > nw = tw - 2 * c->border;
> > if(th > 2 * c->border) {
> > ny += (i - nmaster) * th;
> > @@ -78,6 +81,85 @@ tile(void) {
> > restack();
> > }
> >
> > +static void
> > +_bstack(const Bool portrait) {
> > + unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th;
> > + Client *c;
> > +
> > + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
> > + n++;
> > + /* window geoms */
> > + mh = (n > nmaster) ? ((wah * masterw) / 1000) / nmaster : wah / (n > 0 ? n : 1);
> > + mw = waw;
> > + th = (n > nmaster) ? ((wah * (1000 - masterw)) / 1000) / (portrait ? 1 : n - nmaster) : 0;
> > + tw = (n > nmaster) ? waw / (portrait ? n - nmaster : 1) : 0;
> > +
> > + for(i = 0, c = clients; c; c = c->next)
> > + if(isvisible(c)) {
> > + if(c->isbanned)
> > + XMoveWindow(dpy, c->win, c->x, c->y);
> > + /*c->isbanned = False;*/
> > + unban(c);
> > + if(c->isfloating)
> > + continue;
> > + c->ismax = False;
> > + nx = wax;
> > + ny = way;
> > + if(i < nmaster) {
> > + ny += i * mh;
> > + nw = mw - 2 * c->border;
> > + nh = mh - 2 * c->border;
> > + }
> > + else if(portrait) { /* portrait bstack tiles */
> > + nx += (i - nmaster) * tw;
> > + ny += mh * nmaster;
> > + nw = tw - 2 * c->border;
> > + nh = th - 2 * c->border + 1;
> > + } else { /* landscape bstack tiles */
> > + ny += mh * nmaster;
> > + nw = tw - 2 * c->border;
> > + if(th > 2 * c->border) {
> > + ny += (i - nmaster) * th;
> > + nh = th - 2 * c->border;
> > + if (i == n - 1)
> > + nh += (n > nmaster) ? wah - mh - th * (n - nmaster) : 0;
> > + }
> > + else /* fallback if th <= 2 * c->border */
> > + nh = wah - 2 * c->border;
> > + }
> > + resize(c, nx, ny, nw, nh, False);
> > + i++;
> > + }
> > + else {
> > + /*c->isbanned = True;*/
> > + ban(c);
> > + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
> > + }
> > + if(!sel || !isvisible(sel))
> > + focus(c);
> > + restack();
> > +}
> > +
> > +static void
> > +tile(void) {
> > + _tile(True);
> > +}
> > +
> > +static void
> > +tileleft(void) {
> > + _tile(False);
> > +}
> > +
> > +static void
> > +bstackportrait(void) {
> > + _bstack(True);
> > +}
> > +
> > +static void
> > +bstacklandscape(void) {
> > + _bstack(False);
> > +}
> > +
> > LAYOUTS
> >
> > /* extern */
> > @@ -126,7 +208,7 @@ focusclient(const char *arg) {
> > void
> > incmasterw(const char *arg) {
> > int i;
> > - if(lt->arrange != tile)
> > + if(lt->arrange == floating)
> > return;
> > if(!arg)
> > masterw = MASTERWIDTH;
> > @@ -148,7 +230,7 @@ incnmaster(const char *arg) {
> > nmaster = NMASTER;
> > else {
> > i = atoi(arg);
> > - if((lt->arrange != tile) || (nmaster + i < 1)
> > + if((lt->arrange == floating) || (nmaster + i < 1)
> > || (wah / (nmaster + i) <= 2 * BORDERPX))
> > return;
> > nmaster += i;
> > --- config.default.h Wed May 30 06:20:42 2007
> > +++ config.default.h Fri Jun 15 23:03:30 2007
> > @@ -29,6 +29,9 @@ static Rule rule[] = { \
> > static Layout layout[] = { \
> > /* symbol function */ \
> > { "[]=", tile }, /* first entry is default */ \
> > + { "=[]", tileleft }, \
> > + { "TTT", bstackportrait }, \
> > + { "===", bstacklandscape }, \
> > { "><>", floating }, \
> > };
> > #define MASTERWIDTH 600 /* master width per thousand */
>
> Right after I send the last diff, I realized I didn't remove all the code
> that are in the ban/unban functions. The attached diff should be good
> now.
>
Received on Wed Jun 27 2007 - 22:00:41 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:45:17 UTC