Xinqi Bao's Git
1 /* See LICENSE file for copyright and license details. */
6 drawsquare(DC
*dc
, Bool filled
, unsigned long col
[ColLast
], Bool invert
) {
8 XRectangle r
= { dc
->x
, dc
->y
, dc
->w
, dc
->h
};
10 XSetForeground(dc
->dpy
, dc
->gc
, col
[invert
? ColBG
: ColFG
]);
11 n
= ((dc
->font
.ascent
+ dc
->font
.descent
+ 2) / 4) + (filled
? 1 : 0);
12 r
.width
= r
.height
= n
;
16 XFillRectangles(dc
->dpy
, dc
->drawable
, dc
->gc
, &r
, 1);
18 XDrawRectangles(dc
->dpy
, dc
->drawable
, dc
->gc
, &r
, 1);