ref: 79eb47ef8ec90f8ab9bcc8d7507d434dbb80b809
parent: 36e5075ded47aaace9185b96567a4086bd49bb58
author: aap <aap@papnet.eu>
date: Mon Sep 9 09:03:15 EDT 2024
acme, abaco: render scrollbar like rio
--- a/sys/src/cmd/abaco/scrl.c
+++ b/sys/src/cmd/abaco/scrl.c
@@ -20,8 +20,8 @@
{
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 @@
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;
--- a/sys/src/cmd/acme/scrl.c
+++ b/sys/src/cmd/acme/scrl.c
@@ -46,7 +46,7 @@
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 @@
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;
--
⑨