about summary refs log tree commit diff stats
path: root/p9c
diff options
context:
space:
mode:
authorelioat <hi@eli.li>2023-05-26 11:29:54 -0400
committerelioat <hi@eli.li>2023-05-26 11:29:54 -0400
commit24f64a3708904660fb9c07b3c9ea31734e0f8088 (patch)
treeeb54d7bb766d5c36d2c91cc9f6c2517b7f98b947 /p9c
parentf583009ffae825c66a9dda7838820d3a9f19adf1 (diff)
downloadtour-24f64a3708904660fb9c07b3c9ea31734e0f8088.tar.gz
"*"
Diffstat (limited to 'p9c')
-rwxr-xr-xp9c/scratch/mousebin0 -> 191138 bytes
-rw-r--r--p9c/scratch/mouse.c18
2 files changed, 15 insertions, 3 deletions
diff --git a/p9c/scratch/mouse b/p9c/scratch/mouse
new file mode 100755
index 0000000..43d836a
--- /dev/null
+++ b/p9c/scratch/mouse
Binary files differdiff --git a/p9c/scratch/mouse.c b/p9c/scratch/mouse.c
index 214526a..80bfb00 100644
--- a/p9c/scratch/mouse.c
+++ b/p9c/scratch/mouse.c
@@ -3,6 +3,10 @@
 #include <draw.h>
 #include <event.h>
 
+char* options[] = {"Right Click", "", "Option3", "Option4", "Exit", 0};
+
+Menu rightmenu = {options};
+
 void
 eresized(int new)
 {
@@ -13,19 +17,27 @@ eresized(int new)
 void
 main(int argc, char* argv[])
 {
-	// USED(argc, argv);
 
 	Mouse m;
+	Event ev;
+	int e;
 	Point prevm;
+
 	initdraw(0, 0, "Example: Mouse");
 	eresized(0);
 	einit(Emouse);
 
 	/* Main loop */
 	for(;;) {
+		e = event(&ev);
 		m = emouse();
-		if(m.buttons & 4)
-			break;
+		if((e == Emouse) && (m.buttons & 4))
+			if(emenuhit(3, &ev.mouse, &rightmenu) == 2)
+				print("Pressed Option 3\n");
+			if(emenuhit(3, &ev.mouse, &rightmenu) == 3)
+				print("Pressed Option 4\n");
+			if(emenuhit(3, &ev.mouse, &rightmenu) == 4)
+				exits(nil);
 		if(m.buttons & 1) {
 			line(screen,
 			     prevm.x == -1 ? m.xy : prevm,