From 0cd46ab6b161c82a943dc2cfdf1033d39ebc3c27 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 11 Apr 2008 11:26:37 +0200 Subject: [PATCH] [widgets] Rename Widget type to widget_t Signed-off-by: Julien Danjou --- config.c | 2 +- event.c | 2 +- statusbar.c | 4 ++-- structs.h | 22 +++++++++++----------- widget.c | 20 ++++++++++---------- widget.h | 8 ++++---- widgets/common.c | 4 ++-- widgets/common.h | 4 ++-- widgets/emptybox.c | 8 ++++---- widgets/focusicon.c | 8 ++++---- widgets/graph.c | 10 +++++----- widgets/iconbox.c | 10 +++++----- widgets/layoutinfo.c | 8 ++++---- widgets/progressbar.c | 10 +++++----- widgets/taglist.c | 10 +++++----- widgets/tasklist.c | 10 +++++----- widgets/textbox.c | 10 +++++----- 17 files changed, 75 insertions(+), 75 deletions(-) diff --git a/config.c b/config.c index 6af6d83d6..8d754396b 100644 --- a/config.c +++ b/config.c @@ -243,7 +243,7 @@ static void statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar) { cfg_t* widgets, *wptr; - Widget *widget = NULL; + widget_t *widget = NULL; unsigned int i, j, numwidgets = 0; WidgetConstructor *widget_new; diff --git a/event.c b/event.c index d34191e64..c26c87f16 100644 --- a/event.c +++ b/event.c @@ -78,7 +78,7 @@ event_handle_buttonpress(void *data __attribute__ ((unused)), { int screen; Client *c; - Widget *widget; + widget_t *widget; Statusbar *statusbar; xcb_query_pointer_cookie_t qc; xcb_query_pointer_reply_t *qr; diff --git a/statusbar.c b/statusbar.c index 03a3569ef..be92b16f0 100644 --- a/statusbar.c +++ b/statusbar.c @@ -109,7 +109,7 @@ statusbar_position_update(Statusbar *statusbar) static void statusbar_draw(Statusbar *statusbar) { - Widget *widget; + widget_t *widget; int left = 0, right = 0; area_t rectangle = { 0, 0, 0, 0, NULL, NULL }; @@ -263,7 +263,7 @@ statusbar_refresh() { int screen; Statusbar *statusbar; - Widget *widget; + widget_t *widget; for(screen = 0; screen < globalconf.screens_info->nscreen; screen++) for(statusbar = globalconf.screens[screen].statusbar; diff --git a/structs.h b/structs.h index 48a304c54..c5f063905 100644 --- a/structs.h +++ b/structs.h @@ -105,7 +105,7 @@ struct Button Button *prev, *next; }; -/** Widget tell status code */ +/** widget_t tell status code */ typedef enum { WIDGET_NOERROR = 0, @@ -118,19 +118,19 @@ typedef enum WIDGET_ERROR_FORMAT_SECTION } widget_tell_status_t; -/** Widget */ -typedef struct Widget Widget; +/** widget_t */ +typedef struct widget_t widget_t; typedef struct Statusbar Statusbar; -struct Widget +struct widget_t { - /** Widget name */ + /** widget_t name */ char *name; /** Draw function */ - int (*draw)(Widget *, DrawCtx *, int, int); + int (*draw)(widget_t *, DrawCtx *, int, int); /** Update function */ - widget_tell_status_t (*tell)(Widget *, char *, char *); + widget_tell_status_t (*tell)(widget_t *, char *, char *); /** ButtonPressedEvent handler */ - void (*button_press)(Widget *, xcb_button_press_event_t *); + void (*button_press)(widget_t *, xcb_button_press_event_t *); /** Statusbar */ Statusbar *statusbar; /** Alignement */ @@ -151,7 +151,7 @@ struct Widget int flags; } cache; /** Next and previous widgets */ - Widget *prev, *next; + widget_t *prev, *next; }; /** Status bar */ @@ -173,8 +173,8 @@ struct Statusbar int screen; /** Physical screen id */ int phys_screen; - /** Widget list */ - Widget *widgets; + /** widget_t list */ + widget_t *widgets; /** Draw context */ DrawCtx *ctx; /** Next and previous statusbars */ diff --git a/widget.c b/widget.c index 348199a8c..9d14bd73b 100644 --- a/widget.c +++ b/widget.c @@ -34,7 +34,7 @@ extern AwesomeConf globalconf; * \param widget a linked list of all widgets */ void -widget_calculate_alignments(Widget *widget) +widget_calculate_alignments(widget_t *widget) { for(; widget && widget->alignment != AlignFlex; widget = widget->next) { @@ -92,10 +92,10 @@ widget_calculate_offset(int barwidth, int widgetwidth, int offset, int alignment * \param name the widget name * \return a widget */ -static Widget * +static widget_t * widget_getbyname(Statusbar *sb, char *name) { - Widget *widget; + widget_t *widget; for(widget = sb->widgets; widget; widget = widget->next) if(!a_strcmp(name, widget->name)) @@ -110,7 +110,7 @@ widget_getbyname(Statusbar *sb, char *name) * \param ev the XButtonPressedEvent the widget received */ static void -widget_common_button_press(Widget *widget, xcb_button_press_event_t *ev) +widget_common_button_press(widget_t *widget, xcb_button_press_event_t *ev) { Button *b; @@ -129,7 +129,7 @@ widget_common_button_press(Widget *widget, xcb_button_press_event_t *ev) * \return widget_tell_status_t enum (see structs.h) */ static widget_tell_status_t -widget_common_tell(Widget *widget, char *property __attribute__ ((unused)), +widget_common_tell(widget_t *widget, char *property __attribute__ ((unused)), char *command __attribute__ ((unused))) { warn("%s widget does not accept commands.\n", widget->name); @@ -142,7 +142,7 @@ widget_common_tell(Widget *widget, char *property __attribute__ ((unused)), * \param config the cfg_t structure we will parse to set common info */ void -widget_common_new(Widget *widget, Statusbar *statusbar, cfg_t *config) +widget_common_new(widget_t *widget, Statusbar *statusbar, cfg_t *config) { widget->statusbar = statusbar; widget->name = a_strdup(cfg_title(config)); @@ -155,7 +155,7 @@ widget_common_new(Widget *widget, Statusbar *statusbar, cfg_t *config) } /** Invalidate widgets which should be refresh upon - * external modifications. Widget who watch flags will + * external modifications. widget_t who watch flags will * be set to be refreshed. * \param screen screen id * \param flags cache flags @@ -164,7 +164,7 @@ void widget_invalidate_cache(int screen, int flags) { Statusbar *statusbar; - Widget *widget; + widget_t *widget; for(statusbar = globalconf.screens[screen].statusbar; statusbar; @@ -176,14 +176,14 @@ widget_invalidate_cache(int screen, int flags) /** Send commands to widgets. * \param screen Screen ID - * \param arg Widget command. Syntax depends on specific widget. + * \param arg widget_t command. Syntax depends on specific widget. * \ingroup ui_callback */ void uicb_widget_tell(int screen, char *arg) { Statusbar *statusbar; - Widget *widget; + widget_t *widget; char *p, *property = NULL, *command; ssize_t len; widget_tell_status_t status; diff --git a/widget.h b/widget.h index 617b6b576..78bc9f55e 100644 --- a/widget.h +++ b/widget.h @@ -32,12 +32,12 @@ #define WIDGET_CACHE_TAGS 1<<2 #define WIDGET_CACHE_ALL (WIDGET_CACHE_CLIENTS | WIDGET_CACHE_LAYOUTS | WIDGET_CACHE_TAGS) -typedef Widget *(WidgetConstructor)(Statusbar *, cfg_t *); +typedef widget_t *(WidgetConstructor)(Statusbar *, cfg_t *); void widget_invalidate_cache(int, int); int widget_calculate_offset(int, int, int, int); -void widget_calculate_alignments(Widget *); -void widget_common_new(Widget*, Statusbar *, cfg_t *); +void widget_calculate_alignments(widget_t *); +void widget_common_new(widget_t*, Statusbar *, cfg_t *); WidgetConstructor layoutinfo_new; WidgetConstructor taglist_new; @@ -51,7 +51,7 @@ WidgetConstructor tasklist_new; uicb_t uicb_widget_tell; -DO_SLIST(Widget, widget, p_delete) +DO_SLIST(widget_t, widget, p_delete) #endif diff --git a/widgets/common.c b/widgets/common.c index 659785d17..9e66a385f 100644 --- a/widgets/common.c +++ b/widgets/common.c @@ -25,7 +25,7 @@ extern AwesomeConf globalconf; widget_tell_status_t -widget_set_color_for_data(Widget *widget, xcolor_t *color, char *command, int data_items, char ** data_title) +widget_set_color_for_data(widget_t *widget, xcolor_t *color, char *command, int data_items, char ** data_title) { char *title, *setting; int i; @@ -45,7 +45,7 @@ widget_set_color_for_data(Widget *widget, xcolor_t *color, char *command, int da return WIDGET_ERROR_FORMAT_SECTION; } widget_tell_status_t -widget_set_color_pointer_for_data(Widget *widget, xcolor_t **color, char *command, int data_items, char ** data_title) +widget_set_color_pointer_for_data(widget_t *widget, xcolor_t **color, char *command, int data_items, char ** data_title) { char *title, *setting; int i; diff --git a/widgets/common.h b/widgets/common.h index 0abe3228d..980ef2ba6 100644 --- a/widgets/common.h +++ b/widgets/common.h @@ -24,8 +24,8 @@ #define AWESOME_WIDGETS_COMMON_H #include "widget.h" -widget_tell_status_t widget_set_color_for_data(Widget *, xcolor_t *, char *, int, char **); -widget_tell_status_t widget_set_color_pointer_for_data(Widget *, xcolor_t **, char *, int, char **); +widget_tell_status_t widget_set_color_for_data(widget_t *, xcolor_t *, char *, int, char **); +widget_tell_status_t widget_set_color_pointer_for_data(widget_t *, xcolor_t **, char *, int, char **); #endif // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 diff --git a/widgets/emptybox.c b/widgets/emptybox.c index 73d9998b4..bd74e7dad 100644 --- a/widgets/emptybox.c +++ b/widgets/emptybox.c @@ -30,7 +30,7 @@ typedef struct } Data; static int -emptybox_draw(Widget *widget, DrawCtx *ctx, int offset, +emptybox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { Data *d = widget->data; @@ -48,13 +48,13 @@ emptybox_draw(Widget *widget, DrawCtx *ctx, int offset, return widget->area.width; } -Widget * +widget_t * emptybox_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = emptybox_draw; w->alignment = cfg_getalignment(config, "align"); diff --git a/widgets/focusicon.c b/widgets/focusicon.c index 5848fb8c2..274778134 100644 --- a/widgets/focusicon.c +++ b/widgets/focusicon.c @@ -30,7 +30,7 @@ extern AwesomeConf globalconf; static int -focusicon_draw(Widget *widget, DrawCtx *ctx, int offset, +focusicon_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { area_t area; @@ -93,12 +93,12 @@ focusicon_draw(Widget *widget, DrawCtx *ctx, int offset, return widget->area.width; } -Widget * +widget_t * focusicon_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = focusicon_draw; w->alignment = cfg_getalignment(config, "align"); diff --git a/widgets/graph.c b/widgets/graph.c index a50b98796..e1da4f077 100644 --- a/widgets/graph.c +++ b/widgets/graph.c @@ -82,7 +82,7 @@ typedef struct } Data; static int -graph_draw(Widget *widget, DrawCtx *ctx, int offset, +graph_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { int margin_top; @@ -276,7 +276,7 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset, } static widget_tell_status_t -graph_tell(Widget *widget, char *property, char *command) +graph_tell(widget_t *widget, char *property, char *command) { Data *d = widget->data; int i, u; @@ -379,10 +379,10 @@ graph_tell(Widget *widget, char *property, char *command) return WIDGET_NOERROR; } -Widget * +widget_t * graph_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; cfg_t *cfg; char *color; @@ -392,7 +392,7 @@ graph_new(Statusbar *statusbar, cfg_t *config) xcolor_t *ptmp_color_center; xcolor_t *ptmp_color_end; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = graph_draw; diff --git a/widgets/iconbox.c b/widgets/iconbox.c index faea508f8..efc25bd32 100644 --- a/widgets/iconbox.c +++ b/widgets/iconbox.c @@ -32,7 +32,7 @@ typedef struct } Data; static int -iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, +iconbox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { Data *d = widget->data; @@ -65,7 +65,7 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, } static widget_tell_status_t -iconbox_tell(Widget *widget, char *property, char *command) +iconbox_tell(widget_t *widget, char *property, char *command) { bool b; Data *d = widget->data; @@ -92,13 +92,13 @@ iconbox_tell(Widget *widget, char *property, char *command) return WIDGET_NOERROR; } -Widget * +widget_t * iconbox_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->alignment = cfg_getalignment(config, "align"); w->draw = iconbox_draw; diff --git a/widgets/layoutinfo.c b/widgets/layoutinfo.c index 5f1c7cfd7..2a677590c 100644 --- a/widgets/layoutinfo.c +++ b/widgets/layoutinfo.c @@ -29,7 +29,7 @@ extern AwesomeConf globalconf; static int -layoutinfo_draw(Widget *widget, +layoutinfo_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) @@ -58,11 +58,11 @@ layoutinfo_draw(Widget *widget, return widget->area.width; } -Widget * +widget_t * layoutinfo_new(Statusbar *statusbar, cfg_t* config) { - Widget *w; - w = p_new(Widget, 1); + widget_t *w; + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = layoutinfo_draw; w->alignment = cfg_getalignment(config, "align"); diff --git a/widgets/progressbar.c b/widgets/progressbar.c index 839351c93..14b04aabe 100644 --- a/widgets/progressbar.c +++ b/widgets/progressbar.c @@ -117,7 +117,7 @@ check_settings(Data *d, int status_height) static int -progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, +progressbar_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) { /* pb_.. values points to the widget inside a potential border */ @@ -383,7 +383,7 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, } static widget_tell_status_t -progressbar_tell(Widget *widget, char *property, char *command) +progressbar_tell(widget_t *widget, char *property, char *command) { Data *d = widget->data; int i = 0, percent, tmp; @@ -450,17 +450,17 @@ progressbar_tell(Widget *widget, char *property, char *command) return WIDGET_NOERROR; } -Widget * +widget_t * progressbar_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; char *color; int i; cfg_t *cfg; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = progressbar_draw; w->tell = progressbar_tell; diff --git a/widgets/taglist.c b/widgets/taglist.c index 5d0a0c48b..1d3ef1401 100644 --- a/widgets/taglist.c +++ b/widgets/taglist.c @@ -71,7 +71,7 @@ taglist_style_get(VirtScreen vscreen, Tag *tag) } static int -taglist_draw(Widget *widget, +taglist_draw(widget_t *widget, DrawCtx *ctx, int offset, int used __attribute__ ((unused))) @@ -137,7 +137,7 @@ taglist_draw(Widget *widget, } static void -taglist_button_press(Widget *widget, xcb_button_press_event_t *ev) +taglist_button_press(widget_t *widget, xcb_button_press_event_t *ev) { VirtScreen vscreen = globalconf.screens[widget->statusbar->screen]; Button *b; @@ -203,11 +203,11 @@ taglist_button_press(Widget *widget, xcb_button_press_event_t *ev) } } -Widget * +widget_t * taglist_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; - w = p_new(Widget, 1); + widget_t *w; + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = taglist_draw; w->button_press = taglist_button_press; diff --git a/widgets/tasklist.c b/widgets/tasklist.c index cc3d69318..017fb83b9 100644 --- a/widgets/tasklist.c +++ b/widgets/tasklist.c @@ -71,7 +71,7 @@ tasklist_isvisible(Client *c, int screen, ShowClient show) } static int -tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used) +tasklist_draw(widget_t *widget, DrawCtx *ctx, int offset, int used) { Client *c; Data *d = widget->data; @@ -190,7 +190,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used) } static void -tasklist_button_press(Widget *widget, xcb_button_press_event_t *ev) +tasklist_button_press(widget_t *widget, xcb_button_press_event_t *ev) { Button *b; Client *c; @@ -257,15 +257,15 @@ tasklist_button_press(Widget *widget, xcb_button_press_event_t *ev) } } -Widget * +widget_t * tasklist_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; char *buf; cfg_t *cfg_styles; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = tasklist_draw; w->button_press = tasklist_button_press; diff --git a/widgets/textbox.c b/widgets/textbox.c index 65a080a2c..a83989573 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -35,7 +35,7 @@ typedef struct } Data; static int -textbox_draw(Widget *widget, DrawCtx *ctx, int offset, int used) +textbox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used) { Data *d = widget->data; @@ -64,7 +64,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, int used) } static widget_tell_status_t -textbox_tell(Widget *widget, char *property, char *command) +textbox_tell(widget_t *widget, char *property, char *command) { Data *d = widget->data; font_t *newfont; @@ -106,13 +106,13 @@ textbox_tell(Widget *widget, char *property, char *command) return WIDGET_NOERROR; } -Widget * +widget_t * textbox_new(Statusbar *statusbar, cfg_t *config) { - Widget *w; + widget_t *w; Data *d; - w = p_new(Widget, 1); + w = p_new(widget_t, 1); widget_common_new(w, statusbar, config); w->draw = textbox_draw; w->tell = textbox_tell;