static void setmfact(const Arg *arg);
static void setup(void);
static void showhide(Client *c);
-static void sigchld(int signal);
+static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
c->w = ev->width;
if(ev->value_mask & CWHeight)
c->h = ev->height;
- if((c->x - m->mx + c->w) > m->mw && c->isfloating)
+ if((c->x + c->w) > m->mx + m->mw && c->isfloating)
c->x = m->mx + (m->mw / 2 - c->w / 2); /* center in x direction */
- if((c->y - m->my + c->h) > m->mh && c->isfloating)
+ if((c->y + c->h) > m->my + m->mh && c->isfloating)
c->y = m->my + (m->mh / 2 - c->h / 2); /* center in y direction */
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
configure(c);
}
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c);
- if(c == selmon->sel)
- drawbars();
+ if(c == c->mon->sel)
+ drawbar(c->mon);
}
}
}
int w;
XSetWindowAttributes wa;
+ /* clean up any zombies immediately */
+ sigchld(0);
+
/* init screen */
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
void
-sigchld(int signal) {
+sigchld(int unused) {
+ if(signal(SIGCHLD, sigchld) == SIG_ERR)
+ die("Can't install SIGCHLD handler");
while(0 < waitpid(-1, NULL, WNOHANG));
}
void
spawn(const Arg *arg) {
- signal(SIGCHLD, sigchld);
if(fork() == 0) {
if(dpy)
close(ConnectionNumber(dpy));
void
toggletag(const Arg *arg) {
- unsigned int mask;
+ unsigned int newtags;
if(!selmon->sel)
return;
- mask = selmon->sel->tags ^ (arg->ui & TAGMASK);
- if(mask) {
- selmon->sel->tags = mask;
+ newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
+ if(newtags) {
+ selmon->sel->tags = newtags;
arrange();
}
}
void
toggleview(const Arg *arg) {
- unsigned int mask = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+ unsigned int newtagset = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
- if(mask) {
- selmon->tagset[selmon->seltags] = mask;
+ if(newtagset) {
+ selmon->tagset[selmon->seltags] = newtagset;
arrange();
}
}
void
updategeom(void) {
- int i, n = 1, nn;
+ int i, n = 1;
Client *c;
Monitor *newmons = NULL, *m = NULL, *tm;
#ifdef XINERAMA
+ int nn;
XineramaScreenInfo *info = NULL;
if(XineramaIsActive(dpy))
if(info[i - 1].x_org == info[i].x_org && info[i - 1].y_org == info[i].y_org
&& info[i - 1].width == info[i].width && info[i - 1].height == info[i].height)
--nn;
- n = nn; /* we only consider unique geometrys as separate screens */
+ n = nn; /* we only consider unique geometries as separate screens */
#endif /* XINERAMA */
/* allocate monitor(s) for the new geometry setup */
for(i = 0; i < n; i++) {