Il 2007-12-10, Seth Graham <[EMAIL PROTECTED]> ha scritto:
> Jonas Pfenniger wrote:
>  > It's sad to say, but I think terminal will never be 100% flicker-free
>> when resizing. There is no such thing as loosing line endings because
>> you used Mod-0 instead of Mod-9. In the fact, I'd much prefer them to
>> stay at 80char (or a multiple). It sounds weird to craft a special
>> rule for xterm and it's brothers but text application are in another
>> world than GUI apps.
>
> I got around this by hacking up the dotile() function to not resize 
> windows, instead it merely moves them around.
>
> It wasn't a hard change, as I recall I only had to delete two or three 
> lines. Last time I did it was dwm 1.5 though, I don't update my laptop 
> very often. So maybe it's changed.
>

I use a similar layout for dwm-4.7 on my laptop: it does not resize
non-master windows, instead they are "piled" up like cards and only
the bottom left corner is visible.

It comes in two flavors: "pileright", which keeps non-master
windows on the right of the zoomed one, and "pilebottom", which puts 
the row of non-master windows at the bottom of the screen, under the
zoomed one.  (As I write this, I realize that "pilevertical" and
"pilehorizontal" could be better names.)

Screenshots:

  http://img57.imageshack.us/img57/6483/pilerightji3.png

  http://img205.imageshack.us/img205/4599/pilebottomls7.png


Issues:

  * Piling windows requires a different stacking order than the stock
    `restack()` does, so I had to add a `dorestack` global bool to
    dwm.c and execute `restack()` only for layouts that do set
    `restack=True`;

  * Even so, at times a window is raised and obscures other ones - I
    have been too lazy to hunt down for this bug and coded a `show()`
    command instead, which brings the currently selected windows on
    top of the visibility stack.

  * Floating windows are not always kept on top; I make such little
    use of floating applications that I never really cared to fix this
    one either.


-- 
Riccardo Murri, via Galeazzo Alessi 61, 00176 Roma


/* © 2006-2007 Riccardo Murri <[EMAIL PROTECTED]>
 * See LICENSE file for license details. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xutil.h>

void
pileright(void) {
        unsigned int i, n, np, nx, ny, nw, nh, mw, mh, tw, th;
        Client *c;
        Window *winstack;

        domwfact = dozoom = True;
        dorestack = False; /* arrange() does the restacking */

        /* count tiled clients */
        for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
                n++;

        /* window geoms */
        mw = (n == 1) ? waw : mwfact * waw;
        if (n > 1) {
          th = wah / (n - 1);
          if(th < bh)
            th = bh;
        }
        else
          th = 0;

        winstack = emallocz((n+1)*sizeof(Window));
        winstack[0] = barwin; /* barwin always on top */
        np = 0;
        nx = wax;
        ny = way;
        for(i = 0, c = nexttiled(clients); c; i++, c = nexttiled(c->next)) {
                c->ismax = False;
                if(i == 0) { /* master */
                  nw = mw - 2 * c->border;
                  nh = wah - 2 * c->border;
                }
                else {  /* pile window */
                  if(1 == i)
                    nx += mw;
                  ny = way + i*th - wah;
                  nw = c->w;
                  nh = c->h;
                }
                winstack[++np] = c->win;
                resize(c, nx, ny, nw, nh, False);
                /* FIXME: if `resize(c, nx, ny, nw, nh, False);` only
                *  is used here, then windows are not moved back to
                *  the master area when the client in master area is
                *  killed.... why??
                */
                XMoveResizeWindow(dpy, c->win, nx, ny, nw, nh);
        }

        /* restack piled windows */
        if (np > 0)
          XRestackWindows(dpy, winstack, np+1);
        free(winstack);
}

