acme, abaco: render scrollbar like rio

This commit is contained in:
aap 2024-09-09 13:03:15 +00:00
parent 36e5075ded
commit 79eb47ef8e
2 changed files with 9 additions and 3 deletions

View file

@ -20,8 +20,8 @@ scrlresize(void)
{
freeimage(vscrtmp);
freeimage(hscrtmp);
vscrtmp = eallocimage(display, Rect(0, 0, 32, screen->r.max.y), screen->chan, 0, DNofill);
hscrtmp = eallocimage(display, Rect(0, 0, screen->r.max.x, 32), screen->chan, 0, DNofill);
vscrtmp = eallocimage(display, Rect(0, 0, 32, 3*Dy(screen->r)), screen->chan, 0, DNofill);
hscrtmp = eallocimage(display, Rect(0, 0, 3*Dx(screen->r), 32), screen->chan, 0, DNofill);
}
static
@ -69,6 +69,9 @@ textscrdraw(Text *t)
r2 = scrpos(r1, t->org, t->org+t->nchars, t->rs.nr);
if(!eqrect(r2, t->lastsr)){
t->lastsr = r2;
/* move r1, r2 to (0,0) to avoid clipping */
r2 = rectsubpt(r2, r1.min);
r1 = rectsubpt(r1, r1.min);
draw(b, r1, t->cols[BORD], nil, ZP);
draw(b, r2, t->cols[BACK], nil, ZP);
r2.min.x = r2.max.x-1;

View file

@ -46,7 +46,7 @@ void
scrlresize(void)
{
freeimage(scrtmp);
scrtmp = allocimage(display, Rect(0, 0, 32, screen->r.max.y), screen->chan, 0, DNofill);
scrtmp = allocimage(display, Rect(0, 0, 32, 3*Dy(screen->r)), screen->chan, 0, DNofill);
if(scrtmp == nil)
error("scroll alloc");
}
@ -69,6 +69,9 @@ textscrdraw(Text *t)
r2 = scrpos(r1, t->org, t->org+t->nchars, t->file->nc);
if(!eqrect(r2, t->lastsr)){
t->lastsr = r2;
/* move r1, r2 to (0,0) to avoid clipping */
r2 = rectsubpt(r2, r1.min);
r1 = rectsubpt(r1, r1.min);
draw(b, r1, t->cols[BORD], nil, ZP);
draw(b, r2, t->cols[BACK], nil, ZP);
r2.min.x = r2.max.x-1;