shithub: wired

Download patch

ref: 1b8752f7adc9f4faa6210eba9d914a2a44e5f1db
parent: 6f2fd5526607692e2e800d0a1efa72ee92a6b138
author: james palmer <james@biobuf.link>
date: Mon Jul 19 14:25:27 EDT 2021

bring in line with libacme changes to event handling

--- a/main.c
+++ b/main.c
@@ -77,18 +77,10 @@
 
 	win = aux;
 	events = win->aux;
-	win->eventfd = awinfsopen(win, "event", ORDWR);
+	aeventopen(win);
 
-	while(aeventnext(win, &ev)) {
-		switch(ev.type) {
-		case 'L':
-		case 'l':
-			aeventsend(win, &ev);
-			break;
-		default:
-			send(events, &ev);
-		}
-	}
+	while(aeventread(win, &ev))
+		send(events, &ev);
 
 	threadexits(nil);
 }
@@ -235,14 +227,21 @@
 
 	while(recv(events, &ev)) {
 		switch(ev.type) {
+		case 'l':
+		case 'L':
+			aeventwrite(ev.win, &ev);
+			break;
+
 		case 'x':
 		case 'X':
 			if(strcmp(ev.text, "Del") == 0)
 				goto quit;
-			if(strcmp(ev.text, "Send") == 0)
+			else if(strcmp(ev.text, "Send") == 0)
 				sendmessage(input);
-			if(strcmp(ev.text, "Act") == 0)
+			else if(strcmp(ev.text, "Act") == 0)
 				sendaction(input);
+			else
+				aeventwrite(ev.win, &ev);
 
 			break;
 		case 'I':