void
pilebottom(void) {
        unsigned int i, n, np, nx, ny, nw, nh, mw, mh, tw, th;
        Client *c;
        Window *winstack;

        domwfact = dozoom = True;
        dorestack = False; /* arrange() does the restacking */

        /* count tiled clients */
        for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
                n++;

        /* window geoms */
        mh = (n == 1) ? wah : (mwfact * wah);
        if (n > 1) {
          tw = waw / (n - 1);
          if(tw < 2 * BORDERPX)
            tw = 2 * BORDERPX;
        }
        else
          tw = 0;

        winstack = emallocz((n+1)*sizeof(Window));
        winstack[0] = barwin; /* barwin always on top */
        np = 0;
        for(i = 0, c = nexttiled(clients); c; i++, c = nexttiled(c->next)) {
                c->ismax = False;
                if(i == 0) { /* master */
                  nx = wax;
                  ny = way;
                  nh = mh - 2*c->border;
                  nw = waw - 2*c->border;
                }
                else {  /* pile window */
                  nw = c->w;
                  nh = c->h;
                  nx = wax + (n-i-1)*tw;
                  ny = way + wah - nh - 2*c->border;
                }
                winstack[++np] = c->win;
                resize(c, nx, ny, nw, nh, False);
                /* FIXME: if `resize(c, nx, ny, nw, nh, False);` only
                *  is used here, then windows are not moved back to
                *  the master area when the client in master area is
                *  killed.... why??
                */
                XMoveResizeWindow(dpy, c->win, nx, ny, nw, nh);
        }

        /* restack piled windows */
        if (np > 0)
          XRestackWindows(dpy, winstack, np+1);
        free(winstack);
}


/** Move currently-selected client on top of visibility stack */
void
show(const char* arg) {
  if(!sel)
    return;

  XRaiseWindow(dpy, sel->win);
}


/** Move all floating clients on top of visibility stack */
void 
showfloating(const char *arg) {
  Client *c;

  if(!clients)
    return;

  for(c = clients; c; c = c->next)
    if(c->isfloating)
      XRaiseWindow(dpy, c->win);
}
=== modified file 'dwm.c'
--- dwm.c	2007-11-27 23:42:20 +0000
+++ dwm.c	2007-12-13 12:19:07 +0000
@@ -218,6 +218,7 @@
 };
 Atom wmatom[WMLast], netatom[NetLast];
 Bool domwfact = True;
+Bool dorestack = True;
 Bool dozoom = True;
 Bool otherwm, readin;
 Bool running = True;
@@ -280,7 +281,7 @@
                         ban(c);
         layout->arrange();
         focus(NULL);
-        restack();
+        if(dorestack) restack();
 }
 
 void
@@ -340,7 +341,7 @@
                         return;
                 if(ev->button == Button1) {
                         if((layout->arrange == floating) || c->isfloating)
-                                restack();
+                                if(dorestack) restack();
                         else
                                 togglefloating(NULL);
                         movemouse(c);
@@ -353,7 +354,7 @@
                 }
                 else if(ev->button == Button3 && !c->isfixed) {
                         if((floating == layout->arrange) || c->isfloating)
-                                restack();
+                                if(dorestack) restack();
                         else
                                 togglefloating(NULL);
                         resizemouse(c);
@@ -681,6 +682,7 @@
         Client *c;
 
         domwfact = dozoom = False;
+        dorestack = True;
         for(c = clients; c; c = c->next)
                 if(isvisible(c))
                         resize(c, c->x, c->y, c->w, c->h, True);
@@ -730,7 +732,7 @@
                 for(c = clients; c && !isvisible(c); c = c->next);
         if(c) {
                 focus(c);
-                restack();
+                if(dorestack) restack();
         }
 }
 
@@ -747,7 +749,7 @@
         }
         if(c) {
                 focus(c);
-                restack();
+                if(dorestack) restack();
         }
 }
 
@@ -1584,6 +1586,7 @@
         Client *c, *mc;
 
         domwfact = dozoom = True;
+        dorestack = True;
         for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next))
                 n++;
 

Reply via email to