X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=layout.c;h=bb477d64c9440b0c2343142265e76fa7f9e697c4;hb=587100873a66e34251041678504a8c1e28410591;hp=8b4c940fe614f4b65fc3849c711887357a2eb0ce;hpb=2c477cf66147d369ae8ff17acdce743c6811ee6a;p=dwm.git diff --git a/layout.c b/layout.c index 8b4c940..bb477d6 100644 --- a/layout.c +++ b/layout.c @@ -2,6 +2,7 @@ * See LICENSE file for license details. */ #include "dwm.h" +#include unsigned int blw = 0; Layout *lt = NULL; @@ -30,7 +31,7 @@ tile(void) { if(c->isbanned) XMoveWindow(dpy, c->win, c->x, c->y); c->isbanned = False; - if(c->isversatile) + if(c->isuntiled) continue; c->ismax = False; nx = wax; @@ -69,30 +70,26 @@ LAYOUTS /* extern */ void -focusnext(const char *arg) { +focusclient(const char *arg) { Client *c; - if(!sel) + if(!sel || !arg) return; - 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); - restack(); - } -} - -void -focusprev(const char *arg) { - Client *c; - - if(!sel) + switch(atoi(arg)) { + default: 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); + case 1: + for(c = sel->next; c && !isvisible(c); c = c->next); + if(!c) + for(c = clients; c && !isvisible(c); c = c->next); + break; + case -1: + 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); + } + break; } if(c) { focus(c); @@ -119,11 +116,17 @@ incmasterw(const char *arg) { void incnmaster(const char *arg) { - int i = arg ? atoi(arg) : 0; - if((lt->arrange != tile) || (nmaster + i < 1) - || (wah / (nmaster + i) <= 2 * BORDERPX)) - return; - nmaster += i; + int i; + + if(!arg) + nmaster = NMASTER; + else { + i = atoi(arg); + if((lt->arrange != tile) || (nmaster + i < 1) + || (wah / (nmaster + i) <= 2 * BORDERPX)) + return; + nmaster += i; + } if(sel) lt->arrange(); else @@ -145,7 +148,7 @@ initlayouts(void) { Client * nexttiled(Client *c) { - for(; c && (c->isversatile || !isvisible(c)); c = c->next); + for(; c && (c->isuntiled || !isvisible(c)); c = c->next); return c; } @@ -157,10 +160,10 @@ restack(void) { drawstatus(); if(!sel) return; - if(sel->isversatile || lt->arrange == versatile) + if(sel->isuntiled || lt->arrange == untile) XRaiseWindow(dpy, sel->win); - if(lt->arrange != versatile) { - if(!sel->isversatile) + if(lt->arrange != untile) { + if(!sel->isuntiled) XLowerWindow(dpy, sel->win); for(c = nexttiled(clients); c; c = nexttiled(c->next)) { if(c == sel) @@ -174,7 +177,7 @@ restack(void) { void setlayout(const char *arg) { - unsigned int i; + int i; if(!arg) { for(i = 0; i < nlayouts && lt != &layout[i]; i++); @@ -199,7 +202,7 @@ void togglemax(const char *arg) { XEvent ev; - if(!sel || (lt->arrange != versatile && !sel->isversatile) || sel->isfixed) + if(!sel || (lt->arrange != untile && !sel->isuntiled) || sel->isfixed) return; if((sel->ismax = !sel->ismax)) { sel->rx = sel->x; @@ -215,7 +218,7 @@ togglemax(const char *arg) { } void -versatile(void) { +untile(void) { Client *c; for(c = clients; c; c = c->next) { @@ -242,7 +245,7 @@ zoom(const char *arg) { unsigned int n; Client *c; - if(!sel || lt->arrange != tile || sel->isversatile) + if(!sel || lt->arrange != tile || sel->isuntiled) return; for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) n++;