Browse Source

replaced static Layout *lt with static unsigned int sellayout... (will be adapted later when _DWM_CONFIG is serialized as root window property)

main
Anselm R. Garbe 17 years ago
parent
commit
55d8dda9f4
1 changed files with 12 additions and 13 deletions
  1. +12
    -13
      layout.c

+ 12
- 13
layout.c View File

@ -10,7 +10,7 @@ typedef struct {
} Layout; } Layout;
unsigned int blw = 0; unsigned int blw = 0;
static Layout *lt = NULL;
static unsigned int sellayout = 0; /* default */
static void static void
floating(void) { /* default floating layout */ floating(void) { /* default floating layout */
@ -36,7 +36,7 @@ arrange(void) {
unban(c); unban(c);
else else
ban(c); ban(c);
lt->arrange();
layouts[sellayout].arrange();
focus(NULL); focus(NULL);
restack(); restack();
} }
@ -76,25 +76,25 @@ focusprev(const char *arg) {
const char * const char *
getsymbol(void) getsymbol(void)
{ {
return lt->symbol;
return layouts[sellayout].symbol;
} }
Bool Bool
isfloating(void) { isfloating(void) {
return lt->arrange == floating;
return layouts[sellayout].arrange == floating;
} }
Bool Bool
isarrange(void (*func)()) isarrange(void (*func)())
{ {
return func == lt->arrange;
return func == layouts[sellayout].arrange;
} }
void void
initlayouts(void) { initlayouts(void) {
unsigned int i, w; unsigned int i, w;
lt = &layouts[0];
/* TODO deserialize sellayout if present */
nlayouts = sizeof layouts / sizeof layouts[0]; nlayouts = sizeof layouts / sizeof layouts[0];
for(blw = i = 0; i < nlayouts; i++) { for(blw = i = 0; i < nlayouts; i++) {
w = textw(layouts[i].symbol); w = textw(layouts[i].symbol);
@ -118,9 +118,9 @@ restack(void) {
drawstatus(); drawstatus();
if(!sel) if(!sel)
return; return;
if(sel->isfloating || lt->arrange == floating)
if(sel->isfloating || isfloating())
XRaiseWindow(dpy, sel->win); XRaiseWindow(dpy, sel->win);
if(lt->arrange != floating) {
if(!isfloating()) {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = barwin; wc.sibling = barwin;
if(!sel->isfloating) { if(!sel->isfloating) {
@ -143,15 +143,14 @@ setlayout(const char *arg) {
int i; int i;
if(!arg) { if(!arg) {
lt++;
if(lt == layouts + nlayouts)
lt = layouts;
if(++sellayout == nlayouts)
sellayout = 0;;
} }
else { else {
i = atoi(arg); i = atoi(arg);
if(i < 0 || i >= nlayouts) if(i < 0 || i >= nlayouts)
return; return;
lt = &layouts[i];
sellayout = i;
} }
if(sel) if(sel)
arrange(); arrange();
@ -173,7 +172,7 @@ void
togglemax(const char *arg) { togglemax(const char *arg) {
XEvent ev; XEvent ev;
if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
if(!sel || (!isfloating() && !sel->isfloating) || sel->isfixed)
return; return;
if((sel->ismax = !sel->ismax)) { if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x; sel->rx = sel->x;


Loading…
Cancel
Save