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 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_surface_t *surface;
cairo_t *cr; 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); cairo_set_source_rgb(cr, color.red, color.green, color.blue);
if(filled) 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); cairo_fill(cr);
} }
else else
cairo_rectangle(cr, x + 1, y + 1, h, h); cairo_rectangle(cr, x + 1, y + 1, w, h);
cairo_stroke(cr); cairo_stroke(cr);
cairo_destroy(cr); cairo_destroy(cr);

2
draw.h
View File

@ -25,6 +25,6 @@
#include "config.h" #include "config.h"
void drawtext(Display *, int, int, int, int, int, GC, Drawable, XftFont *, const char *, XColor []); 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); inline unsigned short textwidth(Display *, XftFont *, char *, ssize_t);
#endif #endif

View File

@ -70,8 +70,10 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font, awesomeconf->statusbar.drawable, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_selected); awesomeconf->tags[i].name, awesomeconf->colors_selected);
if(isoccupied(i, awesomeconf->screen)) if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, awesomeconf->phys_screen, drawrectangle(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4, x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
@ -86,8 +88,10 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font, awesomeconf->statusbar.drawable, awesomeconf->font,
awesomeconf->tags[i].name, awesomeconf->colors_normal); awesomeconf->tags[i].name, awesomeconf->colors_normal);
if(isoccupied(i, awesomeconf->screen)) if(isoccupied(i, awesomeconf->screen))
drawsquare(disp, awesomeconf->phys_screen, drawrectangle(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4, x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
@ -126,8 +130,10 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->font, awesomeconf->statusbar.drawable, awesomeconf->font,
sel->name, awesomeconf->colors_selected); sel->name, awesomeconf->colors_selected);
if(sel->isfloating) if(sel->isfloating)
drawsquare(disp, awesomeconf->phys_screen, drawrectangle(disp, awesomeconf->phys_screen,
x, y, (awesomeconf->font->height + 2) / 4, x, y,
(awesomeconf->font->height + 2) / 4,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,