drawsquare is now drawrectangle

This commit is contained in:
Julien Danjou 2007-10-11 15:44:30 +02:00
parent 3c6e7fa6de
commit f6ea98649c
3 changed files with 31 additions and 25 deletions

6
draw.c
View File

@ -71,7 +71,7 @@ drawtext(Display *disp, int screen, int x, int y, int w, int h, GC gc, Drawable
}
void
drawsquare(Display *disp, int screen, int x, int y, int h, Drawable drawable, int dw, int dh, Bool filled, XColor color)
drawrectangle(Display *disp, int screen, int x, int y, int w, int h, Drawable drawable, int dw, int dh, Bool filled, XColor color)
{
cairo_surface_t *surface;
cairo_t *cr;
@ -84,11 +84,11 @@ drawsquare(Display *disp, int screen, int x, int y, int h, Drawable drawable, in
cairo_set_source_rgb(cr, color.red, color.green, color.blue);
if(filled)
{
cairo_rectangle(cr, x + 1, y + 1, h + 1, h + 1);
cairo_rectangle(cr, x + 1, y + 1, w + 1, h + 1);
cairo_fill(cr);
}
else
cairo_rectangle(cr, x + 1, y + 1, h, h);
cairo_rectangle(cr, x + 1, y + 1, w, h);
cairo_stroke(cr);
cairo_destroy(cr);

2
draw.h
View File

@ -25,6 +25,6 @@
#include "config.h"
void drawtext(Display *, int, int, int, int, int, GC, Drawable, XftFont *, const char *, XColor []);
void drawsquare(Display *, int, int, int, int, Drawable, int, int, Bool, XColor);
void drawrectangle(Display *, int, int, int, int, int, Drawable, int, int, Bool, XColor);
inline unsigned short textwidth(Display *, XftFont *, char *, ssize_t);
#endif

View File

@ -70,13 +70,15 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_selected);
if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel && sel->tags[i],
awesomeconf->colors_selected[ColFG]);
drawrectangle(disp, awesomeconf->phys_screen,
x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel && sel->tags[i],
awesomeconf->colors_selected[ColFG]);
}
else
{
@ -86,13 +88,15 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_normal);
if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel && sel->tags[i],
awesomeconf->colors_normal[ColFG]);
drawrectangle(disp, awesomeconf->phys_screen,
x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel && sel->tags[i],
awesomeconf->colors_normal[ColFG]);
}
x += w;
}
@ -126,13 +130,15 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font,
sel->name, awesomeconf->colors_selected);
if(sel->isfloating)
drawsquare(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel->ismax,
awesomeconf->colors_selected[ColFG]);
drawrectangle(disp, awesomeconf->phys_screen,
x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
sel->ismax,
awesomeconf->colors_selected[ColFG]);
}
else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft))
{