diff --git a/dwm.c b/dwm.c index 1bbb4b3..96aef80 100644 --- a/dwm.c +++ b/dwm.c @@ -141,6 +141,7 @@ typedef struct { } Rule; /* function declarations */ +static void adjustborders(Monitor *m); static void applyrules(Client *c); static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact); static void arrange(Monitor *m); @@ -275,6 +276,31 @@ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; /* function implementations */ void +adjustborders(Monitor *m) { + Client *c, *l = NULL; + int visible = 0; + + for(c = m->clients; c; c = c->next) { + if (ISVISIBLE(c) && !c->isfloating && m->lt[m->sellt]->arrange) { + if (m->lt[m->sellt]->arrange == monocle) { + visible = 1; + c->oldbw = c->bw = 0; + } else { + visible++; + c->oldbw = c->bw = borderpx; + } + + l = c; + } + } + + if (l && visible == 1 && l->bw) { + l->bw = l->oldbw = 0; + resize(l, l->x, l->y, l->w, l->h, False); + } +} + +void applyrules(Client *c) { const char *class, *instance; unsigned int i; @@ -376,10 +402,15 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact) { void arrange(Monitor *m) { - if(m) - showhide(m->stack); - else for(m = mons; m; m = m->next) + if(m) { + adjustborders(m); showhide(m->stack); + } else { + for(m = mons; m; m = m->next) { + adjustborders(m); + showhide(m->stack); + } + } if(m) { arrangemon(m); restack(m); @@ -1036,13 +1067,25 @@ manage(Window w, XWindowAttributes *wa) { /* only fix client y-offset, if the client center might cover the bar */ c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); - c->bw = borderpx; + + updatewindowtype(c); + if (c->isfloating) { + c->bw = c->isfullscreen ? 0 : borderpx; + } else { + c->bw = 0; + for(t = c->mon->clients; t; t = c->next) { + if (!t->isfloating && c != t && c->tags & t->tags) { + c->bw = borderpx; + break; + } + } + adjustborders(c->mon); + } wc.border_width = c->bw; XConfigureWindow(dpy, w, CWBorderWidth, &wc); XSetWindowBorder(dpy, w, scheme[SchemeNorm].border->rgb); configure(c); /* propagates border_width, if size doesn't change */ - updatewindowtype(c); updatesizehints(c); updatewmhints(c); XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); @@ -1933,7 +1976,8 @@ updatewindowtype(Client *c) { Atom state = getatomprop(c, netatom[NetWMState]); Atom wtype = getatomprop(c, netatom[NetWMWindowType]); - if(state == netatom[NetWMFullscreen]) + if((state == netatom[NetWMFullscreen]) || + (WIDTH(c) == (c->mon->mx + c->mon->mw) && (HEIGHT(c) == (c->mon->my + c->mon->mh)))) setfullscreen(c, True); if(wtype == netatom[NetWMWindowTypeDialog]) c->isfloating = True;