commit 18d4c935d7ba584052a20110cb594ce1407c32ca
parent b0270b85186d7bca11981725fff13d6bbca5d760
Author: glenda <glenda@9front.local>
Date: Sat, 24 Jul 2021 16:09:38 +0000
add redraw() function
Diffstat:
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/fs.c b/fs.c
@@ -55,6 +55,7 @@ fs_write(Req *r)
r->ofcall.count = r->ifcall.count;
respond(r, nil);
generatepage(&rich);
+ /* there should be a call to redraw(), probably */
} else respond(r, "fs_write: f->aux is nil");
}
diff --git a/richterm.c b/richterm.c
@@ -25,6 +25,7 @@ void shutdown(void);
void send_interrupt(void);
void runcmd(void *);
void scroll(Point, Rich *);
+void redraw(void);
void
runcmd(void *args)
@@ -83,7 +84,6 @@ threadmain(int argc, char **argv)
{
Object *olast;
char *ov;
- int i;
Mousectl *mctl;
Keyboardctl *kctl;
int rv[2];
@@ -114,11 +114,8 @@ threadmain(int argc, char **argv)
rich.page.scroll = ZP;
rich.page.view = nil;
rich.page.r = Rpt(addpt(screen->r.min, Pt(17, 1)), subpt(screen->r.max, Pt(1,1)));
- generatepage(&rich);
- draw(screen, screen->r, display->white, nil, ZP);
- drawpage(screen, &rich.page);
- flushimage(display, 1);
+ redraw();
if ((mctl = initmouse(nil, screen)) == nil)
sysfatal("%s: %r", argv0);
@@ -141,10 +138,7 @@ threadmain(int argc, char **argv)
if (getwindow(display, Refnone) < 0)
sysfatal("resize failed: %r");
rich.page.r = Rpt(addpt(screen->r.min, Pt(17, 1)), subpt(screen->r.max, Pt(1,1)));
- generatepage(&rich);
- draw(screen, screen->r, display->white, nil, ZP);
- drawpage(screen, &rich.page);
- flushimage(display, 1);
+ redraw();
break;
case KBD:
if (kv == 0x7f) shutdown();
@@ -174,19 +168,14 @@ threadmain(int argc, char **argv)
aux->data->p[aux->data->n - 1] = kv;
aux->data->p[aux->data->n] = 0;
}
- generatepage(&rich);
- draw(screen, screen->r, display->white, nil, ZP);
- drawpage(screen, &rich.page);
- flushimage(display, 1);
+ redraw();
nbsend(dctl->rc, &kv);
break;
case DEVFSWRITE:
mkobjectftree(newobject(&rich), fsctl->tree->root, ov);
generatepage(&rich);
draw(screen, screen->r, display->white, nil, ZP);
- for (i = 0; i < rich.page.count; i++){
- drawview(screen, &rich.page.view[i]);
- }
+ drawpage(screen, &rich.page);
flushimage(display, 1);
break;
case NONE:
@@ -404,4 +393,13 @@ mkobjectftree(Object *obj, File *root, char *text)
obj->flink = createfile(obj->dir, "link", "richterm", 0666, auxlink);
obj->fimage = createfile(obj->dir, "image", "richterm", 0666, auximage);
return obj;
+}
+
+void
+redraw(void)
+{
+ generatepage(&rich);
+ draw(screen, screen->r, display->white, nil, ZP);
+ drawpage(screen, &rich.page);
+ flushimage(display, 1);
}
\ No newline at end of file