My dmenu build
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
566 B

  1. /* See LICENSE file for copyright and license details. */
  2. #include <X11/Xlib.h>
  3. #include "draw.h"
  4. void
  5. drawsquare(DC *dc, Bool filled, unsigned long col[ColLast], Bool invert) {
  6. int n;
  7. XRectangle r = { dc->x, dc->y, dc->w, dc->h };
  8. XSetForeground(dc->dpy, dc->gc, col[invert ? ColBG : ColFG]);
  9. n = ((dc->font.ascent + dc->font.descent + 2) / 4) + (filled ? 1 : 0);
  10. r.width = r.height = n;
  11. r.x = dc->x + 1;
  12. r.y = dc->y + 1;
  13. if(filled)
  14. XFillRectangles(dc->dpy, dc->drawable, dc->gc, &r, 1);
  15. else
  16. XDrawRectangles(dc->dpy, dc->drawable, dc->gc, &r, 1);
  17. }