}
if(resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
- /* see last two sentences in ICCCM 4.1.2.3 */
+ /*
+ * "The min_aspect and max_aspect fields are fractions with the
+ * numerator first and the denominator second, and they allow a
+ * client to specify the range of aspect ratios it prefers.
+ * Window managers that honor aspect ratios should take into
+ * account the base size in determining the preferred window
+ * size. If a base size is provided along with the aspect ratio
+ * fields, the base size should be subtracted from the window
+ * size prior to checking that the aspect ratio falls in range.
+ * If a base size is not provided, nothing should be subtracted
+ * from the window size. (The minimum size is not to be used in
+ * place of the base size for this purpose.)"
+ *
+ * -- ICCCM 4.1.2.3 (https://tronche.com/gui/x/icccm/sec-4.html)
+ */
baseismin = c->basew == c->minw && c->baseh == c->minh;
if(!baseismin) { /* temporarily remove base dimensions */
return(m);
}
+void wipe_bar(struct monitor *mon, unsigned long *col)
+{
+ XSetForeground(dpy, dc.gc, col[ColBG]);
+ XFillRectangle(dpy, dc.drawable, dc.gc,
+ 0, 0, mon->win_geom.w, bar_height);
+ return;
+}
+
void drawbar(struct monitor *m)
{
int x;
}
}
+ wipe_bar(m, m == selmon ? dc.sel : dc.norm);
+
dc.geom.x = 0;
for(i = 0; i < LENGTH(tags); i++) {
dc.geom.x += dc.geom.w;
x = dc.geom.x;
+ /* x = end of the layout symbol */
+
dc.geom.w = TEXTW(stext);
dc.geom.x = m->win_geom.w - dc.geom.w;
+ /* dc.geom.x = start of the status text */
+
if(dc.geom.x < x) {
dc.geom.x = x;
dc.geom.w = m->win_geom.w - x;
drawtext(stext, dc.norm, False);
- if((dc.geom.w = dc.geom.x - x) > bar_height) {
- dc.geom.x = x;
-
- if(m->sel) {
- col = m == selmon ? dc.sel : dc.norm;
- /* drawtext(m->sel->name, col, False); */
- drawsquare(m->sel->isfixed, m->sel->isfloating, False, col);
- } else {
- drawtext(NULL, dc.norm, False);
- }
- }
-
XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0,
m->win_geom.w, bar_height, 0, 0);
XSync(dpy, False);
{
struct client *c;
Window trans;
- XPropertyEvent *ev = &e->xproperty;
+ XPropertyEvent *ev;
- if((ev->window == root) && (ev->atom == XA_WM_NAME))
+ ev = &e->xproperty;
+
+ if((ev->window == root) && (ev->atom == XA_WM_NAME)) {
updatestatus();
- else if(ev->state == PropertyDelete)
+ } else if(ev->state == PropertyDelete) {
return; /* ignore */
- else if((c = wintoclient(ev->window))) {
+ } else if((c = wintoclient(ev->window))) {
switch(ev->atom) {
- default: break;
+ default:
+ break;
+
case XA_WM_TRANSIENT_FOR:
if(!c->isfloating && (XGetTransientForHint(dpy, c->win, &trans)) &&
(c->isfloating = (wintoclient(trans)) != NULL))
arrange(c->mon);
break;
+
case XA_WM_NORMAL_HINTS:
updatesizehints(c);
break;
+
case XA_WM_HINTS:
updatewmhints(c);
drawbars();
break;
}
+
if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c);
- if(c == c->mon->sel)
- drawbar(c->mon);
+ drawbars();
}
- if(ev->atom == netatom[NetWMWindowType])
+
+ if(ev->atom == netatom[NetWMWindowType]) {
updatewindowtype(c);
+ }
}
return;
strcpy(stext, "d "VERSION);
}
- drawbar(selmon);
+ drawbars();
+
return;
}