mirror of
https://github.com/0intro/wmii
synced 2024-11-26 07:39:37 +03:00
Minor fixes to label sizing/alignment in liblitz (this really needs a brush->padding)
This commit is contained in:
parent
4113e8eb5c
commit
ab2ff71e8f
@ -30,7 +30,6 @@ create_bar(Bar **b_link, char *name)
|
||||
cext_strlcpy(b->name, name, sizeof(b->name));
|
||||
b->brush = bbrush;
|
||||
b->brush.color = def.normcolor;
|
||||
b->brush.align = CENTER;
|
||||
|
||||
for(i=b_link; *i; i=&(*i)->next)
|
||||
if(strcmp((*i)->name, name) >= 0)
|
||||
|
@ -45,9 +45,8 @@ blitz_draw_label(BlitzBrush *b, char *text)
|
||||
y = b->rect.y + b->rect.height / 2 - h / 2 + b->font->ascent;
|
||||
|
||||
/* shorten text if necessary */
|
||||
while (len && (w = blitz_textwidth(b->font, buf)) > b->rect.width) {
|
||||
buf[len - 1] = 0;
|
||||
len--;
|
||||
while (len && (w = blitz_textwidth(b->font, buf)) > b->rect.width - h) {
|
||||
buf[--len] = 0;
|
||||
shortened = 1;
|
||||
}
|
||||
|
||||
@ -63,12 +62,16 @@ blitz_draw_label(BlitzBrush *b, char *text)
|
||||
if (len > 1)
|
||||
buf[len - 1] = '.';
|
||||
}
|
||||
/* shorten text more if necessary */
|
||||
while (len && (w = blitz_textwidth(b->font, buf)) > b->rect.width - h)
|
||||
buf[--len] = 0;
|
||||
|
||||
switch (b->align) {
|
||||
case EAST:
|
||||
x = b->rect.x + b->rect.width - (h / 2 + w);
|
||||
break;
|
||||
case CENTER:
|
||||
x = b->rect.x + (b->rect.width - w) / 2;
|
||||
x = b->rect.x + h / 2 + (b->rect.width - h - w) / 2;
|
||||
break;
|
||||
default:
|
||||
x = b->rect.x + h / 2;
|
||||
|
Loading…
Reference in New Issue
Block a user