use Area in Widget
This commit is contained in:
parent
e77729ed50
commit
6ca7d7b2db
6
config.h
6
config.h
|
@ -106,10 +106,8 @@ struct Widget
|
||||||
Alignment alignment;
|
Alignment alignment;
|
||||||
/** Misc private data */
|
/** Misc private data */
|
||||||
void *data;
|
void *data;
|
||||||
/** Location on status bar */
|
/** Area */
|
||||||
int location;
|
Area area;
|
||||||
/** Widget width */
|
|
||||||
int width;
|
|
||||||
/** Buttons bindings */
|
/** Buttons bindings */
|
||||||
Button *buttons;
|
Button *buttons;
|
||||||
/** Font */
|
/** Font */
|
||||||
|
|
8
event.c
8
event.c
|
@ -76,7 +76,7 @@ handle_event_buttonpress(XEvent *e)
|
||||||
|| globalconf.screens[screen].statusbar->position == Bottom)
|
|| globalconf.screens[screen].statusbar->position == Bottom)
|
||||||
{
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->x >= widget->location && ev->x <= widget->location + widget->width)
|
if(ev->x >= widget->area.x && ev->x <= widget->area.x + widget->area.width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
|
@ -85,7 +85,7 @@ handle_event_buttonpress(XEvent *e)
|
||||||
else if(statusbar->position == Right)
|
else if(statusbar->position == Right)
|
||||||
{
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(ev->y >= widget->location && ev->y <= widget->location + widget->width)
|
if(ev->y >= widget->area.x && ev->y <= widget->area.x + widget->area.width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
|
@ -94,8 +94,8 @@ handle_event_buttonpress(XEvent *e)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for(widget = statusbar->widgets; widget; widget = widget->next)
|
for(widget = statusbar->widgets; widget; widget = widget->next)
|
||||||
if(statusbar->width - ev->y >= widget->location
|
if(statusbar->width - ev->y >= widget->area.x
|
||||||
&& statusbar->width - ev->y <= widget->location + widget->width)
|
&& statusbar->width - ev->y <= widget->area.x + widget->area.width)
|
||||||
{
|
{
|
||||||
widget->button_press(widget, ev);
|
widget->button_press(widget, ev);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -44,31 +44,31 @@ focustitle_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
Data *d = widget->data;
|
Data *d = widget->data;
|
||||||
Client *sel = focus_get_current_client(widget->statusbar->screen);
|
Client *sel = focus_get_current_client(widget->statusbar->screen);
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
0,
|
0,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
if(sel)
|
if(sel)
|
||||||
{
|
{
|
||||||
draw_text(ctx, widget->location, 0,
|
draw_text(ctx, widget->area.x, 0,
|
||||||
widget->statusbar->width - used,
|
widget->statusbar->width - used,
|
||||||
widget->statusbar->height,
|
widget->statusbar->height,
|
||||||
d->align,
|
d->align,
|
||||||
widget->font->height / 2, widget->font, sel->name,
|
widget->font->height / 2, widget->font, sel->name,
|
||||||
d->fg, d->bg);
|
d->fg, d->bg);
|
||||||
if(sel->isfloating)
|
if(sel->isfloating)
|
||||||
draw_circle(ctx, widget->location, 0,
|
draw_circle(ctx, widget->area.x, 0,
|
||||||
(widget->font->height + 2) / 4,
|
(widget->font->height + 2) / 4,
|
||||||
sel->ismax, d->fg);
|
sel->ismax, d->fg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
draw_rectangle(ctx, widget->location, 0,
|
draw_rectangle(ctx, widget->area.x, 0,
|
||||||
widget->statusbar->width - used, widget->statusbar->height, True, d->bg);
|
widget->statusbar->width - used, widget->statusbar->height, True, d->bg);
|
||||||
|
|
||||||
widget->width = widget->statusbar->width - used;
|
widget->area.width = widget->statusbar->width - used;
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget *
|
Widget *
|
||||||
|
|
|
@ -38,18 +38,18 @@ iconbox_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
Area area = draw_get_image_size(d->image);
|
Area area = draw_get_image_size(d->image);
|
||||||
|
|
||||||
if(d->resize)
|
if(d->resize)
|
||||||
widget->width = ((double) widget->statusbar->height / area.height) * area.width;
|
widget->area.width = ((double) widget->statusbar->height / area.height) * area.width;
|
||||||
else
|
else
|
||||||
widget->width = area.width;
|
widget->area.width = area.width;
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
widget->width,
|
widget->area.width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
draw_image(ctx, widget->location, 0, d->resize ? widget->statusbar->height : 0, d->image);
|
draw_image(ctx, widget->area.x, 0, d->resize ? widget->statusbar->height : 0, d->image);
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -34,19 +34,19 @@ layoutinfo_draw(Widget *widget,
|
||||||
int used __attribute__ ((unused)))
|
int used __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
Tag **curtags = get_current_tags(widget->statusbar->screen);
|
Tag **curtags = get_current_tags(widget->statusbar->screen);
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
widget->statusbar->height,
|
widget->statusbar->height,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
widget->width = widget->statusbar->height;
|
widget->area.width = widget->statusbar->height;
|
||||||
|
|
||||||
draw_image(ctx, widget->location, 0, widget->statusbar->height,
|
draw_image(ctx, widget->area.x, 0, widget->statusbar->height,
|
||||||
curtags[0]->layout->image);
|
curtags[0]->layout->image);
|
||||||
|
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget *
|
Widget *
|
||||||
|
|
|
@ -41,7 +41,7 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
{
|
{
|
||||||
widget->width = 0;
|
widget->area.width = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,39 +49,40 @@ netwmicon_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
if(r->icon && client_match_rule(sel, r))
|
if(r->icon && client_match_rule(sel, r))
|
||||||
{
|
{
|
||||||
area = draw_get_image_size(r->icon);
|
area = draw_get_image_size(r->icon);
|
||||||
widget->width = ((double) widget->statusbar->height / (double) area.height) * area.width;
|
widget->area.width = ((double) widget->statusbar->height / (double) area.height)
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
* area.width;
|
||||||
widget->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
|
widget->area.width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
draw_image(ctx, widget->location, 0, widget->statusbar->height, r->icon);
|
draw_image(ctx, widget->area.x, 0, widget->statusbar->height, r->icon);
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(!(icon = ewmh_get_window_icon(sel->win)))
|
if(!(icon = ewmh_get_window_icon(sel->win)))
|
||||||
{
|
{
|
||||||
widget->width = 0;
|
widget->area.width = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->width = ((double) widget->statusbar->height / (double) icon->height) * icon->width;
|
widget->area.width = ((double) widget->statusbar->height / (double) icon->height) * icon->width;
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
widget->width,
|
widget->area.width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
draw_image_from_argb_data(ctx,
|
draw_image_from_argb_data(ctx,
|
||||||
widget->location, 0,
|
widget->area.x, 0,
|
||||||
icon->width, icon->height,
|
icon->width, icon->height,
|
||||||
widget->statusbar->height, icon->image);
|
widget->statusbar->height, icon->image);
|
||||||
|
|
||||||
p_delete(&icon->image);
|
p_delete(&icon->image);
|
||||||
p_delete(&icon);
|
p_delete(&icon);
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget *
|
Widget *
|
||||||
|
|
|
@ -66,12 +66,12 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
|
|
||||||
width = d->width - d->lpadding;
|
width = d->width - d->lpadding;
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
d->width,
|
d->width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
left_offset = widget->location + d->lpadding;
|
left_offset = widget->area.x + d->lpadding;
|
||||||
|
|
||||||
for (i = 0; i < d->bars; i++)
|
for (i = 0; i < d->bars; i++)
|
||||||
{
|
{
|
||||||
|
@ -97,8 +97,8 @@ progressbar_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
margin_top += (pb_height + d->gap);
|
margin_top += (pb_height + d->gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->width = d->width;
|
widget->area.width = d->width;
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -70,17 +70,17 @@ taglist_draw(Widget *widget,
|
||||||
|
|
||||||
flagsize = (vscreen.font->height + 2) / 3;
|
flagsize = (vscreen.font->height + 2) / 3;
|
||||||
|
|
||||||
widget->width = 0;
|
widget->area.width = 0;
|
||||||
|
|
||||||
for(tag = vscreen.tags; tag; tag = tag->next)
|
for(tag = vscreen.tags; tag; tag = tag->next)
|
||||||
widget->width += textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
widget->area.width += textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
widget->width,
|
widget->area.width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
widget->width = 0;
|
widget->area.width = 0;
|
||||||
for(tag = vscreen.tags; tag; tag = tag->next)
|
for(tag = vscreen.tags; tag; tag = tag->next)
|
||||||
{
|
{
|
||||||
w = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
w = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||||
|
@ -91,7 +91,7 @@ taglist_draw(Widget *widget,
|
||||||
else
|
else
|
||||||
colors = vscreen.colors_normal;
|
colors = vscreen.colors_normal;
|
||||||
draw_text(ctx,
|
draw_text(ctx,
|
||||||
widget->location + widget->width, 0,
|
widget->area.x + widget->area.width, 0,
|
||||||
w, widget->statusbar->height,
|
w, widget->statusbar->height,
|
||||||
AlignCenter,
|
AlignCenter,
|
||||||
vscreen.font->height / 2,
|
vscreen.font->height / 2,
|
||||||
|
@ -100,12 +100,12 @@ taglist_draw(Widget *widget,
|
||||||
colors[ColFG],
|
colors[ColFG],
|
||||||
colors[ColBG]);
|
colors[ColBG]);
|
||||||
if(isoccupied(tag))
|
if(isoccupied(tag))
|
||||||
draw_rectangle(ctx, widget->location + widget->width, 0, flagsize, flagsize,
|
draw_rectangle(ctx, widget->area.x + widget->area.width, 0, flagsize, flagsize,
|
||||||
sel && is_client_tagged(sel, tag), colors[ColFG]);
|
sel && is_client_tagged(sel, tag), colors[ColFG]);
|
||||||
widget->width += w;
|
widget->area.width += w;
|
||||||
}
|
}
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -126,8 +126,8 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
||||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||||
{
|
{
|
||||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||||
if(ev->x >= widget->location + prev_width
|
if(ev->x >= widget->area.x + prev_width
|
||||||
&& ev->x <= widget->location + prev_width + width)
|
&& ev->x <= widget->area.x + prev_width + width)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%d", i);
|
snprintf(buf, sizeof(buf), "%d", i);
|
||||||
b->func(widget->statusbar->screen, buf);
|
b->func(widget->statusbar->screen, buf);
|
||||||
|
@ -140,8 +140,8 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
||||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||||
{
|
{
|
||||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||||
if(ev->y >= widget->location + prev_width
|
if(ev->y >= widget->area.x + prev_width
|
||||||
&& ev->y <= widget->location + prev_width + width)
|
&& ev->y <= widget->area.x + prev_width + width)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%d", i);
|
snprintf(buf, sizeof(buf), "%d", i);
|
||||||
b->func(widget->statusbar->screen, buf);
|
b->func(widget->statusbar->screen, buf);
|
||||||
|
@ -154,8 +154,8 @@ taglist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
||||||
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
for(tag = vscreen.tags; tag; tag = tag->next, i++)
|
||||||
{
|
{
|
||||||
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
width = textwidth(vscreen.font, tag->name) + vscreen.font->height;
|
||||||
if(widget->statusbar->width - ev->y >= widget->location + prev_width
|
if(widget->statusbar->width - ev->y >= widget->area.x + prev_width
|
||||||
&& widget->statusbar->width - ev->y <= widget->location + prev_width + width)
|
&& widget->statusbar->width - ev->y <= widget->area.x + prev_width + width)
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%d", i);
|
snprintf(buf, sizeof(buf), "%d", i);
|
||||||
b->func(widget->statusbar->screen, buf);
|
b->func(widget->statusbar->screen, buf);
|
||||||
|
|
|
@ -61,13 +61,13 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
|
|
||||||
if(!n)
|
if(!n)
|
||||||
{
|
{
|
||||||
widget->width = 0;
|
widget->area.width = 0;
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
box_width = (widget->statusbar->width - used) / n;
|
box_width = (widget->statusbar->width - used) / n;
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
0,
|
0,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
@ -85,7 +85,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
area = draw_get_image_size(r->icon);
|
area = draw_get_image_size(r->icon);
|
||||||
icon_width = ((double) widget->statusbar->height / (double) area.height) * area.width;
|
icon_width = ((double) widget->statusbar->height / (double) area.height) * area.width;
|
||||||
draw_image(ctx,
|
draw_image(ctx,
|
||||||
widget->location + box_width * i,
|
widget->area.x + box_width * i,
|
||||||
0, widget->statusbar->height,
|
0, widget->statusbar->height,
|
||||||
r->icon);
|
r->icon);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
icon_width = ((double) widget->statusbar->height / (double) icon->height)
|
icon_width = ((double) widget->statusbar->height / (double) icon->height)
|
||||||
* icon->width;
|
* icon->width;
|
||||||
draw_image_from_argb_data(ctx,
|
draw_image_from_argb_data(ctx,
|
||||||
widget->location + box_width * i, 0,
|
widget->area.x + box_width * i, 0,
|
||||||
icon->width, icon->height,
|
icon->width, icon->height,
|
||||||
widget->statusbar->height, icon->image);
|
widget->statusbar->height, icon->image);
|
||||||
p_delete(&icon->image);
|
p_delete(&icon->image);
|
||||||
|
@ -105,7 +105,7 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
|
|
||||||
if(sel == c)
|
if(sel == c)
|
||||||
{
|
{
|
||||||
draw_text(ctx, widget->location + icon_width + box_width * i, 0,
|
draw_text(ctx, widget->area.x + icon_width + box_width * i, 0,
|
||||||
box_width - icon_width,
|
box_width - icon_width,
|
||||||
widget->statusbar->height,
|
widget->statusbar->height,
|
||||||
d->align,
|
d->align,
|
||||||
|
@ -113,22 +113,22 @@ tasklist_draw(Widget *widget, DrawCtx *ctx, int offset, int used)
|
||||||
d->fg_sel, d->bg_sel);
|
d->fg_sel, d->bg_sel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
draw_text(ctx, widget->location + icon_width + box_width * i, 0,
|
draw_text(ctx, widget->area.x + icon_width + box_width * i, 0,
|
||||||
box_width - icon_width,
|
box_width - icon_width,
|
||||||
widget->statusbar->height,
|
widget->statusbar->height,
|
||||||
d->align,
|
d->align,
|
||||||
widget->font->height / 2, widget->font, c->name,
|
widget->font->height / 2, widget->font, c->name,
|
||||||
d->fg, d->bg);
|
d->fg, d->bg);
|
||||||
if(c->isfloating)
|
if(c->isfloating)
|
||||||
draw_circle(ctx, widget->location + icon_width + box_width * i, 0,
|
draw_circle(ctx, widget->area.x + icon_width + box_width * i, 0,
|
||||||
(widget->font->height + 2) / 4,
|
(widget->font->height + 2) / 4,
|
||||||
c->ismax, d->fg);
|
c->ismax, d->fg);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->width = widget->statusbar->width - used;
|
widget->area.width = widget->statusbar->width - used;
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -148,7 +148,7 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
||||||
if(!n)
|
if(!n)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
box_width = widget->width / n;
|
box_width = widget->area.width / n;
|
||||||
|
|
||||||
if(ev->button == Button1 && CLEANMASK(ev->state) == NoSymbol)
|
if(ev->button == Button1 && CLEANMASK(ev->state) == NoSymbol)
|
||||||
{
|
{
|
||||||
|
@ -156,13 +156,13 @@ tasklist_button_press(Widget *widget, XButtonPressedEvent *ev)
|
||||||
{
|
{
|
||||||
case Top:
|
case Top:
|
||||||
case Bottom:
|
case Bottom:
|
||||||
ci = (ev->x - widget->location) / box_width;
|
ci = (ev->x - widget->area.x) / box_width;
|
||||||
break;
|
break;
|
||||||
case Right:
|
case Right:
|
||||||
ci = (ev->y - widget->location) / box_width;
|
ci = (ev->y - widget->area.x) / box_width;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ci = ((widget->statusbar->width - ev->y) - widget->location) / box_width;
|
ci = ((widget->statusbar->width - ev->y) - widget->area.x) / box_width;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* found first visible client */
|
/* found first visible client */
|
||||||
|
|
|
@ -42,19 +42,19 @@ textbox_draw(Widget *widget, DrawCtx *ctx, int offset,
|
||||||
Data *d = widget->data;
|
Data *d = widget->data;
|
||||||
|
|
||||||
if(d->width)
|
if(d->width)
|
||||||
widget->width = d->width;
|
widget->area.width = d->width;
|
||||||
else
|
else
|
||||||
widget->width = textwidth(widget->font, d->text);
|
widget->area.width = textwidth(widget->font, d->text);
|
||||||
|
|
||||||
widget->location = widget_calculate_offset(widget->statusbar->width,
|
widget->area.x = widget_calculate_offset(widget->statusbar->width,
|
||||||
widget->width,
|
widget->area.width,
|
||||||
offset,
|
offset,
|
||||||
widget->alignment);
|
widget->alignment);
|
||||||
|
|
||||||
draw_text(ctx, widget->location, 0, widget->width, widget->statusbar->height,
|
draw_text(ctx, widget->area.x, 0, widget->area.width, widget->statusbar->height,
|
||||||
d->align, 0, widget->font, d->text, d->fg, d->bg);
|
d->align, 0, widget->font, d->text, d->fg, d->bg);
|
||||||
|
|
||||||
return widget->width;
|
return widget->area.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue