X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=layout.c;h=9de26bcc53ec0cf6d73afbe919cee3777e290d05;hp=5d43187d6af7e3e879573d50841158f9f504b7ec;hb=399993c6b5d594278bf822e2981ebfe8bfcb58c7;hpb=5711609203602bd01b4b131572142bb171ffc560 diff --git a/layout.c b/layout.c index 5d43187..9de26bc 100644 --- a/layout.c +++ b/layout.c @@ -1,6 +1,5 @@ -/* (C)opyright MMVI-MMVII Anselm R. Garbe - * See LICENSE file for license details. - */ +/* © 2004-2007 Anselm R. Garbe + * See LICENSE file for license details. */ #include "dwm.h" #include @@ -31,7 +30,7 @@ tile(void) { if(c->isbanned) XMoveWindow(dpy, c->win, c->x, c->y); c->isbanned = False; - if(c->isversatile) + if(c->isfloating) continue; c->ismax = False; nx = wax; @@ -70,30 +69,45 @@ LAYOUTS /* extern */ void -focusnext(const char *arg) { +floating(void) { Client *c; - - if(!sel) - return; - for(c = sel->next; c && !isvisible(c); c = c->next); - if(!c) - for(c = clients; c && !isvisible(c); c = c->next); - if(c) { + + for(c = clients; c; c = c->next) { + if(isvisible(c)) { + if(c->isbanned) + XMoveWindow(dpy, c->win, c->x, c->y); + c->isbanned = False; + resize(c, c->x, c->y, c->w, c->h, True); + } + else { + c->isbanned = True; + XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); + } + } + if(!sel || !isvisible(sel)) { + for(c = stack; c && !isvisible(c); c = c->snext); focus(c); - restack(); } + restack(); } void -focusprev(const char *arg) { +focusclient(const char *arg) { Client *c; - - if(!sel) + + if(!sel || !arg) return; - for(c = sel->prev; c && !isvisible(c); c = c->prev); - if(!c) { - for(c = clients; c && c->next; c = c->next); - for(; c && !isvisible(c); c = c->prev); + if(atoi(arg) < 0) { + for(c = sel->prev; c && !isvisible(c); c = c->prev); + if(!c) { + for(c = clients; c && c->next; c = c->next); + for(; c && !isvisible(c); c = c->prev); + } + } + else { + for(c = sel->next; c && !isvisible(c); c = c->next); + if(!c) + for(c = clients; c && !isvisible(c); c = c->next); } if(c) { focus(c); @@ -152,7 +166,7 @@ initlayouts(void) { Client * nexttiled(Client *c) { - for(; c && (c->isversatile || !isvisible(c)); c = c->next); + for(; c && (c->isfloating || !isvisible(c)); c = c->next); return c; } @@ -164,10 +178,10 @@ restack(void) { drawstatus(); if(!sel) return; - if(sel->isversatile || lt->arrange == versatile) + if(sel->isfloating || lt->arrange == floating) XRaiseWindow(dpy, sel->win); - if(lt->arrange != versatile) { - if(!sel->isversatile) + if(lt->arrange != floating) { + if(!sel->isfloating) XLowerWindow(dpy, sel->win); for(c = nexttiled(clients); c; c = nexttiled(c->next)) { if(c == sel) @@ -206,7 +220,7 @@ void togglemax(const char *arg) { XEvent ev; - if(!sel || (lt->arrange != versatile && !sel->isversatile) || sel->isfixed) + if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed) return; if((sel->ismax = !sel->ismax)) { sel->rx = sel->x; @@ -222,34 +236,11 @@ togglemax(const char *arg) { } void -versatile(void) { - Client *c; - - for(c = clients; c; c = c->next) { - if(isvisible(c)) { - if(c->isbanned) - XMoveWindow(dpy, c->win, c->x, c->y); - c->isbanned = False; - resize(c, c->x, c->y, c->w, c->h, True); - } - else { - c->isbanned = True; - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - } - } - if(!sel || !isvisible(sel)) { - for(c = stack; c && !isvisible(c); c = c->snext); - focus(c); - } - restack(); -} - -void zoom(const char *arg) { unsigned int n; Client *c; - if(!sel || lt->arrange != tile || sel->isversatile) + if(!sel || lt->arrange != tile || sel->isfloating) return; for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++;