rename a bunch of draw functions

This commit is contained in:
Julien Danjou 2007-12-22 20:17:24 +01:00
parent e72a278080
commit c232576631
8 changed files with 51 additions and 50 deletions

13
draw.c
View File

@ -52,7 +52,7 @@ draw_free_context(DrawCtx *ctx)
} }
void void
drawtext(DrawCtx *ctx, int x, int y, int w, int h, XftFont *font, const char *text, XColor fg, XColor bg) draw_text(DrawCtx *ctx, int x, int y, int w, int h, XftFont *font, const char *text, XColor fg, XColor bg)
{ {
int nw = 0; int nw = 0;
static char buf[256]; static char buf[256];
@ -61,7 +61,7 @@ drawtext(DrawCtx *ctx, int x, int y, int w, int h, XftFont *font, const char *te
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_t *cr; cairo_t *cr;
drawrectangle(ctx, x, y, w, h, True, bg); draw_rectangle(ctx, x, y, w, h, True, bg);
if(!a_strlen(text)) if(!a_strlen(text))
return; return;
@ -100,7 +100,7 @@ drawtext(DrawCtx *ctx, int x, int y, int w, int h, XftFont *font, const char *te
} }
void void
drawrectangle(DrawCtx *ctx, int x, int y, int w, int h, Bool filled, XColor color) draw_rectangle(DrawCtx *ctx, int x, int y, int w, int h, Bool filled, XColor color)
{ {
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_t *cr; cairo_t *cr;
@ -126,7 +126,7 @@ drawrectangle(DrawCtx *ctx, int x, int y, int w, int h, Bool filled, XColor colo
} }
void void
drawcircle(DrawCtx *ctx, int x, int y, int r, Bool filled, XColor color) draw_circle(DrawCtx *ctx, int x, int y, int r, Bool filled, XColor color)
{ {
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_t *cr; cairo_t *cr;
@ -175,7 +175,7 @@ void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
} }
void void
drawimage(DrawCtx *ctx, int x, int y, const char *filename) draw_image(DrawCtx *ctx, int x, int y, const char *filename)
{ {
cairo_surface_t *surface, *source; cairo_surface_t *surface, *source;
cairo_t *cr; cairo_t *cr;
@ -191,7 +191,8 @@ drawimage(DrawCtx *ctx, int x, int y, const char *filename)
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
} }
int draw_get_image_width(const char *filename) int
draw_get_image_width(const char *filename)
{ {
int width; int width;
cairo_surface_t *surface; cairo_surface_t *surface;

8
draw.h
View File

@ -38,10 +38,10 @@ struct DrawCtx
DrawCtx *draw_get_context(Display*, int, int, int); DrawCtx *draw_get_context(Display*, int, int, int);
void draw_free_context(DrawCtx*); void draw_free_context(DrawCtx*);
void drawtext(DrawCtx *, int, int, int, int, XftFont *, const char *, XColor fg, XColor bg); void draw_text(DrawCtx *, int, int, int, int, XftFont *, const char *, XColor fg, XColor bg);
void drawrectangle(DrawCtx *, int, int, int, int, Bool, XColor); void draw_rectangle(DrawCtx *, int, int, int, int, Bool, XColor);
void drawcircle(DrawCtx *, int, int, int, Bool, XColor); void draw_circle(DrawCtx *, int, int, int, Bool, XColor);
void drawimage(DrawCtx *, int, int, const char *); void draw_image(DrawCtx *, int, int, const char *);
void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char *); void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char *);
int draw_get_image_width(const char *filename); int draw_get_image_width(const char *filename);
Drawable draw_rotate(DrawCtx *, int, double, int, int); Drawable draw_rotate(DrawCtx *, int, double, int, int);

View File

@ -48,7 +48,7 @@ statusbar_draw(int screen)
DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen, DrawCtx *ctx = draw_get_context(globalconf.display, phys_screen,
vscreen.statusbar->width, vscreen.statusbar->width,
vscreen.statusbar->height); vscreen.statusbar->height);
drawrectangle(ctx, draw_rectangle(ctx,
0, 0,
0, 0,
vscreen.statusbar->width, vscreen.statusbar->width,

View File

@ -20,18 +20,18 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
if(sel) if(sel)
{ {
drawtext(ctx, location, 0, vscreen.statusbar->width - used, draw_text(ctx, location, 0, vscreen.statusbar->width - used,
vscreen.statusbar->height, vscreen.font, sel->name, vscreen.statusbar->height, vscreen.font, sel->name,
vscreen.colors_selected[ColFG], vscreen.colors_selected[ColFG],
vscreen.colors_selected[ColBG]); vscreen.colors_selected[ColBG]);
if(sel->isfloating) if(sel->isfloating)
drawcircle(ctx, location, 0, draw_circle(ctx, location, 0,
(vscreen.font->height + 2) / 4, (vscreen.font->height + 2) / 4,
sel->ismax, sel->ismax,
vscreen.colors_selected[ColFG]); vscreen.colors_selected[ColFG]);
} }
else else
drawtext(ctx, location, 0, vscreen.statusbar->width - used, draw_text(ctx, location, 0, vscreen.statusbar->width - used,
vscreen.statusbar->height, vscreen.font, NULL, vscreen.statusbar->height, vscreen.font, NULL,
vscreen.colors_normal[ColFG], vscreen.colors_normal[ColFG],
vscreen.colors_normal[ColBG]); vscreen.colors_normal[ColBG]);

View File

@ -39,7 +39,7 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset,
offset, offset,
widget->alignment); widget->alignment);
drawimage(ctx, location, 0, widget->data); draw_image(ctx, location, 0, widget->data);
return width; return width;
} }

View File

@ -41,7 +41,7 @@ layoutinfo_draw(Widget *widget,
width, width,
offset, offset,
widget->alignment); widget->alignment);
drawtext(ctx, location, 0, draw_text(ctx, location, 0,
width, width,
vscreen.statusbar->height, vscreen.statusbar->height,
vscreen.font, vscreen.font,

View File

@ -75,14 +75,14 @@ taglist_draw(Widget *widget,
colors = vscreen.colors_selected; colors = vscreen.colors_selected;
else else
colors = vscreen.colors_normal; colors = vscreen.colors_normal;
drawtext(ctx, location + width, 0, w, draw_text(ctx, location + width, 0, w,
vscreen.statusbar->height, vscreen.statusbar->height,
vscreen.font, vscreen.font,
tag->name, tag->name,
colors[ColFG], colors[ColFG],
colors[ColBG]); colors[ColBG]);
if(isoccupied(widget->statusbar->screen, tag)) if(isoccupied(widget->statusbar->screen, tag))
drawrectangle(ctx, location + width, 0, flagsize, flagsize, draw_rectangle(ctx, location + width, 0, flagsize, flagsize,
sel && is_client_tagged(sel, sel && is_client_tagged(sel,
tag, tag,
widget->statusbar->screen), widget->statusbar->screen),

View File

@ -56,7 +56,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
offset, offset,
widget->alignment); widget->alignment);
drawtext(ctx, location, 0, width, vscreen.statusbar->height, draw_text(ctx, location, 0, width, vscreen.statusbar->height,
vscreen.font, d->text, d->fg, d->bg); vscreen.font, d->text, d->fg, d->bg);
return width; return width;
} }