diff options
-rw-r--r-- | drw.c | 19 |
1 files changed, 3 insertions, 16 deletions
@@ -82,8 +82,6 @@ drw_create(Display *dpy, int screen, Window root, unsigned int w, unsigned int h | |||
82 | void | 82 | void |
83 | drw_resize(Drw *drw, unsigned int w, unsigned int h) | 83 | drw_resize(Drw *drw, unsigned int w, unsigned int h) |
84 | { | 84 | { |
85 | if (!drw) | ||
86 | return; | ||
87 | drw->w = w; | 85 | drw->w = w; |
88 | drw->h = h; | 86 | drw->h = h; |
89 | if (drw->drawable) | 87 | if (drw->drawable) |
@@ -188,8 +186,6 @@ Clr * | |||
188 | drw_clr_create(Drw *drw, const char *clrname) | 186 | drw_clr_create(Drw *drw, const char *clrname) |
189 | { | 187 | { |
190 | Clr *clr; | 188 | Clr *clr; |
191 | if (!drw) | ||
192 | return NULL; | ||
193 | 189 | ||
194 | clr = ecalloc(1, sizeof(Clr)); | 190 | clr = ecalloc(1, sizeof(Clr)); |
195 | if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), | 191 | if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen), |
@@ -210,15 +206,13 @@ drw_clr_free(Clr *clr) | |||
210 | void | 206 | void |
211 | drw_setscheme(Drw *drw, ClrScheme *scheme) | 207 | drw_setscheme(Drw *drw, ClrScheme *scheme) |
212 | { | 208 | { |
213 | if (!drw) | ||
214 | return; | ||
215 | drw->scheme = scheme; | 209 | drw->scheme = scheme; |
216 | } | 210 | } |
217 | 211 | ||
218 | void | 212 | void |
219 | drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert) | 213 | drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int empty, int invert) |
220 | { | 214 | { |
221 | if (!drw || !drw->scheme) | 215 | if (!drw->scheme) |
222 | return; | 216 | return; |
223 | XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix); | 217 | XSetForeground(drw->dpy, drw->gc, invert ? drw->scheme->bg->pix : drw->scheme->fg->pix); |
224 | if (filled) | 218 | if (filled) |
@@ -369,8 +363,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, const char *tex | |||
369 | void | 363 | void |
370 | drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) | 364 | drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h) |
371 | { | 365 | { |
372 | if (!drw) | ||
373 | return; | ||
374 | XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); | 366 | XCopyArea(drw->dpy, drw->drawable, win, drw->gc, x, y, w, h, x, y); |
375 | XSync(drw->dpy, False); | 367 | XSync(drw->dpy, False); |
376 | } | 368 | } |
@@ -380,8 +372,6 @@ drw_font_getexts(Fnt *font, const char *text, unsigned int len, Extnts *tex) | |||
380 | { | 372 | { |
381 | XGlyphInfo ext; | 373 | XGlyphInfo ext; |
382 | 374 | ||
383 | if (!font || !text) | ||
384 | return; | ||
385 | XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); | 375 | XftTextExtentsUtf8(font->dpy, font->xfont, (XftChar8 *)text, len, &ext); |
386 | tex->h = font->h; | 376 | tex->h = font->h; |
387 | tex->w = ext.xOff; | 377 | tex->w = ext.xOff; |
@@ -392,9 +382,8 @@ drw_font_getexts_width(Fnt *font, const char *text, unsigned int len) | |||
392 | { | 382 | { |
393 | Extnts tex; | 383 | Extnts tex; |
394 | 384 | ||
395 | if (!font) | ||
396 | return -1; | ||
397 | drw_font_getexts(font, text, len, &tex); | 385 | drw_font_getexts(font, text, len, &tex); |
386 | |||
398 | return tex.w; | 387 | return tex.w; |
399 | } | 388 | } |
400 | 389 | ||
@@ -403,8 +392,6 @@ drw_cur_create(Drw *drw, int shape) | |||
403 | { | 392 | { |
404 | Cur *cur; | 393 | Cur *cur; |
405 | 394 | ||
406 | if (!drw) | ||
407 | return NULL; | ||
408 | cur = ecalloc(1, sizeof(Cur)); | 395 | cur = ecalloc(1, sizeof(Cur)); |
409 | cur->cursor = XCreateFontCursor(drw->dpy, shape); | 396 | cur->cursor = XCreateFontCursor(drw->dpy, shape); |
410 | 397 | ||
@@ -414,7 +401,7 @@ drw_cur_create(Drw *drw, int shape) | |||
414 | void | 401 | void |
415 | drw_cur_free(Drw *drw, Cur *cursor) | 402 | drw_cur_free(Drw *drw, Cur *cursor) |
416 | { | 403 | { |
417 | if (!drw || !cursor) | 404 | if (!cursor) |
418 | return; | 405 | return; |
419 | XFreeCursor(drw->dpy, cursor->cursor); | 406 | XFreeCursor(drw->dpy, cursor->cursor); |
420 | free(cursor); | 407 | free(cursor); |