Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
cleaned up settags-handling
[dwm.git]
/
layout.c
diff --git
a/layout.c
b/layout.c
index
46e82c2
..
030c282
100644
(file)
--- a/
layout.c
+++ b/
layout.c
@@
-10,7
+10,7
@@
typedef struct {
} Layout;
unsigned int blw = 0;
} Layout;
unsigned int blw = 0;
-static
Layout *lt = NULL;
+static
unsigned int ltidx = 0; /* default */
static void
floating(void) { /* default floating layout */
static void
floating(void) { /* default floating layout */
@@
-36,7
+36,7
@@
arrange(void) {
unban(c);
else
ban(c);
unban(c);
else
ban(c);
- l
t->
arrange();
+ l
ayouts[ltidx].
arrange();
focus(NULL);
restack();
}
focus(NULL);
restack();
}
@@
-76,25
+76,25
@@
focusprev(const char *arg) {
const char *
getsymbol(void)
{
const char *
getsymbol(void)
{
- return l
t->
symbol;
+ return l
ayouts[ltidx].
symbol;
}
Bool
isfloating(void) {
}
Bool
isfloating(void) {
- return l
t->
arrange == floating;
+ return l
ayouts[ltidx].
arrange == floating;
}
Bool
isarrange(void (*func)())
{
}
Bool
isarrange(void (*func)())
{
- return func == l
t->
arrange;
+ return func == l
ayouts[ltidx].
arrange;
}
void
initlayouts(void) {
unsigned int i, w;
}
void
initlayouts(void) {
unsigned int i, w;
- lt = &layouts[0];
+ /* TODO deserialize ltidx if present */
nlayouts = sizeof layouts / sizeof layouts[0];
for(blw = i = 0; i < nlayouts; i++) {
w = textw(layouts[i].symbol);
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;
drawstatus();
if(!sel)
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.sibling = barwin;
if(!sel->isfloating) {
wc.stack_mode = Below;
wc.sibling = barwin;
if(!sel->isfloating) {
@@
-143,15
+143,14
@@
setlayout(const char *arg) {
int i;
if(!arg) {
int i;
if(!arg) {
- lt++;
- if(lt == layouts + nlayouts)
- lt = layouts;
+ if(++ltidx == nlayouts)
+ ltidx = 0;;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
- lt
= &layouts[i]
;
+ lt
idx = i
;
}
if(sel)
arrange();
}
if(sel)
arrange();
@@
-173,7
+172,7
@@
void
togglemax(const char *arg) {
XEvent ev;
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;
return;
if((sel->ismax = !sel->ismax)) {
sel->rx = sel->x;