shithub: Nail

Download patch

ref: 5044a571e9a5a8e952a1f496859a38635497f43f
parent: cadbd8b4090683f1634cc580ef6f5d9371c3f07a
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Nov 4 01:44:21 EST 2020

cosmetic fixes, write events back correctly

--- a/mail.h
+++ b/mail.h
@@ -38,9 +38,10 @@
 };
 
 struct Win {
+	int	id;
 	Ioproc	*io;
 	Biobuf	*event;
-	int	id;
+	int	revent;
 	int	ctl;
 	int	addr;
 	int	data;
--- a/mbox.c
+++ b/mbox.c
@@ -444,7 +444,7 @@
 			flag, sep, -width, width,
 			m->subject,
 			dots,
-			m->fromcolon);
+			m->from);
 		depth++;
 	}
 	if(recurse && mbox.view != Vflat)
@@ -692,7 +692,7 @@
 		for(p = mboxfn; p->name != nil; p++)
 			if(strcmp(p->name, f[0]) == 0 && p->fn != nil)
 				p->fn(&f[1], nf - 1);
-		if(p->fn == nil && !(ev->flags & 0x2))
+		if(p->fn == nil)
 			winsendevent(&mbox, ev);
 		break;
 	break;
--- a/win.c
+++ b/win.c
@@ -71,8 +71,7 @@
 void
 winsendevent(Win *w, Event *e)
 {
-	Bprint(w->event, "%c%c%d %d\n", e->action, e->type, e->q0, e->q1);
-	Bflush(w->event);
+	fprint(w->revent, "%c%c%d %d\n", e->action, e->type, e->q0, e->q1);
 }
 
 int
@@ -129,6 +128,7 @@
 		sysfatal("ioproc alloc: %r");
 	w->id = atoi(buf);
 	w->event = bwinopen(w, "event", OREAD);
+	w->revent = winopen(w, "event", OWRITE);
 	w->addr = winopen(w, "addr", ORDWR);
 	w->data = winopen(w, "data", ORDWR);
 }