void
drw_resize(Drw *drw, unsigned int w, unsigned int h)
{
- if (!drw)
- return;
drw->w = w;
drw->h = h;
if (drw->drawable)
drw_clr_create(Drw *drw, const char *clrname)
{
Clr *clr;
- if (!drw)
- return NULL;
clr = ecalloc(1, sizeof(Clr));
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
void
drw_setscheme(Drw *drw, ClrScheme *scheme)
{
- if (!drw)
- return;
drw->scheme = scheme;
}
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert)
{
- if (!drw || !drw->scheme)
+ if (!drw->scheme)
return;
XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix);
if (filled)
void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
{
- if (!drw)
- return;
XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y);
XSync(drw->dpy, False);
}
{
XGlyphInfo ext;
- if (!font || !text)
- return;
XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext);
tex->h = font->h;
tex->w = ext.xOff;
{
Extnts tex;
- if (!font)
- return -1;
drw_font_getexts(font, text, len, &tex);
+
return tex.w;
}
{
Cur *cur;
- if (!drw)
- return NULL;
cur = ecalloc(1, sizeof(Cur));
cur->cursor = XCreateFontCursor(drw->dpy, shape);
void
drw_cur_free(Drw *drw, Cur *cursor)
{
- if (!drw || !cursor)
+ if (!cursor)
return;
XFreeCursor(drw->dpy, cursor->cursor);
free(cursor);