[widgets] Rename Widget type to widget_t
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e33d6cae80
commit
0cd46ab6b1
2
config.c
2
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;
|
||||
|
||||
|
|
2
event.c
2
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;
|
||||
|
|
|
@ -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;
|
||||
|
|
22
structs.h
22
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 */
|
||||
|
|
20
widget.c
20
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;
|
||||
|
|
8
widget.h
8
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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue