[draw] Rename DrawCtx to draw_context_t

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-04-28 15:32:30 +02:00
parent 4d64efe64e
commit 33837d77a1
15 changed files with 48 additions and 48 deletions

View File

@ -103,7 +103,7 @@ typedef struct
/** The window */
simple_window_t *sw;
/** The draw contet */
DrawCtx *ctx;
draw_context_t *ctx;
/** Colors */
struct
{

View File

@ -121,7 +121,7 @@ int
main(int argc, char **argv)
{
simple_window_t *sw;
DrawCtx *ctx;
draw_context_t *ctx;
xcb_generic_event_t *ev;
area_t geometry = { 0, 0, 200, 50, NULL, NULL },
icon_geometry = { -1, -1, -1, -1, NULL, NULL };

View File

@ -114,13 +114,13 @@ draw_screen_default_visual(xcb_screen_t *s)
* \param phys_screen physical screen id
* \param width width
* \param height height
* \param dw Drawable object to store in DrawCtx
* \param dw Drawable object to store in draw_context_t
* \return draw context ref
*/
DrawCtx *
draw_context_t *
draw_context_new(xcb_connection_t *conn, int phys_screen, int width, int height, xcb_drawable_t dw)
{
DrawCtx *d = p_new(DrawCtx, 1);
draw_context_t *d = p_new(draw_context_t, 1);
xcb_screen_t *s = xcb_aux_get_screen(conn, phys_screen);
d->connection = conn;
@ -138,10 +138,10 @@ draw_context_new(xcb_connection_t *conn, int phys_screen, int width, int height,
};
/** Delete a draw context
* \param ctx DrawCtx to delete
* \param ctx draw_context_t to delete
*/
void
draw_context_delete(DrawCtx **ctx)
draw_context_delete(draw_context_t **ctx)
{
g_object_unref((*ctx)->layout);
cairo_surface_destroy((*ctx)->surface);
@ -275,13 +275,13 @@ draw_text_markup_expand(draw_parser_data_t *data,
}
/** Draw text into a draw context
* \param ctx DrawCtx to draw to
* \param ctx draw_context_t to draw to
* \param area area to draw to
* \param text text to draw
* \return area_t with width and height are set to what used
*/
void
draw_text(DrawCtx *ctx, area_t area, const char *text, style_t style)
draw_text(draw_context_t *ctx, area_t area, const char *text, style_t style)
{
int x, y;
ssize_t len, olen;
@ -379,7 +379,7 @@ draw_text(DrawCtx *ctx, area_t area, const char *text, style_t style)
* \return pat pattern or NULL; needs to get cairo_pattern_destroy()'ed;
*/
static cairo_pattern_t *
draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
draw_setup_cairo_color_source(draw_context_t *ctx, area_t rect,
xcolor_t *pcolor, xcolor_t *pcolor_center,
xcolor_t *pcolor_end)
{
@ -419,7 +419,7 @@ draw_setup_cairo_color_source(DrawCtx *ctx, area_t rect,
* \param color color to use
*/
void
draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, bool filled, xcolor_t color)
draw_rectangle(draw_context_t *ctx, area_t geometry, float line_width, bool filled, xcolor_t color)
{
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width(ctx->cr, line_width);
@ -455,7 +455,7 @@ draw_rectangle(DrawCtx *ctx, area_t geometry, float line_width, bool filled, xco
* \param pcolor_end color at pattern_start + pattern_width
*/
void
draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, float line_width, bool filled,
draw_rectangle_gradient(draw_context_t *ctx, area_t geometry, float line_width, bool filled,
area_t pattern_rect, xcolor_t *pcolor,
xcolor_t *pcolor_center, xcolor_t *pcolor_end)
{
@ -487,7 +487,7 @@ draw_rectangle_gradient(DrawCtx *ctx, area_t geometry, float line_width, bool fi
* \param ctx Draw context
*/
void
draw_graph_setup(DrawCtx *ctx)
draw_graph_setup(draw_context_t *ctx)
{
cairo_set_antialias(ctx->cr, CAIRO_ANTIALIAS_NONE);
cairo_set_line_width(ctx->cr, 1.0);
@ -511,7 +511,7 @@ draw_graph_setup(DrawCtx *ctx)
* \param pcolor_end color at the right
*/
void
draw_graph(DrawCtx *ctx, area_t rect, int *from, int *to, int cur_index,
draw_graph(draw_context_t *ctx, area_t rect, int *from, int *to, int cur_index,
position_t grow, area_t patt_rect,
xcolor_t *pcolor, xcolor_t *pcolor_center, xcolor_t *pcolor_end)
{
@ -571,7 +571,7 @@ draw_graph(DrawCtx *ctx, area_t rect, int *from, int *to, int cur_index,
* \param pcolor_end color at the right
*/
void
draw_graph_line(DrawCtx *ctx, area_t rect, int *to, int cur_index,
draw_graph_line(draw_context_t *ctx, area_t rect, int *to, int cur_index,
position_t grow, area_t patt_rect,
xcolor_t *pcolor, xcolor_t *pcolor_center, xcolor_t *pcolor_end)
{
@ -645,7 +645,7 @@ draw_graph_line(DrawCtx *ctx, area_t rect, int *to, int cur_index,
* \param color color to use
*/
void
draw_circle(DrawCtx *ctx, int x, int y, int r, bool filled, xcolor_t color)
draw_circle(draw_context_t *ctx, int x, int y, int r, bool filled, xcolor_t color)
{
cairo_set_line_width(ctx->cr, 1.0);
cairo_set_source_rgb(ctx->cr, color.red / 65535.0, color.green / 65535.0, color.blue / 65535.0);
@ -674,7 +674,7 @@ draw_circle(DrawCtx *ctx, int x, int y, int r, bool filled, xcolor_t color)
* \param wanted_h wanted height: if > 0, image will be resized
* \param data the image pixels array
*/
void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
void draw_image_from_argb_data(draw_context_t *ctx, int x, int y, int w, int h,
int wanted_h, unsigned char *data)
{
double ratio;
@ -713,7 +713,7 @@ void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
* \param filename file name to draw
*/
void
draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
draw_image(draw_context_t *ctx, int x, int y, int wanted_h, const char *filename)
{
double ratio;
@ -816,7 +816,7 @@ draw_imlib_load_strerror(Imlib_Load_Error e)
* \param filename file name to draw
*/
void
draw_image(DrawCtx *ctx, int x, int y, int wanted_h, const char *filename)
draw_image(draw_context_t *ctx, int x, int y, int wanted_h, const char *filename)
{
int w, h, size, i;
DATA32 *data;
@ -892,7 +892,7 @@ draw_get_image_size(const char *filename)
* \return new rotated drawable
*/
void
draw_rotate(DrawCtx *ctx, xcb_drawable_t dest, int dest_w, int dest_h,
draw_rotate(draw_context_t *ctx, xcb_drawable_t dest, int dest_w, int dest_h,
double angle, int tx, int ty)
{
cairo_surface_t *surface, *source;

View File

@ -117,26 +117,26 @@ typedef struct
cairo_t *cr;
cairo_surface_t *surface;
PangoLayout *layout;
} DrawCtx;
} draw_context_t;
DrawCtx *draw_context_new(xcb_connection_t *, int, int, int, xcb_drawable_t);
void draw_context_delete(DrawCtx **);
draw_context_t *draw_context_new(xcb_connection_t *, int, int, int, xcb_drawable_t);
void draw_context_delete(draw_context_t **);
font_t *draw_font_new(xcb_connection_t *, int, char *);
void draw_font_delete(font_t **);
void draw_text(DrawCtx *, area_t, const char *, style_t);
void draw_rectangle(DrawCtx *, area_t, float, bool, xcolor_t);
void draw_rectangle_gradient(DrawCtx *, area_t, float, bool, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_text(draw_context_t *, area_t, const char *, style_t);
void draw_rectangle(draw_context_t *, area_t, float, bool, xcolor_t);
void draw_rectangle_gradient(draw_context_t *, area_t, float, bool, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_graph_setup(DrawCtx *);
void draw_graph(DrawCtx *, area_t, int *, int *, int, position_t, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_graph_line(DrawCtx *, area_t, int *, int, position_t, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_circle(DrawCtx *, int, int, int, bool, xcolor_t);
void draw_image(DrawCtx *, int, int, int, const char *);
void draw_image_from_argb_data(DrawCtx *, int, int, int, int, int, unsigned char *);
void draw_graph_setup(draw_context_t *);
void draw_graph(draw_context_t *, area_t, int *, int *, int, position_t, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_graph_line(draw_context_t *, area_t, int *, int, position_t, area_t, xcolor_t *, xcolor_t *, xcolor_t *);
void draw_circle(draw_context_t *, int, int, int, bool, xcolor_t);
void draw_image(draw_context_t *, int, int, int, const char *);
void draw_image_from_argb_data(draw_context_t *, int, int, int, int, int, unsigned char *);
area_t draw_get_image_size(const char *filename);
void draw_rotate(DrawCtx *, xcb_drawable_t, int, int, double, int, int);
void draw_rotate(draw_context_t *, xcb_drawable_t, int, int, double, int, int);
area_t draw_text_extents(xcb_connection_t *, int, font_t *, const char *);
alignment_t draw_align_get_from_str(const char *);
bool draw_color_new(xcb_connection_t *, int, const char *, xcolor_t *);

View File

@ -138,7 +138,7 @@ mouse_snapclient(client_t *c, area_t geometry)
* \param border the client border size
*/
static void
mouse_resizebar_draw(DrawCtx *ctx, style_t style, simple_window_t *sw, area_t geometry, int border)
mouse_resizebar_draw(draw_context_t *ctx, style_t style, simple_window_t *sw, area_t geometry, int border)
{
area_t draw_geometry = { 0, 0, ctx->width, ctx->height, NULL, NULL };
char size[64];
@ -160,7 +160,7 @@ mouse_resizebar_draw(DrawCtx *ctx, style_t style, simple_window_t *sw, area_t ge
* \param ctx drawctx to create
*/
static simple_window_t *
mouse_resizebar_new(int phys_screen, int border, area_t geometry, style_t style, DrawCtx **ctx)
mouse_resizebar_new(int phys_screen, int border, area_t geometry, style_t style, draw_context_t **ctx)
{
simple_window_t *sw;
area_t geom;
@ -199,7 +199,7 @@ uicb_client_movemouse(int screen, char *arg __attribute__ ((unused)))
client_t *c = globalconf.focus->client, *target;
Layout *layout = layout_get_current(screen);
simple_window_t *sw = NULL;
DrawCtx *ctx;
draw_context_t *ctx;
style_t style;
xcb_generic_event_t *ev = NULL;
xcb_motion_notify_event_t *ev_motion = NULL;
@ -329,7 +329,7 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
area_t area = { 0, 0, 0, 0, NULL, NULL }, geometry = { 0, 0, 0, 0, NULL, NULL };
double mwfact;
simple_window_t *sw = NULL;
DrawCtx *ctx = NULL;
draw_context_t *ctx = NULL;
style_t style;
xcb_grab_pointer_cookie_t grab_pointer_c;
xcb_grab_pointer_reply_t *grab_pointer_r = NULL;

View File

@ -119,7 +119,7 @@ struct widget_t
/** widget_t name */
char *name;
/** Draw function */
int (*draw)(widget_t *, DrawCtx *, int, int);
int (*draw)(widget_t *, draw_context_t *, int, int);
/** Update function */
widget_tell_status_t (*tell)(widget_t *, char *, char *);
/** ButtonPressedEvent handler */
@ -169,7 +169,7 @@ struct statusbar_t
/** widget_t list */
widget_t *widgets;
/** Draw context */
DrawCtx *ctx;
draw_context_t *ctx;
/** Next and previous statusbars */
statusbar_t *prev, *next;
};

View File

@ -175,7 +175,7 @@ void
titlebar_draw(client_t *c)
{
xcb_drawable_t dw = 0;
DrawCtx *ctx;
draw_context_t *ctx;
area_t geometry;
xcb_screen_t *s;
char *text;

View File

@ -30,7 +30,7 @@
extern AwesomeConf globalconf;
static int
focusicon_draw(widget_t *widget, DrawCtx *ctx, int offset,
focusicon_draw(widget_t *widget, draw_context_t *ctx, int offset,
int used __attribute__ ((unused)))
{
area_t area;

View File

@ -82,7 +82,7 @@ typedef struct
} Data;
static int
graph_draw(widget_t *widget, DrawCtx *ctx, int offset,
graph_draw(widget_t *widget, draw_context_t *ctx, int offset,
int used __attribute__ ((unused)))
{
int margin_top;

View File

@ -32,7 +32,7 @@ typedef struct
} Data;
static int
iconbox_draw(widget_t *widget, DrawCtx *ctx, int offset,
iconbox_draw(widget_t *widget, draw_context_t *ctx, int offset,
int used __attribute__ ((unused)))
{
Data *d = widget->data;

View File

@ -30,7 +30,7 @@ extern AwesomeConf globalconf;
static int
layoutinfo_draw(widget_t *widget,
DrawCtx *ctx,
draw_context_t *ctx,
int offset,
int used __attribute__ ((unused)))
{

View File

@ -117,7 +117,7 @@ check_settings(Data *d, int status_height)
static int
progressbar_draw(widget_t *widget, DrawCtx *ctx, int offset,
progressbar_draw(widget_t *widget, draw_context_t *ctx, int offset,
int used __attribute__ ((unused)))
{
/* pb_.. values points to the widget inside a potential border */

View File

@ -94,7 +94,7 @@ taglist_text_get(tag_t *tag, taglist_data_t *data)
static int
taglist_draw(widget_t *widget,
DrawCtx *ctx,
draw_context_t *ctx,
int offset,
int used __attribute__ ((unused)))
{

View File

@ -65,7 +65,7 @@ tasklist_isvisible(client_t *c, int screen, showclient_t show)
}
static int
tasklist_draw(widget_t *widget, DrawCtx *ctx, int offset, int used)
tasklist_draw(widget_t *widget, draw_context_t *ctx, int offset, int used)
{
client_t *c;
Data *d = widget->data;

View File

@ -33,7 +33,7 @@ typedef struct
} Data;
static int
textbox_draw(widget_t *widget, DrawCtx *ctx, int offset, int used)
textbox_draw(widget_t *widget, draw_context_t *ctx, int offset, int used)
{
Data *d = widget->data;