shithub: orca

Download patch

ref: 61ab152b804d8a176da1c82008b177ca3ce5bbe2
parent: 907f4a7e48d8783d27a1a96d019c80d2da033c77
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Thu May 14 13:18:28 EDT 2020

plan9: don't just quit on exit menu hit, ask for confirmation

--- a/plan9.c
+++ b/plan9.c
@@ -8,6 +8,7 @@
 #include <keyboard.h>
 #include <thread.h>
 #include <plumb.h>
+#include <cursor.h>
 
 #define MIN(x,y) ((x)<=(y)?(x):(y))
 #define MAX(x,y) ((x)>=(y)?(x):(y))
@@ -103,6 +104,20 @@
 static int numsnaps, nextsnap;
 static int maxsnaps = 100;
 
+Cursor quitcursor = {
+	{0, 0},
+	{ 0xf7, 0xfe, 0x15, 0x54, 0x1d, 0x54, 0x09, 0x54,
+	  0x09, 0xdc, 0x00, 0x00, 0x75, 0x77, 0x45, 0x54,
+	  0x75, 0x66, 0x15, 0x54, 0x77, 0x57, 0x00, 0x00,
+	  0x00, 0x02, 0x2a, 0x84, 0x11, 0x28, 0x2a, 0x90,
+	},
+	{ 0xea, 0x2b, 0xea, 0xab, 0xe2, 0xab, 0xf6, 0xab,
+	  0xf6, 0x23, 0xff, 0xff, 0x8a, 0x88, 0xba, 0xab,
+	  0x8a, 0x99, 0xea, 0xab, 0x88, 0xa8, 0xff, 0xff,
+	  0xff, 0xfd, 0xd5, 0x7b, 0xee, 0xd7, 0xd5, 0x6f,
+	},
+};
+
 static struct {
 	struct {
 		char *menu;
@@ -1575,7 +1590,16 @@
 				} else if (n == Menu3colors) {
 					proccreate(colorsproc, nil, mainstacksize);
 				} else if (n == Menu3exit) {
-					goto end;
+					setcursor(mctl, &quitcursor);
+					for (;;) {
+						if (recv(mctl->c, &m) == 1) {
+							if (m.buttons == 4)
+								goto end;
+							if (m.buttons)
+								break;
+						}
+					}
+					setcursor(mctl, nil);
 				}
 				complete = true;
 			} else {