about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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,