Xinqi Bao's Git
projects
/
dwm.git
/ blobdiff
summary
|
log
|
commit
|
diff
|
tree
raw
|
inline
| side by side
replaced static Layout *lt with static unsigned int sellayout... (will be adapted...
[dwm.git]
/
layout.c
diff --git
a/layout.c
b/layout.c
index
c467080
..
573de57
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 sellayout = 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[sellayout].
arrange();
focus(NULL);
restack();
}
focus(NULL);
restack();
}
@@
-76,28
+76,28
@@
focusprev(const char *arg) {
const char *
getsymbol(void)
{
const char *
getsymbol(void)
{
- return l
t->
symbol;
+ return l
ayouts[sellayout].
symbol;
}
Bool
isfloating(void) {
}
Bool
isfloating(void) {
- return l
t->
arrange == floating;
+ return l
ayouts[sellayout].
arrange == floating;
}
Bool
isarrange(void (*func)())
{
}
Bool
isarrange(void (*func)())
{
- return func == l
t->
arrange;
+ return func == l
ayouts[sellayout].
arrange;
}
void
initlayouts(void) {
unsigned int i, w;
}
void
initlayouts(void) {
unsigned int i, w;
- lt = &layout[0];
- nlayouts = sizeof layout
/ sizeof layout
[0];
+ /* TODO deserialize sellayout if present */
+ nlayouts = sizeof layout
s / sizeof layouts
[0];
for(blw = i = 0; i < nlayouts; i++) {
for(blw = i = 0; i < nlayouts; i++) {
- w = textw(layout[i].symbol);
+ w = textw(layout
s
[i].symbol);
if(w > blw)
blw = w;
}
if(w > blw)
blw = w;
}
@@
-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 == layout + nlayouts)
- lt = layout;
+ if(++sellayout == nlayouts)
+ sellayout = 0;;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
}
else {
i = atoi(arg);
if(i < 0 || i >= nlayouts)
return;
-
lt = &layout[i]
;
+
sellayout = 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;