diff options
author | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-13 19:13:54 +0200 |
---|---|---|
committer | Anselm R. Garbe <garbeam@gmail.com> | 2007-08-13 19:13:54 +0200 |
commit | 77044e876511f51c34bde379d89e2de754707ee6 (patch) | |
tree | 6626665e0d57068c2d6ddbb3669534f2afb4e159 /layout.c | |
parent | 2feb3afe784cbd9d900bd70aad91431a4b25f2ab (diff) | |
download | dwm-77044e876511f51c34bde379d89e2de754707ee6.tar.gz |
made Layout a static struct in layout.c, added some convenience getters in layout.c, now lt->arrange accesses are not possible anymore, arrange() is the super-arrange function which sets up all layouts
Diffstat (limited to 'layout.c')
-rw-r--r-- | layout.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/layout.c b/layout.c index fe12e1e..a660fd7 100644 --- a/layout.c +++ b/layout.c @@ -2,11 +2,25 @@ #include "dwm.h" #include <stdlib.h> +typedef struct { + const char *symbol; + void (*arrange)(void); +} Layout; + unsigned int blw = 0; -Layout *lt = NULL; +static Layout *lt = NULL; /* static */ +static void +floating(void) { + Client *c; + + for(c = clients; c; c = c->next) + if(isvisible(c)) + resize(c, c->x, c->y, c->w, c->h, True); +} + static unsigned int nlayouts = 0; LAYOUTS @@ -14,19 +28,15 @@ LAYOUTS /* extern */ void -floating(void) { +arrange(void) { Client *c; - if(lt->arrange != floating) - return; - for(c = clients; c; c = c->next) - if(isvisible(c)) { + if(isvisible(c)) unban(c); - resize(c, c->x, c->y, c->w, c->h, True); - } else ban(c); + lt->arrange(); focus(NULL); restack(); } @@ -55,6 +65,23 @@ focusclient(const char *arg) { } } +const char * +getsymbol(void) +{ + return lt->symbol; +} + +Bool +isfloating(void) { + return lt->arrange == floating; +} + +Bool +isarrange(void (*func)()) +{ + return func == lt->arrange; +} + void initlayouts(void) { unsigned int i, w; @@ -119,7 +146,7 @@ setlayout(const char *arg) { lt = &layout[i]; } if(sel) - lt->arrange(); + arrange(); else drawstatus(); } @@ -131,7 +158,7 @@ togglebar(const char *arg) { else bpos = BarOff; updatebarpos(); - lt->arrange(); + arrange(); } void |