[widgets] Rename Widget type to widget_t

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-11 11:26:37 +02:00
parent e33d6cae80
commit 0cd46ab6b1
17 changed files with 75 additions and 75 deletions

View File

@ -243,7 +243,7 @@ static void
statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar) statusbar_widgets_create(cfg_t *cfg_statusbar, Statusbar *statusbar)
{ {
cfg_t* widgets, *wptr; cfg_t* widgets, *wptr;
Widget *widget = NULL; widget_t *widget = NULL;
unsigned int i, j, numwidgets = 0; unsigned int i, j, numwidgets = 0;
WidgetConstructor *widget_new; WidgetConstructor *widget_new;

View File

@ -78,7 +78,7 @@ event_handle_buttonpress(void *data __attribute__ ((unused)),
{ {
int screen; int screen;
Client *c; Client *c;
Widget *widget; widget_t *widget;
Statusbar *statusbar; Statusbar *statusbar;
xcb_query_pointer_cookie_t qc; xcb_query_pointer_cookie_t qc;
xcb_query_pointer_reply_t *qr; xcb_query_pointer_reply_t *qr;

View File

@ -109,7 +109,7 @@ statusbar_position_update(Statusbar *statusbar)
static void static void
statusbar_draw(Statusbar *statusbar) statusbar_draw(Statusbar *statusbar)
{ {
Widget *widget; widget_t *widget;
int left = 0, right = 0; int left = 0, right = 0;
area_t rectangle = { 0, 0, 0, 0, NULL, NULL }; area_t rectangle = { 0, 0, 0, 0, NULL, NULL };
@ -263,7 +263,7 @@ statusbar_refresh()
{ {
int screen; int screen;
Statusbar *statusbar; Statusbar *statusbar;
Widget *widget; widget_t *widget;
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++) for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
for(statusbar = globalconf.screens[screen].statusbar; for(statusbar = globalconf.screens[screen].statusbar;

View File

@ -105,7 +105,7 @@ struct Button
Button *prev, *next; Button *prev, *next;
}; };
/** Widget tell status code */ /** widget_t tell status code */
typedef enum typedef enum
{ {
WIDGET_NOERROR = 0, WIDGET_NOERROR = 0,
@ -118,19 +118,19 @@ typedef enum
WIDGET_ERROR_FORMAT_SECTION WIDGET_ERROR_FORMAT_SECTION
} widget_tell_status_t; } widget_tell_status_t;
/** Widget */ /** widget_t */
typedef struct Widget Widget; typedef struct widget_t widget_t;
typedef struct Statusbar Statusbar; typedef struct Statusbar Statusbar;
struct Widget struct widget_t
{ {
/** Widget name */ /** widget_t name */
char *name; char *name;
/** Draw function */ /** Draw function */
int (*draw)(Widget *, DrawCtx *, int, int); int (*draw)(widget_t *, DrawCtx *, int, int);
/** Update function */ /** Update function */
widget_tell_status_t (*tell)(Widget *, char *, char *); widget_tell_status_t (*tell)(widget_t *, char *, char *);
/** ButtonPressedEvent handler */ /** ButtonPressedEvent handler */
void (*button_press)(Widget *, xcb_button_press_event_t *); void (*button_press)(widget_t *, xcb_button_press_event_t *);
/** Statusbar */ /** Statusbar */
Statusbar *statusbar; Statusbar *statusbar;
/** Alignement */ /** Alignement */
@ -151,7 +151,7 @@ struct Widget
int flags; int flags;
} cache; } cache;
/** Next and previous widgets */ /** Next and previous widgets */
Widget *prev, *next; widget_t *prev, *next;
}; };
/** Status bar */ /** Status bar */
@ -173,8 +173,8 @@ struct Statusbar
int screen; int screen;
/** Physical screen id */ /** Physical screen id */
int phys_screen; int phys_screen;
/** Widget list */ /** widget_t list */
Widget *widgets; widget_t *widgets;
/** Draw context */ /** Draw context */
DrawCtx *ctx; DrawCtx *ctx;
/** Next and previous statusbars */ /** Next and previous statusbars */

View File

@ -34,7 +34,7 @@ extern AwesomeConf globalconf;
* \param widget a linked list of all widgets * \param widget a linked list of all widgets
*/ */
void void
widget_calculate_alignments(Widget *widget) widget_calculate_alignments(widget_t *widget)
{ {
for(; widget && widget->alignment != AlignFlex; widget = widget->next) 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 * \param name the widget name
* \return a widget * \return a widget
*/ */
static Widget * static widget_t *
widget_getbyname(Statusbar *sb, char *name) widget_getbyname(Statusbar *sb, char *name)
{ {
Widget *widget; widget_t *widget;
for(widget = sb->widgets; widget; widget = widget->next) for(widget = sb->widgets; widget; widget = widget->next)
if(!a_strcmp(name, widget->name)) if(!a_strcmp(name, widget->name))
@ -110,7 +110,7 @@ widget_getbyname(Statusbar *sb, char *name)
* \param ev the XButtonPressedEvent the widget received * \param ev the XButtonPressedEvent the widget received
*/ */
static void 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; 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) * \return widget_tell_status_t enum (see structs.h)
*/ */
static widget_tell_status_t 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))) char *command __attribute__ ((unused)))
{ {
warn("%s widget does not accept commands.\n", widget->name); 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 * \param config the cfg_t structure we will parse to set common info
*/ */
void 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->statusbar = statusbar;
widget->name = a_strdup(cfg_title(config)); 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 /** 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. * be set to be refreshed.
* \param screen screen id * \param screen screen id
* \param flags cache flags * \param flags cache flags
@ -164,7 +164,7 @@ void
widget_invalidate_cache(int screen, int flags) widget_invalidate_cache(int screen, int flags)
{ {
Statusbar *statusbar; Statusbar *statusbar;
Widget *widget; widget_t *widget;
for(statusbar = globalconf.screens[screen].statusbar; for(statusbar = globalconf.screens[screen].statusbar;
statusbar; statusbar;
@ -176,14 +176,14 @@ widget_invalidate_cache(int screen, int flags)
/** Send commands to widgets. /** Send commands to widgets.
* \param screen Screen ID * \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 * \ingroup ui_callback
*/ */
void void
uicb_widget_tell(int screen, char *arg) uicb_widget_tell(int screen, char *arg)
{ {
Statusbar *statusbar; Statusbar *statusbar;
Widget *widget; widget_t *widget;
char *p, *property = NULL, *command; char *p, *property = NULL, *command;
ssize_t len; ssize_t len;
widget_tell_status_t status; widget_tell_status_t status;

View File

@ -32,12 +32,12 @@
#define WIDGET_CACHE_TAGS 1<<2 #define WIDGET_CACHE_TAGS 1<<2
#define WIDGET_CACHE_ALL (WIDGET_CACHE_CLIENTS | WIDGET_CACHE_LAYOUTS | WIDGET_CACHE_TAGS) #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); void widget_invalidate_cache(int, int);
int widget_calculate_offset(int, int, int, int); int widget_calculate_offset(int, int, int, int);
void widget_calculate_alignments(Widget *); void widget_calculate_alignments(widget_t *);
void widget_common_new(Widget*, Statusbar *, cfg_t *); void widget_common_new(widget_t*, Statusbar *, cfg_t *);
WidgetConstructor layoutinfo_new; WidgetConstructor layoutinfo_new;
WidgetConstructor taglist_new; WidgetConstructor taglist_new;
@ -51,7 +51,7 @@ WidgetConstructor tasklist_new;
uicb_t uicb_widget_tell; uicb_t uicb_widget_tell;
DO_SLIST(Widget, widget, p_delete) DO_SLIST(widget_t, widget, p_delete)
#endif #endif

View File

@ -25,7 +25,7 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
widget_tell_status_t 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; char *title, *setting;
int i; 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; return WIDGET_ERROR_FORMAT_SECTION;
} }
widget_tell_status_t 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; char *title, *setting;
int i; int i;

View File

@ -24,8 +24,8 @@
#define AWESOME_WIDGETS_COMMON_H #define AWESOME_WIDGETS_COMMON_H
#include "widget.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_for_data(widget_t *, 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_pointer_for_data(widget_t *, xcolor_t **, char *, int, char **);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -30,7 +30,7 @@ typedef struct
} Data; } Data;
static int static int
emptybox_draw(Widget *widget, DrawCtx *ctx, int offset, emptybox_draw(widget_t *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
{ {
Data *d = widget->data; Data *d = widget->data;
@ -48,13 +48,13 @@ emptybox_draw(Widget *widget, DrawCtx *ctx, int offset,
return widget->area.width; return widget->area.width;
} }
Widget * widget_t *
emptybox_new(Statusbar *statusbar, cfg_t *config) emptybox_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->draw = emptybox_draw; w->draw = emptybox_draw;
w->alignment = cfg_getalignment(config, "align"); w->alignment = cfg_getalignment(config, "align");

View File

@ -30,7 +30,7 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
static int static int
focusicon_draw(Widget *widget, DrawCtx *ctx, int offset, focusicon_draw(widget_t *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
{ {
area_t area; area_t area;
@ -93,12 +93,12 @@ focusicon_draw(Widget *widget, DrawCtx *ctx, int offset,
return widget->area.width; return widget->area.width;
} }
Widget * widget_t *
focusicon_new(Statusbar *statusbar, cfg_t *config) 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); widget_common_new(w, statusbar, config);
w->draw = focusicon_draw; w->draw = focusicon_draw;
w->alignment = cfg_getalignment(config, "align"); w->alignment = cfg_getalignment(config, "align");

View File

@ -82,7 +82,7 @@ typedef struct
} Data; } Data;
static int static int
graph_draw(Widget *widget, DrawCtx *ctx, int offset, graph_draw(widget_t *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
{ {
int margin_top; int margin_top;
@ -276,7 +276,7 @@ graph_draw(Widget *widget, DrawCtx *ctx, int offset,
} }
static widget_tell_status_t 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; Data *d = widget->data;
int i, u; int i, u;
@ -379,10 +379,10 @@ graph_tell(Widget *widget, char *property, char *command)
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }
Widget * widget_t *
graph_new(Statusbar *statusbar, cfg_t *config) graph_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
cfg_t *cfg; cfg_t *cfg;
char *color; char *color;
@ -392,7 +392,7 @@ graph_new(Statusbar *statusbar, cfg_t *config)
xcolor_t *ptmp_color_center; xcolor_t *ptmp_color_center;
xcolor_t *ptmp_color_end; xcolor_t *ptmp_color_end;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->draw = graph_draw; w->draw = graph_draw;

View File

@ -32,7 +32,7 @@ typedef struct
} Data; } Data;
static int static int
iconbox_draw(Widget *widget, DrawCtx *ctx, int offset, iconbox_draw(widget_t *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
{ {
Data *d = widget->data; Data *d = widget->data;
@ -65,7 +65,7 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset,
} }
static widget_tell_status_t static widget_tell_status_t
iconbox_tell(Widget *widget, char *property, char *command) iconbox_tell(widget_t *widget, char *property, char *command)
{ {
bool b; bool b;
Data *d = widget->data; Data *d = widget->data;
@ -92,13 +92,13 @@ iconbox_tell(Widget *widget, char *property, char *command)
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }
Widget * widget_t *
iconbox_new(Statusbar *statusbar, cfg_t *config) iconbox_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->alignment = cfg_getalignment(config, "align"); w->alignment = cfg_getalignment(config, "align");
w->draw = iconbox_draw; w->draw = iconbox_draw;

View File

@ -29,7 +29,7 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
static int static int
layoutinfo_draw(Widget *widget, layoutinfo_draw(widget_t *widget,
DrawCtx *ctx, DrawCtx *ctx,
int offset, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
@ -58,11 +58,11 @@ layoutinfo_draw(Widget *widget,
return widget->area.width; return widget->area.width;
} }
Widget * widget_t *
layoutinfo_new(Statusbar *statusbar, cfg_t* config) layoutinfo_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); widget_common_new(w, statusbar, config);
w->draw = layoutinfo_draw; w->draw = layoutinfo_draw;
w->alignment = cfg_getalignment(config, "align"); w->alignment = cfg_getalignment(config, "align");

View File

@ -117,7 +117,7 @@ check_settings(Data *d, int status_height)
static int static int
progressbar_draw(Widget *widget, DrawCtx *ctx, int offset, progressbar_draw(widget_t *widget, DrawCtx *ctx, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
{ {
/* pb_.. values points to the widget inside a potential border */ /* 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 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; Data *d = widget->data;
int i = 0, percent, tmp; int i = 0, percent, tmp;
@ -450,17 +450,17 @@ progressbar_tell(Widget *widget, char *property, char *command)
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }
Widget * widget_t *
progressbar_new(Statusbar *statusbar, cfg_t *config) progressbar_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
char *color; char *color;
int i; int i;
cfg_t *cfg; cfg_t *cfg;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->draw = progressbar_draw; w->draw = progressbar_draw;
w->tell = progressbar_tell; w->tell = progressbar_tell;

View File

@ -71,7 +71,7 @@ taglist_style_get(VirtScreen vscreen, Tag *tag)
} }
static int static int
taglist_draw(Widget *widget, taglist_draw(widget_t *widget,
DrawCtx *ctx, DrawCtx *ctx,
int offset, int offset,
int used __attribute__ ((unused))) int used __attribute__ ((unused)))
@ -137,7 +137,7 @@ taglist_draw(Widget *widget,
} }
static void 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]; VirtScreen vscreen = globalconf.screens[widget->statusbar->screen];
Button *b; 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) taglist_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); widget_common_new(w, statusbar, config);
w->draw = taglist_draw; w->draw = taglist_draw;
w->button_press = taglist_button_press; w->button_press = taglist_button_press;

View File

@ -71,7 +71,7 @@ tasklist_isvisible(Client *c, int screen, ShowClient show)
} }
static int 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; Client *c;
Data *d = widget->data; Data *d = widget->data;
@ -190,7 +190,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
} }
static void 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; Button *b;
Client *c; 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) tasklist_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
char *buf; char *buf;
cfg_t *cfg_styles; cfg_t *cfg_styles;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_common_new(w, statusbar, config); widget_common_new(w, statusbar, config);
w->draw = tasklist_draw; w->draw = tasklist_draw;
w->button_press = tasklist_button_press; w->button_press = tasklist_button_press;

View File

@ -35,7 +35,7 @@ typedef struct
} Data; } Data;
static int 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; Data *d = widget->data;
@ -64,7 +64,7 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
} }
static widget_tell_status_t 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; Data *d = widget->data;
font_t *newfont; font_t *newfont;
@ -106,13 +106,13 @@ textbox_tell(Widget *widget, char *property, char *command)
return WIDGET_NOERROR; return WIDGET_NOERROR;
} }
Widget * widget_t *
textbox_new(Statusbar *statusbar, cfg_t *config) textbox_new(Statusbar *statusbar, cfg_t *config)
{ {
Widget *w; widget_t *w;
Data *d; Data *d;
w = p_new(Widget, 1); w = p_new(widget_t, 1);
widget_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;