[wmfs.c] Remove memcmp for layoutswitch, improve...

This commit is contained in:
Martin Duquesnoy 2008-09-28 17:13:52 +02:00
parent 91af47a8ff
commit dbfe551b3d
2 changed files with 11 additions and 22 deletions

32
wmfs.c
View File

@ -148,8 +148,10 @@ freelayout(void)
if(!ishide(c))
{
if(c->tile)
{
moveresize(c, c->ox, c->oy, c->ow, c->oh, True);
c->tile = False;
c->tile = False;
}
}
}
@ -450,6 +452,7 @@ killclient(char *cmd)
return;
}
/* Improved ! :) */
void
layoutswitch(char *cmd)
{
@ -457,12 +460,13 @@ layoutswitch(char *cmd)
for(i = 0; i < NLAYOUT; ++i)
{
if(!memcmp(&tags[seltag].layout, &lyt[i], sizeof(Layout)))
if(tags[seltag].layout.symbol == lyt[i].symbol
&& tags[seltag].layout.func == lyt[i].func)
{
if(cmd[0] == '+')
tags[seltag].layout = lyt[((i + 1 < NLAYOUT) ? i + 1 : 0)];
tags[seltag].layout = lyt[(i + 1) % NLAYOUT];
else if(cmd[0] == '-')
tags[seltag].layout = lyt[((i - 1 > -1) ? i - 1 : NLAYOUT-1)];
tags[seltag].layout = lyt[(i + NLAYOUT - 1) % NLAYOUT];
break;
}
}
@ -471,22 +475,6 @@ layoutswitch(char *cmd)
return;
}
void
lowerclient(Client *c)
{
if(!c)
return;
if(conf.ttbarheight)
{
if(conf.ttbarheight > 5)
XLowerWindow(dpy,c->button);
XLowerWindow(dpy,c->tbar);
}
XLowerWindow(dpy,c->win);
return;
}
void
mainloop(void)
{
@ -584,7 +572,9 @@ manage(Window w, XWindowAttributes *wa)
if(conf.ttbarheight > 5)
c->button = XCreateSimpleWindow(dpy, root, BUTX(c->x, c->w),
BUTY(c->y), (BUTH) ? BUTH : 1, (BUTH) ? BUTH : 1,
BUTY(c->y),
((BUTH) ? BUTH : 1),
((BUTH) ? BUTH : 1),
1, conf.colors.bordernormal,
conf.colors.borderfocus);
}

1
wmfs.h
View File

@ -231,7 +231,6 @@ void keymovey(char *cmd);
void keyresize(char *cmd);
void killclient(char *cmd);
void layoutswitch(char *cmd);
void lowerclient(Client *c);
void mainloop(void);
void mapclient(Client *c);
void manage(Window w, XWindowAttributes *wa);