static const char broken[] = "broken";
static char stext[512];
static int screen;
-static int sw, sh; /* X display screen geometry width, height */
-static int bh, blw = 0; /* bar geometry */
+static int screen_width;
+static int screen_height;
+static int bar_height;
+static int bar_lwidth = 0; /* bar geometry */
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static void (*handler[LASTEvent]) (XEvent *) = {
*h = MAX(1, *h);
if(interact) {
- if(*x > sw) {
- *x = sw - client_get_width(c);
+ if(*x > screen_width) {
+ *x = screen_width - client_get_width(c);
}
- if(*y > sh) {
- *y = sh - client_get_height(c);
+ if(*y > screen_height) {
+ *y = screen_height - client_get_height(c);
}
if(*x + *w + 2 * c->border.w < 0) {
*x = 0;
}
}
- if(*h < bh) {
- *h = bh;
+ if(*h < bar_height) {
+ *h = bar_height;
}
- if(*w < bh) {
- *w = bh;
+ if(*w < bar_height) {
+ *w = bar_height;
}
if(resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
if(i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
- } else if(ev->x < x + blw) {
+ } else if(ev->x < x + bar_lwidth) {
click = ClkLtSymbol;
} else if(ev->x > selmon->win_geom.w - TEXTW(stext)) {
click = ClkStatusText;
Bool dirty;
if(ev->window == root) {
- dirty = (sw != ev->width);
- sw = ev->width;
- sh = ev->height;
+ dirty = (screen_width != ev->width);
+ screen_width = ev->width;
+ screen_height = ev->height;
if(updategeom() || dirty) {
if(dc.drawable != 0) {
XFreePixmap(dpy, dc.drawable);
}
- dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
+ dc.drawable = XCreatePixmap(dpy, root, screen_width,
+ bar_height, DefaultDepth(dpy, screen));
XftDrawChange(dc.xft.drawable, dc.drawable);
updatebars();
dc.geom.x += dc.geom.w;
}
- dc.geom.w = blw = TEXTW(m->ltsymbol);
+ dc.geom.w = TEXTW(m->ltsymbol);
+ bar_lwidth = dc.geom.w;
drawtext(m->ltsymbol, dc.norm, False);
dc.geom.x += dc.geom.w;
x = dc.geom.x;
drawtext(stext, dc.norm, False);
- if((dc.geom.w = dc.geom.x - x) > bh) {
+ if((dc.geom.w = dc.geom.x - x) > bar_height) {
dc.geom.x = x;
if(m->sel) {
}
}
- XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->win_geom.w, bh, 0, 0);
+ XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->win_geom.w, bar_height, 0, 0);
XSync(dpy, False);
return;
/* only fix client y-offset, if the client center might cover the bar */
c->geom.y = MAX(c->geom.y, (c->mon->by == c->mon->geom.y &&
(c->geom.x + (c->geom.w / 2) >= c->mon->win_geom.x) &&
- (c->geom.x + (c->geom.w / 2) < c->mon->win_geom.x + c->mon->win_geom.w)) ? bh : c->mon->geom.y);
+ (c->geom.x + (c->geom.w / 2) < c->mon->win_geom.x + c->mon->win_geom.w)) ? bar_height : c->mon->geom.y);
c->border.w = borderpx;
wc.border_width = c->border.w;
attach(c);
attachstack(c);
- XMoveResizeWindow(dpy, c->win, c->geom.x + 2 * sw, c->geom.y, c->geom.w, c->geom.h); /* some windows require this */
+ XMoveResizeWindow(dpy, c->win, c->geom.x + 2 * screen_width, c->geom.y, c->geom.w, c->geom.h); /* some windows require this */
setclientstate(c, NormalState);
if (c->mon == selmon) {
w = m->win_geom.w - getsystraywidth();
- XMoveResizeWindow(dpy, m->barwin, m->win_geom.x, m->by, w, bh);
+ XMoveResizeWindow(dpy, m->barwin, m->win_geom.x, m->by, w, bar_height);
return;
}
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
initfont(font);
- sw = DisplayWidth(dpy, screen);
- sh = DisplayHeight(dpy, screen);
- bh = dc.geom.h = dc.font.height + 2;
+ screen_width = DisplayWidth(dpy, screen);
+ screen_height = DisplayHeight(dpy, screen);
+ bar_height = dc.geom.h = dc.font.height + 2;
updategeom();
/* init atoms */
wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
dc.sel[ColBorder] = getcolor(selbordercolor, dc.xft.sel + ColBorder);
dc.sel[ColBG] = getcolor(selbgcolor, dc.xft.sel + ColBG);
dc.sel[ColFG] = getcolor(selfgcolor, dc.xft.sel + ColFG);
- dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
+ dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bar_height, DefaultDepth(dpy, screen));
dc.xft.drawable = XftDrawCreate(dpy, dc.drawable, DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
dc.gc = XCreateGC(dpy, root, 0, NULL);
XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
for(m = mons; m; m = m->next) {
w = m->win_geom.w - getsystraywidth();
- m->barwin = XCreateWindow(dpy, root, m->win_geom.x, m->by, w, bh, 0, DefaultDepth(dpy, screen),
+ m->barwin = XCreateWindow(dpy, root, m->win_geom.x, m->by, w, bar_height, 0, DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy, screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
{
m->win_geom.y = m->geom.y;
m->win_geom.h = m->geom.h;
- m->win_geom.h -= bh;
+ m->win_geom.h -= bar_height;
m->by = m->topbar ? m->win_geom.y : m->win_geom.y + m->win_geom.h;
- m->win_geom.y = m->topbar ? m->win_geom.y + bh : m->win_geom.y;
+ m->win_geom.y = m->topbar ? m->win_geom.y + bar_height : m->win_geom.y;
return;
}
mons = createmon();
}
- if(mons->geom.w != sw || mons->geom.h != sh) {
+ if(mons->geom.w != screen_width || mons->geom.h != screen_height) {
dirty = True;
- mons->geom.w = mons->win_geom.w = sw;
- mons->geom.h = mons->win_geom.h = sh;
+ mons->geom.w = mons->win_geom.w = screen_width;
+ mons->geom.h = mons->win_geom.h = screen_height;
updatebarpos(mons);
}
}
return;
}
- i->geom.h = bh;
+ i->geom.h = bar_height;
if(w == h) {
- i->geom.w = bh;
- } else if(h == bh) {
+ i->geom.w = bar_height;
+ } else if(h == bar_height) {
i->geom.w = w;
} else {
- i->geom.w = (int) ((float)bh * ((float)w / (float)h));
+ i->geom.w = (int) ((float)bar_height * ((float)w / (float)h));
}
applysizehints(i, &(i->geom.x), &(i->geom.y), &(i->geom.w), &(i->geom.h), False);
/* force icons into the systray dimenons if they don't want to */
- if(i->geom.h > bh) {
+ if(i->geom.h > bar_height) {
if(i->geom.w == i->geom.h) {
- i->geom.w = bh;
+ i->geom.w = bar_height;
} else {
- i->geom.w = (int) ((float)bh * ((float)i->geom.w / (float)i->geom.h));
+ i->geom.w = (int) ((float)bar_height * ((float)i->geom.w / (float)i->geom.h));
}
- i->geom.h = bh;
+ i->geom.h = bar_height;
}
return;
die("fatal: could not malloc() %u bytes\n", sizeof(*systray));
}
- systray->win = XCreateSimpleWindow(dpy, root, x, selmon->by, w, bh, 0, 0, dc.sel[ColBG]);
+ systray->win = XCreateSimpleWindow(dpy, root, x, selmon->by, w, bar_height, 0, 0, dc.sel[ColBG]);
wa.event_mask = ButtonPressMask | ExposureMask;
wa.override_redirect = True;
wa.background_pixmap = ParentRelative;
w = w ? w + systrayspacing : 1;
x -= w;
- XMoveResizeWindow(dpy, systray->win, x, selmon->by, w, bh);
+ XMoveResizeWindow(dpy, systray->win, x, selmon->by, w, bar_height);
/* redraw background */
XSetForeground(dpy, dc.gc, dc.norm[ColBG]);
- XFillRectangle(dpy, systray->win, dc.gc, 0, 0, w, bh);
+ XFillRectangle(dpy, systray->win, dc.gc, 0, 0, w, bar_height);
XSync(dpy, False);
return;