X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=cbe2752851d7f981096c37ddcb46f00d75eb3da7;hp=670afbe695657ed27ac93d0d8d50255d4fc09d58;hb=c1f8688bfa56e388dac0e0a9abc90fdb0324b6db;hpb=62d3caa9990e4fd936850341095da4dd1bf4c846 diff --git a/dwm.c b/dwm.c index 670afbe..cbe2752 100644 --- a/dwm.c +++ b/dwm.c @@ -372,10 +372,8 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact) { if(c->inch) *h -= *h % c->inch; /* restore base dimensions */ - *w += c->basew; - *h += c->baseh; - *w = MAX(*w, c->minw); - *h = MAX(*h, c->minh); + *w = MAX(*w + c->basew, c->minw); + *h = MAX(*h + c->baseh, c->minh); if(c->maxw) *w = MIN(*w, c->maxw); if(c->maxh) @@ -790,7 +788,6 @@ drawtext(const char *text, unsigned long col[ColLast], Bool invert) { void enternotify(XEvent *e) { - Client *c; Monitor *m; XCrossingEvent *ev = &e->xcrossing; @@ -800,10 +797,7 @@ enternotify(XEvent *e) { unfocus(selmon->sel, True); selmon = m; } - if((c = wintoclient(ev->window))) - focus(c); - else - focus(NULL); + focus((wintoclient(ev->window))); } void @@ -849,7 +843,7 @@ focusin(XEvent *e) { /* there are some broken focus acquiring clients */ void focusmon(const Arg *arg) { - Monitor *m = NULL; + Monitor *m; if(!mons->next) return; @@ -1104,9 +1098,7 @@ manage(Window w, XWindowAttributes *wa) { *c = cz; c->win = w; updatetitle(c); - if(XGetTransientForHint(dpy, w, &trans)) - t = wintoclient(trans); - if(t) { + if(XGetTransientForHint(dpy, w, &trans) && (t = wintoclient(trans))) { c->mon = t->mon; c->tags = t->tags; } @@ -1121,7 +1113,7 @@ manage(Window w, XWindowAttributes *wa) { c->h = c->oldh = wa->height; c->oldbw = wa->border_width; if(c->w == c->mon->mw && c->h == c->mon->mh) { - c->isfloating = 1; + c->isfloating = True; c->x = c->mon->mx; c->y = c->mon->my; c->bw = 0; @@ -1277,8 +1269,8 @@ propertynotify(XEvent *e) { switch (ev->atom) { default: break; case XA_WM_TRANSIENT_FOR: - XGetTransientForHint(dpy, c->win, &trans); - if(!c->isfloating && (c->isfloating = (wintoclient(trans) != NULL))) + if(!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) && + (c->isfloating = (wintoclient(trans)))) arrange(c->mon); break; case XA_WM_NORMAL_HINTS: @@ -1311,7 +1303,7 @@ clientmessage(XEvent *e) { c->oldstate = c->isfloating; c->oldbw = c->bw; c->bw = 0; - c->isfloating = 1; + c->isfloating = True; resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh); XRaiseWindow(dpy, c->win); } @@ -1791,7 +1783,6 @@ updategeom(void) { XineramaScreenInfo *info = XineramaQueryScreens(dpy, &nn); XineramaScreenInfo *unique = NULL; - info = XineramaQueryScreens(dpy, &nn); for(n = 0, m = mons; m; m = m->next, n++); /* only consider unique geometries as separate screens */ if(!(unique = (XineramaScreenInfo *)malloc(sizeof(XineramaScreenInfo) * nn)))