rename textwidth to draw_textwidth

This commit is contained in:
Julien Danjou 2008-01-06 22:57:23 +01:00
parent bdfb84f3b5
commit 9fa01e34de
4 changed files with 9 additions and 9 deletions

4
draw.c
View File

@ -107,7 +107,7 @@ draw_text(DrawCtx *ctx,
len = sizeof(buf) - 1; len = sizeof(buf) - 1;
memcpy(buf, text, len); memcpy(buf, text, len);
buf[len] = 0; buf[len] = 0;
while(len && (nw = (textwidth(font, buf)) + padding * 2) > w) while(len && (nw = (draw_textwidth(font, buf)) + padding * 2) > w)
buf[--len] = 0; buf[--len] = 0;
if(nw > w) if(nw > w)
return; /* too long */ return; /* too long */
@ -325,7 +325,7 @@ draw_rotate(DrawCtx *ctx, int screen, double angle, int tx, int ty)
} }
unsigned short unsigned short
textwidth(XftFont *font, char *text) draw_textwidth(XftFont *font, char *text)
{ {
cairo_surface_t *surface; cairo_surface_t *surface;
cairo_t *cr; cairo_t *cr;

2
draw.h
View File

@ -62,7 +62,7 @@ void draw_image(DrawCtx *, int, 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 *);
Area draw_get_image_size(const char *filename); Area draw_get_image_size(const char *filename);
Drawable draw_rotate(DrawCtx *, int, double, int, int); Drawable draw_rotate(DrawCtx *, int, double, int, int);
unsigned short textwidth(XftFont *, char *); unsigned short draw_textwidth(XftFont *, char *);
Alignment draw_get_align(const char *); Alignment draw_get_align(const char *);
#endif #endif

View File

@ -73,7 +73,7 @@ taglist_draw(Widget *widget,
widget->area.width = 0; widget->area.width = 0;
for(tag = vscreen.tags; tag; tag = tag->next) for(tag = vscreen.tags; tag; tag = tag->next)
widget->area.width += textwidth(vscreen.font, tag->name) + vscreen.font->height; widget->area.width += draw_textwidth(vscreen.font, tag->name) + vscreen.font->height;
if(!widget->user_supplied_x) if(!widget->user_supplied_x)
widget->area.x = widget_calculate_offset(widget->statusbar->width, widget->area.x = widget_calculate_offset(widget->statusbar->width,
@ -87,7 +87,7 @@ taglist_draw(Widget *widget,
widget->area.width = 0; widget->area.width = 0;
for(tag = vscreen.tags; tag; tag = tag->next) for(tag = vscreen.tags; tag; tag = tag->next)
{ {
w = textwidth(vscreen.font, tag->name) + vscreen.font->height; w = draw_textwidth(vscreen.font, tag->name) + vscreen.font->height;
if(tag->selected) if(tag->selected)
colors = vscreen.colors_selected; colors = vscreen.colors_selected;
else if(isurgent(tag)) else if(isurgent(tag))
@ -132,7 +132,7 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
case Bottom: case Bottom:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
width = textwidth(vscreen.font, tag->name) + vscreen.font->height; width = draw_textwidth(vscreen.font, tag->name) + vscreen.font->height;
if(ev->x >= widget->area.x + prev_width if(ev->x >= widget->area.x + prev_width
&& ev->x < widget->area.x + prev_width + width) && ev->x < widget->area.x + prev_width + width)
{ {
@ -146,7 +146,7 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
case Right: case Right:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
width = textwidth(vscreen.font, tag->name) + vscreen.font->height; width = draw_textwidth(vscreen.font, tag->name) + vscreen.font->height;
if(ev->y >= widget->area.x + prev_width if(ev->y >= widget->area.x + prev_width
&& ev->y < widget->area.x + prev_width + width) && ev->y < widget->area.x + prev_width + width)
{ {
@ -160,7 +160,7 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
default: default:
for(tag = vscreen.tags; tag; tag = tag->next, i++) for(tag = vscreen.tags; tag; tag = tag->next, i++)
{ {
width = textwidth(vscreen.font, tag->name) + vscreen.font->height; width = draw_textwidth(vscreen.font, tag->name) + vscreen.font->height;
if(widget->statusbar->width - ev->y >= widget->area.x + prev_width if(widget->statusbar->width - ev->y >= widget->area.x + prev_width
&& widget->statusbar->width - ev->y < widget->area.x + prev_width + width) && widget->statusbar->width - ev->y < widget->area.x + prev_width + width)
{ {

View File

@ -44,7 +44,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
if(d->width) if(d->width)
widget->area.width = d->width; widget->area.width = d->width;
else else
widget->area.width = textwidth(widget->font, d->text); widget->area.width = draw_textwidth(widget->font, d->text);
widget->area.height = widget->statusbar->height; widget->area.height = widget->statusbar->height;