History

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

Sigrid Haflínudóttir committed 6 years ago

Commit 61ab1521 parent 907f4a71 file · +25 −1Browse files

Unified · Split

plan9.c+25−1
@@ -8,6 +8,7 @@ · 7 unmodified lines
88 #include <keyboard.h>
99 #include <thread.h>
1010 #include <plumb.h>
11+#include <cursor.h>
1112
1213 #define MIN(x,y) ((x)<=(y)?(x):(y))
1314 #define MAX(x,y) ((x)>=(y)?(x):(y))
@@ -103,6 +104,20 @@ static Snap *snaps; · 89 unmodified lines
103104 static int numsnaps, nextsnap;
104105 static int maxsnaps = 100;
105106
107+Cursor quitcursor = {
108+ {0, 0},
109+ { 0xf7, 0xfe, 0x15, 0x54, 0x1d, 0x54, 0x09, 0x54,
110+ 0x09, 0xdc, 0x00, 0x00, 0x75, 0x77, 0x45, 0x54,
111+ 0x75, 0x66, 0x15, 0x54, 0x77, 0x57, 0x00, 0x00,
112+ 0x00, 0x02, 0x2a, 0x84, 0x11, 0x28, 0x2a, 0x90,
113+ },
114+ { 0xea, 0x2b, 0xea, 0xab, 0xe2, 0xab, 0xf6, 0xab,
115+ 0xf6, 0x23, 0xff, 0xff, 0x8a, 0x88, 0xba, 0xab,
116+ 0x8a, 0x99, 0xea, 0xab, 0x88, 0xa8, 0xff, 0xff,
117+ 0xff, 0xfd, 0xd5, 0x7b, 0xee, 0xd7, 0xd5, 0x6f,
118+ },
119+};
120+
106121 static struct {
107122 struct {
108123 char *menu;
@@ -1575,7 +1590,16 @@ noredraw: · 1466 unmodified lines
15751590 } else if (n == Menu3colors) {
15761591 proccreate(colorsproc, nil, mainstacksize);
15771592 } else if (n == Menu3exit) {
1578− goto end;
1593+ setcursor(mctl, &quitcursor);
1594+ for (;;) {
1595+ if (recv(mctl->c, &m) == 1) {
1596+ if (m.buttons == 4)
1597+ goto end;
1598+ if (m.buttons)
1599+ break;
1600+ }
1601+ }
1602+ setcursor(mctl, nil);
15791603 }
15801604 complete = true;
15811605 } else {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t