draw.c
changeset 597 7a48d1f06223
parent 581 601842ee4484
child 598 38bbcf31accc
equal deleted inserted replaced
596:16ec97b95b4f 597:7a48d1f06223
    28 	}
    28 	}
    29 	return XTextWidth(dc.font.xfont, text, len);
    29 	return XTextWidth(dc.font.xfont, text, len);
    30 }
    30 }
    31 
    31 
    32 static void
    32 static void
    33 drawtext(const char *text, unsigned long col[ColLast], Bool ldot, Bool rdot) {
    33 drawtext(const char *text, unsigned long col[ColLast], Bool border, Bool ldot) {
    34 	int x, y, w, h;
    34 	int x, y, w, h;
    35 	static char buf[256];
    35 	static char buf[256];
    36 	unsigned int len, olen;
    36 	unsigned int len, olen;
    37 	XGCValues gcv;
    37 	XGCValues gcv;
    38 	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
    38 	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
       
    39 	XPoint pt[5];
    39 
    40 
    40 	XSetForeground(dpy, dc.gc, col[ColBG]);
    41 	XSetForeground(dpy, dc.gc, col[ColBG]);
    41 	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    42 	XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    42 	if(!text)
    43 	if(!text)
    43 		return;
    44 		return;
    77 		r.x = dc.x + 2;
    78 		r.x = dc.x + 2;
    78 		r.y = dc.y + 2;
    79 		r.y = dc.y + 2;
    79 		r.width = r.height = (h + 2) / 4;
    80 		r.width = r.height = (h + 2) / 4;
    80 		XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    81 		XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    81 	}
    82 	}
    82 	if(rdot) {
    83 	if(border) {
    83 		r.width = r.height = (h + 2) / 4;
    84 		pt[0].x = dc.x;
    84 		r.x = dc.x + dc.w - r.width - 2;
    85 		pt[0].y = dc.y;
    85 		r.y = dc.y + dc.h - r.height - 2;
    86 		pt[1].x = dc.w - 1;
    86 		XFillRectangles(dpy, dc.drawable, dc.gc, &r, 1);
    87 		pt[1].y = 0;
       
    88 		pt[2].x = 0;
       
    89 		pt[2].y = dc.h - 1;
       
    90 		pt[3].x = -(dc.w - 1);
       
    91 		pt[3].y = 0;
       
    92 		pt[4].x = 0;
       
    93 		pt[4].y = -(dc.h - 1);
       
    94 		XDrawLines(dpy, dc.drawable, dc.gc, pt, 5, CoordModePrevious);
    87 	}
    95 	}
    88 }
    96 }
    89 
    97 
    90 /* extern */
    98 /* extern */
    91 
    99