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, statusbar->window,
globalconf.cursor[CurNormal]); globalconf.cursor[CurNormal]);
calculate_alignments(statusbar->widgets); widget_calculate_alignments(statusbar->widgets);
statusbar_update_position(globalconf.display, statusbar_update_position(globalconf.display,
statusbar, statusbar,

View File

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

View File

@ -32,9 +32,9 @@ enum { AlignLeft, AlignRight, AlignFlex };
typedef Widget *(WidgetConstructor)(Statusbar *, cfg_t *); typedef Widget *(WidgetConstructor)(Statusbar *, cfg_t *);
int calculate_offset(int, int, int, int); int widget_calculate_offset(int, int, int, int);
void calculate_alignments(Widget *); void widget_calculate_alignments(Widget *);
void common_new(Widget*, Statusbar *, cfg_t *); void widget_common_new(Widget*, Statusbar *, cfg_t *);
WidgetConstructor layoutinfo_new; WidgetConstructor layoutinfo_new;
WidgetConstructor taglist_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]; VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen, Client *sel = focus_get_latest_client_for_tag(widget->statusbar->screen,
get_current_tag(widget->statusbar->screen)); get_current_tag(widget->statusbar->screen));
int location = calculate_offset(vscreen.statusbar->width, int location = widget_calculate_offset(vscreen.statusbar->width,
0, 0,
offset, offset,
widget->alignment); widget->alignment);
if(sel) if(sel)
{ {
@ -43,7 +43,7 @@ focustitle_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; Widget *w;
w = p_new(Widget, 1); w = p_new(Widget, 1);
common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->draw = focustitle_draw; w->draw = focustitle_draw;
w->alignment = AlignFlex; w->alignment = AlignFlex;
return w; return w;

View File

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

View File

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

View File

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

View File

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

View File

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