[widget] Remove useless drawing args

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-03 16:08:33 +02:00
parent 26632ae48c
commit 807c5bf208
8 changed files with 43 additions and 43 deletions

View File

@ -119,16 +119,16 @@ statusbar_draw(statusbar_t *statusbar)
for(w = statusbar->widgets; w; w = w->next)
if(w->widget->isvisible && w->widget->align == AlignLeft)
left += w->widget->draw(statusbar->ctx, statusbar->screen, w, statusbar->width, statusbar->height, left, (left + right), statusbar);
left += w->widget->draw(statusbar->ctx, statusbar->screen, w, left, (left + right), statusbar);
/* renders right widget from last to first */
for(w = *widget_node_list_last(&statusbar->widgets); w; w = w->prev)
if(w->widget->isvisible && w->widget->align == AlignRight)
right += w->widget->draw(statusbar->ctx, statusbar->screen, w, statusbar->width, statusbar->height, right, (left + right), statusbar);
right += w->widget->draw(statusbar->ctx, statusbar->screen, w, right, (left + right), statusbar);
for(w = statusbar->widgets; w; w = w->next)
if(w->widget->isvisible && w->widget->align == AlignFlex)
left += w->widget->draw(statusbar->ctx, statusbar->screen, w, statusbar->width, statusbar->height, left, (left + right), statusbar);
left += w->widget->draw(statusbar->ctx, statusbar->screen, w, left, (left + right), statusbar);
switch(statusbar->position)
{

View File

@ -136,7 +136,7 @@ struct widget_t
/** widget_t name */
char *name;
/** Draw function */
int (*draw)(draw_context_t *, int, widget_node_t *, int, int, int, int, void *);
int (*draw)(draw_context_t *, int, widget_node_t *, int, int, void *);
/** Update function */
widget_tell_status_t (*tell)(widget_t *, const char *, const char *);
/** ButtonPressedEvent handler */

View File

@ -137,7 +137,7 @@ static int
graph_draw(draw_context_t *ctx,
int screen __attribute__ ((unused)),
widget_node_t *w,
int width, int height, int offset,
int offset,
int used __attribute__ ((unused)),
void *p __attribute__ ((unused)))
{
@ -149,16 +149,16 @@ graph_draw(draw_context_t *ctx,
if(!d->data_items)
return 0;
w->area.x = widget_calculate_offset(width,
w->area.x = widget_calculate_offset(ctx->width,
d->width, offset,
w->widget->align);
w->area.y = 0;
/* box = the graph inside the rectangle */
if(!(d->box_height))
d->box_height = (int) (height * d->height + 0.5) - 2;
d->box_height = (int) (ctx->height * d->height + 0.5) - 2;
margin_top = (int)((height - (d->box_height + 2)) / 2 + 0.5) + w->area.y;
margin_top = (int)((ctx->height - (d->box_height + 2)) / 2 + 0.5) + w->area.y;
/* draw background */
rectangle.x = w->area.x + 1;
@ -328,7 +328,7 @@ graph_draw(draw_context_t *ctx,
draw_rectangle(ctx, rectangle, 1.0, false, d->bordercolor);
w->area.width = d->width;
w->area.height = height;
w->area.height = ctx->height;
return w->area.width;
}

View File

@ -31,7 +31,7 @@ typedef struct
static int
iconbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
widget_node_t *w,
int width, int height, int offset,
int offset,
int used __attribute__ ((unused)),
void *p __attribute__ ((unused)))
{
@ -43,16 +43,16 @@ iconbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
return (w->area.width = 0);
if(d->resize)
w->area.width = ((double) height / area.height) * area.width;
w->area.width = ((double) ctx->height / area.height) * area.width;
else
w->area.width = area.width;
if(w->area.width > width - used)
if(w->area.width > ctx->width - used)
return (w->area.width = 0);
w->area.height = height;
w->area.height = ctx->height;
w->area.x = widget_calculate_offset(width,
w->area.x = widget_calculate_offset(ctx->width,
w->area.width,
offset,
w->widget->align);
@ -60,7 +60,7 @@ iconbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
w->area.y = 0;
draw_image(ctx, w->area.x, w->area.y,
d->resize ? height : 0, d->image);
d->resize ? ctx->height : 0, d->image);
return w->area.width;
}

View File

@ -123,7 +123,7 @@ static int
progressbar_draw(draw_context_t *ctx,
int screen __attribute__ ((unused)),
widget_node_t *w,
int width, int height, int offset,
int offset,
int used __attribute__ ((unused)),
void *p __attribute__ ((unused)))
{
@ -155,7 +155,7 @@ progressbar_draw(draw_context_t *ctx,
w->area.width = pb_width + 2 * (d->border_width + d->border_padding);
}
w->area.x = widget_calculate_offset(width,
w->area.x = widget_calculate_offset(ctx->width,
w->area.width,
offset,
w->widget->align);
@ -179,7 +179,7 @@ progressbar_draw(draw_context_t *ctx,
{
/** \todo maybe prevent to calculate that stuff below over and over again
* (->use static-values) */
pb_height = (int) (height * d->height + 0.5)
pb_height = (int) (ctx->height * d->height + 0.5)
- 2 * (d->border_width + d->border_padding);
if(d->ticks_count && d->ticks_gap)
{
@ -188,7 +188,7 @@ progressbar_draw(draw_context_t *ctx,
pb_height = unit * d->ticks_count - d->ticks_gap;
}
pb_y = w->area.y + ((int) (height * (1 - d->height)) / 2)
pb_y = w->area.y + ((int) (ctx->height * (1 - d->height)) / 2)
+ d->border_width + d->border_padding;
for(i = 0; i < d->data_items; i++)
@ -289,10 +289,10 @@ progressbar_draw(draw_context_t *ctx,
}
else /* a horizontal progressbar */
{
pb_height = (int) ((height * d->height
pb_height = (int) ((ctx->height * d->height
- d->data_items * 2 * (d->border_width + d->border_padding)
- (d->gap * (d->data_items - 1))) / d->data_items + 0.5);
pb_y = w->area.y + ((int) (height * (1 - d->height)) / 2)
pb_y = w->area.y + ((int) (ctx->height * (1 - d->height)) / 2)
+ d->border_width + d->border_padding;
for(i = 0; i < d->data_items; i++)
@ -389,7 +389,7 @@ progressbar_draw(draw_context_t *ctx,
}
}
w->area.height = height;
w->area.height = ctx->height;
return w->area.width;
}

View File

@ -115,7 +115,7 @@ taglist_text_get(tag_t *tag, taglist_data_t *data)
static int
taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
int width, int height, int offset,
int offset,
int used __attribute__ ((unused)),
void *object)
{
@ -159,7 +159,7 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
}
/* Now that we have widget width we can compute widget x coordinate */
w->area.x = widget_calculate_offset(width, w->area.width,
w->area.x = widget_calculate_offset(ctx->width, w->area.width,
offset, w->widget->align);
for(area = tda->area, tag = vscreen->tags, i = 0;
@ -186,7 +186,7 @@ taglist_draw(draw_context_t *ctx, int screen, widget_node_t *w,
p_delete(&text);
w->area.height = height;
w->area.height = ctx->height;
return w->area.width;
}

View File

@ -64,7 +64,7 @@ tasklist_isvisible(client_t *c, int screen, showclient_t show)
static int
tasklist_draw(draw_context_t *ctx, int screen,
widget_node_t *w, int width, int height,
widget_node_t *w,
int offset, int used, void *p __attribute__ ((unused)))
{
client_t *c;
@ -74,7 +74,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
int n = 0, i = 0, box_width = 0, icon_width = 0, box_width_rest = 0;
NetWMIcon *icon;
if(used >= width)
if(used >= ctx->width)
return (w->area.width = 0);
for(c = globalconf.clients; c; c = c->next)
@ -84,11 +84,11 @@ tasklist_draw(draw_context_t *ctx, int screen,
if(!n)
return (w->area.width = 0);
box_width = (width - used) / n;
box_width = (ctx->width - used) / n;
/* compute how many pixel we left empty */
box_width_rest = (width - used) % n;
box_width_rest = (ctx->width - used) % n;
w->area.x = widget_calculate_offset(width,
w->area.x = widget_calculate_offset(ctx->width,
0, offset, w->widget->align);
w->area.y = 0;
@ -112,7 +112,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
/* draw a background for icons */
area.x = w->area.x + box_width * i;
area.y = w->area.y;
area.height = height;
area.height = ctx->height;
area.width = box_width;
if(c->icon_path)
@ -120,24 +120,24 @@ tasklist_draw(draw_context_t *ctx, int screen,
area = draw_get_image_size(c->icon_path);
if(area.width > 0 && area.height > 0)
{
icon_width = ((double) height / (double) area.height) * area.width;
icon_width = ((double) ctx->height / (double) area.height) * area.width;
draw_image(ctx,
w->area.x + box_width * i,
w->area.y,
height,
ctx->height,
c->icon_path);
}
}
if(!icon_width && (icon = ewmh_get_window_icon(c->win)))
{
icon_width = ((double) height / (double) icon->height)
icon_width = ((double) ctx->height / (double) icon->height)
* icon->width;
draw_image_from_argb_data(ctx,
w->area.x + box_width * i,
w->area.y,
icon->width, icon->height,
height, icon->image);
ctx->height, icon->image);
p_delete(&icon->image);
p_delete(&icon);
}
@ -146,7 +146,7 @@ tasklist_draw(draw_context_t *ctx, int screen,
area.x = w->area.x + icon_width + box_width * i;
area.y = w->area.y;
area.width = box_width - icon_width;
area.height = height;
area.height = ctx->height;
/* if we're on last elem, it has the last pixels left */
if(i == n - 1)
@ -165,8 +165,8 @@ tasklist_draw(draw_context_t *ctx, int screen,
i++;
}
w->area.width = width - used;
w->area.height = height;
w->area.width = ctx->width - used;
w->area.height = ctx->height;
return w->area.width;
}

View File

@ -36,7 +36,7 @@ typedef struct
static int
textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
widget_node_t *w,
int width, int height, int offset, int used,
int offset, int used,
void *p __attribute__ ((unused)))
{
Data *d = w->widget->data;
@ -44,16 +44,16 @@ textbox_draw(draw_context_t *ctx, int screen __attribute__ ((unused)),
if(d->width)
w->area.width = d->width;
else if(w->widget->align == AlignFlex)
w->area.width = width - used;
w->area.width = ctx->width - used;
else
w->area.width = MIN(draw_text_extents(ctx->connection,
ctx->phys_screen,
globalconf.font, d->text).width,
width - used);
ctx->width - used);
w->area.height = height;
w->area.height = ctx->height;
w->area.x = widget_calculate_offset(width,
w->area.x = widget_calculate_offset(ctx->width,
w->area.width,
offset,
w->widget->align);