changeset: 961:edfafdb7084d
tag: tip
user: Anselm R. Garbe <garbeam_AT_gmail.com>
date: Fri Aug 17 21:19:07 2007 +0200
summary: replaced static Layout *lt with static unsigned int sellayout... (will be adapted later when _DWM_CONFIG is serialized as root window property)
diff -r b5f856fcef4c -r edfafdb7084d layout.c
--- a/layout.c Fri Aug 17 21:12:55 2007 +0200
+++ b/layout.c Fri Aug 17 21:19:07 2007 +0200
@@ -10,7 +10,7 @@ typedef struct {
} Layout;
unsigned int blw = 0;
-static Layout *lt = NULL;
+static unsigned int sellayout = 0; /* default */
static void
floating(void) { /* default floating layout */
@@ -36,7 +36,7 @@ arrange(void) {
unban(c);
else
ban(c);
- lt->arrange();
+ layouts[sellayout].arrange();
focus(NULL);
restack();
}
@@ -76,25 +76,25 @@ const char *
const char *
getsymbol(void)
{
- return lt->symbol;
+ return layouts[sellayout].symbol;
}
Bool
isfloating(void) {
- return lt->arrange == floating;
+ return layouts[sellayout].arrange == floating;
}
Bool
isarrange(void (*func)())
{
- return func == lt->arrange;
+ return func == layouts[sellayout].arrange;
}
void
initlayouts(void) {
unsigned int i, w;
- lt = &layouts[0];
+ /* TODO deserialize sellayout if present */
nlayouts = sizeof layouts / sizeof layouts[0];
for(blw = i = 0; i < nlayouts; i++) {
w = textw(layouts[i].symbol);
@@ -118,9 +118,9 @@ restack(void) {
drawstatus();
if(!sel)
return;
- if(sel->isfloating || lt->arrange == floating)
+ if(sel->isfloating || isfloating())
XRaiseWindow(dpy, sel->win);
- if(lt->arrange != floating) {
+ if(!isfloating()) {
wc.stack_mode = Below;
wc.sibling = barwin;
if(!sel->isfloating) {
@@ -143,15 +143,14 @@ setlayout(const char *arg) {
int i;
if(!arg) {
- lt++;
- if(lt == layouts + nlayouts)
- lt = layouts;
+ if(++sellayout == nlayouts)
+ sellayout = 0;;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
- lt = &layouts[i];
+ sellayout = i;
}
if(sel)
arrange();
@@ -173,7 +172,7 @@ togglemax(const char *arg) {
togglemax(const char *arg) {
XEvent ev;
- if(!sel || (lt->arrange != floating && !sel->isfloating) || sel->isfixed)
+ if(!sel || (!isfloating() && !sel->isfloating) || sel->isfixed)
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;
Received on Fri Aug 17 2007 - 21:23:00 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:56 UTC