rename a bunch of widget functions

This commit is contained in:
Julien Danjou 2007-12-22 20:55:17 +01:00
parent c232576631
commit b0a8522466
9 changed files with 41 additions and 41 deletions

View File

@ -170,7 +170,7 @@ statusbar_init(int screen)
statusbar->window,
globalconf.cursor[CurNormal]);
calculate_alignments(statusbar->widgets);
widget_calculate_alignments(statusbar->widgets);
statusbar_update_position(globalconf.display,
statusbar,

View File

@ -38,7 +38,7 @@ const NameFuncLink WidgetList[] =
};
void
calculate_alignments(Widget *widget)
widget_calculate_alignments(Widget *widget)
{
for(; widget; widget = widget->next)
{
@ -61,7 +61,7 @@ calculate_alignments(Widget *widget)
}
int
calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
widget_calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
{
if (alignment == AlignLeft || alignment == AlignFlex)
return offset;
@ -69,7 +69,7 @@ calculate_offset(int barwidth, int widgetwidth, int offset, int alignment)
}
static Widget *
find_widget(char *name, int screen)
widget_find(char *name, int screen)
{
Widget *widget;
widget = globalconf.screens[screen].statusbar->widgets;
@ -80,20 +80,20 @@ find_widget(char *name, int screen)
}
static void
common_tell(Widget *widget, char *command __attribute__ ((unused)))
widget_common_tell(Widget *widget, char *command __attribute__ ((unused)))
{
warn("%s widget does not accept commands.\n", widget->name);
}
void
common_new(Widget *widget, Statusbar *statusbar, cfg_t* config)
widget_common_new(Widget *widget, Statusbar *statusbar, cfg_t* config)
{
const char *name;
widget->statusbar = statusbar;
name = cfg_title(config);
widget->name = p_new(char, strlen(name)+1);
widget->tell = common_tell;
widget->tell = widget_common_tell;
strncpy(widget->name, name, strlen(name));
}
@ -123,7 +123,7 @@ uicb_widget_tell(int screen, char *arg)
return;
}
widget = find_widget(p, screen);
widget = widget_find(p, screen);
if (!widget)
{
warn("No such widget: %s\n", p);

View File

@ -32,9 +32,9 @@ enum { AlignLeft, AlignRight, AlignFlex };
typedef Widget *(WidgetConstructor)(Statusbar *, cfg_t *);
int calculate_offset(int, int, int, int);
void calculate_alignments(Widget *);
void common_new(Widget*, Statusbar *, cfg_t *);
int widget_calculate_offset(int, int, int, int);
void widget_calculate_alignments(Widget *);
void widget_common_new(Widget*, Statusbar *, cfg_t *);
WidgetConstructor layoutinfo_new;
WidgetConstructor taglist_new;

View File

@ -13,10 +13,10 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen,
get_current_tag(widget->statusbar->screen));
int location = calculate_offset(vscreen.statusbar->width,
0,
offset,
widget->alignment);
int location = widget_calculate_offset(vscreen.statusbar->width,
0,
offset,
widget->alignment);
if(sel)
{
@ -43,7 +43,7 @@ focustitle_new(Statusbar *statusbar, cfg_t *config)
{
Widget *w;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = focustitle_draw;
w->alignment = AlignFlex;
return w;

View File

@ -34,10 +34,10 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset,
width = draw_get_image_width(widget->data);
location = calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
location = widget_calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
draw_image(ctx, location, 0, widget->data);
@ -59,7 +59,7 @@ iconbox_new(Statusbar *statusbar, cfg_t *config)
Widget *w;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = iconbox_draw;
w->tell = iconbox_tell;
w->data = (void *) a_strdup(cfg_getstr(config, "image"));

View File

@ -37,10 +37,10 @@ layoutinfo_draw(Widget *widget,
Layout *l;
for(l = vscreen.layouts ; l; l = l->next)
width = MAX(width, (textwidth(ctx, vscreen.font, l->symbol)));
location = calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
location = widget_calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
draw_text(ctx, location, 0,
width,
vscreen.statusbar->height,
@ -56,7 +56,7 @@ layoutinfo_new(Statusbar *statusbar, cfg_t* config)
{
Widget *w;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = (void*) layoutinfo_draw;
return w;
}

View File

@ -78,10 +78,10 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
imgdata[2] = pixel & 0xff; /* B */
}
location = calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
location = widget_calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
draw_image_from_argb_data(ctx, location, 0, width, height, vscreen.statusbar->height, image);
@ -97,7 +97,7 @@ netwmicon_new(Statusbar *statusbar, cfg_t *config)
Widget *w;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = netwmicon_draw;
return w;

View File

@ -62,10 +62,10 @@ taglist_draw(Widget *widget,
for(tag = vscreen.tags; tag; tag = tag->next)
width += textwidth(ctx, vscreen.font, tag->name);
location = calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
location = widget_calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
width = 0;
for(tag = vscreen.tags; tag; tag = tag->next)
@ -97,7 +97,7 @@ taglist_new(Statusbar *statusbar, cfg_t *config)
{
Widget *w;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = taglist_draw;
return w;
}

View File

@ -51,10 +51,10 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
Data *d = widget->data;
width = textwidth(ctx, vscreen.font, d->text);
location = calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
location = widget_calculate_offset(vscreen.statusbar->width,
width,
offset,
widget->alignment);
draw_text(ctx, location, 0, width, vscreen.statusbar->height,
vscreen.font, d->text, d->fg, d->bg);
@ -75,7 +75,7 @@ textbox_new(Statusbar *statusbar, cfg_t *config)
char *color;
w = p_new(Widget, 1);
common_new(w, statusbar, config);
widget_common_new(w, statusbar, config);
w->draw = textbox_draw;
w->tell = textbox_tell;