touchup, make slant logic consistent, now they all look the same.
This commit is contained in:
parent
cfa38a1aa7
commit
e83eeb92f1
50
lemonbar.c
50
lemonbar.c
|
@ -100,7 +100,8 @@ static area_stack_t area_stack;
|
|||
static int slant;
|
||||
static int slant_width;
|
||||
static int full_slant_width;
|
||||
static int slant_height;
|
||||
static int slant_counter;
|
||||
static int upslant;
|
||||
|
||||
void
|
||||
update_gc (void)
|
||||
|
@ -219,43 +220,26 @@ draw_char (monitor_t *mon, font_t *cur_font, int x, int align, uint16_t ch, int
|
|||
// Draw the background first
|
||||
if(slant_width)
|
||||
{
|
||||
//odd = slant left, even = slant right
|
||||
// if > 20, upslant.
|
||||
int left=slant%2;
|
||||
int i=0;
|
||||
int cur_height=0;
|
||||
// even = slant left, odd = slant right
|
||||
int right = slant % 2;
|
||||
int cur_height = 0;
|
||||
|
||||
if(!full_slant_width)
|
||||
{
|
||||
full_slant_width = slant_width * ch_width;
|
||||
}
|
||||
|
||||
for(i=0; i<ch_width; i++)
|
||||
for(int i = 0; i < ch_width; i++)
|
||||
{
|
||||
//handles int division better:
|
||||
int height_calc = (!bh%full_slant_width ? bh/full_slant_width : (bh/full_slant_width) + 1);
|
||||
slant_counter++;
|
||||
if (right)
|
||||
cur_height = (bh * (full_slant_width - slant_counter)) / full_slant_width;
|
||||
else
|
||||
cur_height = (slant_counter * bh) / full_slant_width;
|
||||
|
||||
cur_height = height_calc*(i) + height_calc;
|
||||
cur_height+=slant_height;
|
||||
|
||||
if(i == ch_width - 1)
|
||||
{
|
||||
slant_height=cur_height;
|
||||
}
|
||||
|
||||
if(! left){
|
||||
cur_height = bh - cur_height;
|
||||
}
|
||||
|
||||
if(slant > 20)
|
||||
{
|
||||
cur_height*=-1;
|
||||
}
|
||||
if (!upslant)
|
||||
cur_height *= -1;
|
||||
|
||||
fill_rect(mon->pixmap, gc[GC_CLEAR], x+i, cur_height, 1, bh);
|
||||
}
|
||||
|
||||
slant_width--;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -571,15 +555,15 @@ parse (char *text)
|
|||
case 'F': fgc = parse_color(p, &p, dfgc); update_gc(); break;
|
||||
case 'U': ugc = parse_color(p, &p, dugc); update_gc(); break;
|
||||
|
||||
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'D':
|
||||
case 'd':
|
||||
slant = *(p-1) - 'A'; // 4,36,5,37
|
||||
slant_width = (*p++)-'0';
|
||||
slant_height = 0;
|
||||
full_slant_width=0;
|
||||
slant_width = (*p++) - '0';
|
||||
full_slant_width = 0;
|
||||
slant_counter = 0;
|
||||
upslant = slant > 20 ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
|
|
|
@ -17,6 +17,4 @@ ${sbg}%{E${Len}}$(space)${bg} - \
|
|||
${sbg}%{e${Len}}$(space)${bg} - \
|
||||
${sbg}%{D${Len}}$(space)${bg} - \
|
||||
${sbg}%{d${Len}}$(space)${bg} " \
|
||||
| ./lemonbar -g $geom -p
|
||||
|
||||
|
||||
| ./lemonbar -g $geom -p -B "#000000"
|
||||
|
|
Loading…
Reference in New Issue
Block a user