commit c359e5c1b1309df1877b641d86b68097a4dbeba1
parent 74476aaabcc2c3e9eb5e05051de5a8814642f0cb
Author: Pavel Renev <an2qzavok@gmail.com>
Date: Mon, 23 Aug 2021 21:36:18 +0000
redrawing is now scheduled via redrawc channel instead of being called directly
Diffstat:
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/array.c b/array.c
@@ -86,4 +86,4 @@ void *
arrayend(Array *ap)
{
return (void *)(ap->p + ap->size * ap->count);
-}
-\ No newline at end of file
+}
diff --git a/devfs.c b/devfs.c
@@ -37,7 +37,9 @@ devfs_write(Req *r)
{
File *f;
Array *buf;
+ Object *obj;
buf = nil;
+ obj = nil;
f = r->fid->file;
if (f == cons){
r->ofcall.count = r->ifcall.count;
@@ -52,7 +54,7 @@ devfs_write(Req *r)
rich.objects->count--;
- mkobjectftree(
+ obj = mkobjectftree(
newobject(&rich, r->ifcall.data, r->ifcall.count),
fsctl->tree->root);
@@ -62,7 +64,7 @@ devfs_write(Req *r)
arrayfree(buf);
} else olast = newobject(&rich, nil, 0);
- redraw(1);
+ nbsend(redrawc, &obj);
respond(r, nil);
} else if (f == consctl) {
respond(r, "not implemented");
diff --git a/fs.c b/fs.c
@@ -136,7 +136,7 @@ fs_write(Req *r)
} else if (aux != nil) {
aux->write(r, aux->data);
respond(r, nil);
- redraw(1);
+ nbsend(redrawc, &aux->obj);
} else respond(r, "fs_write: f->aux is nil");
}
diff --git a/richterm.h b/richterm.h
@@ -1,4 +1,5 @@
-void redraw(int);
+extern Channel *redrawc;
+
void drawscrollbar(void);
typedef struct Object Object;
@@ -26,6 +27,8 @@ struct Object {
extern Object *olast;
+void redraw(Object *);
+
Object * mkobjectftree(Object *, File *);
void rmobjectftree(Object *);
void objectfree(void *);