shithub: evdump

Download patch

ref: 3efad400ef6c9c09b6f439950334d62722e54073
parent: 2bfb2a53241c5ab1e87674186a59c188e13f0e16
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Jan 1 18:49:49 EST 2023

use threadnotify

--- a/evdump.c
+++ b/evdump.c
@@ -90,8 +90,8 @@
 	return nil;
 }
 
-static void
-kmreset(void)
+static int
+kmreset(void *, char *)
 {
 	int i;
 
@@ -98,6 +98,8 @@
 	for(i = 0; i <= nk; i++)
 		Bprint(kbmap, "%d\t%d\t%d\n", k[i].e, k[i].c, k[i].r);
 	Bflush(kbmap);
+
+	return 0;
 }
 
 static void
@@ -156,7 +158,7 @@
 		if(strcmp(t[4], "current") == 0)
 			kmset();
 		else if(strcmp(t[4], "notcurrent") == 0)
-			kmreset();
+			kmreset(nil, nil);
 
 		print("wctl %s %s\n", t[4], t[5]);
 	}
@@ -264,7 +266,7 @@
 
 	if((kbmap = Bopen("/dev/kbmap", OWRITE)) == nil)
 		sysfatal("%r");
-	atexit(kmreset);
+	threadnotify(kmreset, 1);
 
 	snprint(tmp, sizeof(tmp), "-pid %d -dx %d -dy %d", getpid(), 256, 256);
 	newwindow(tmp);