ref: a11a922f34e04e8ebc4a8bc6d7f7123ab7bf6585
dir: /rio-exit/
diff -r c055db14ff2b sys/src/cmd/rio/dat.h --- a/sys/src/cmd/rio/dat.h Sun Dec 06 14:50:50 2020 +0100 +++ b/sys/src/cmd/rio/dat.h Sun Dec 06 15:36:58 2020 +0100 @@ -308,6 +308,7 @@ Display *display; Image *view; Screen *wscreen; +Cursor confirmcursor; Cursor boxcursor; Cursor crosscursor; Cursor sightcursor; diff -r c055db14ff2b sys/src/cmd/rio/data.c --- a/sys/src/cmd/rio/data.c Sun Dec 06 14:50:50 2020 +0100 +++ b/sys/src/cmd/rio/data.c Sun Dec 06 15:36:58 2020 +0100 @@ -10,6 +10,19 @@ #include "dat.h" #include "fns.h" +Cursor confirmcursor={ + 0, 0, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + + 0x00, 0x0E, 0x07, 0x1F, 0x03, 0x17, 0x73, 0x6F, + 0xFB, 0xCE, 0xDB, 0x8C, 0xDB, 0xC0, 0xFB, 0x6C, + 0x77, 0xFC, 0x00, 0x00, 0x00, 0x01, 0x00, 0x03, + 0x94, 0xA6, 0x63, 0x3C, 0x63, 0x18, 0x94, 0x90, +}; + Cursor crosscursor = { {-7, -7}, {0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, 0x03, 0xC0, diff -r c055db14ff2b sys/src/cmd/rio/rio.c --- a/sys/src/cmd/rio/rio.c Sun Dec 06 14:50:50 2020 +0100 +++ b/sys/src/cmd/rio/rio.c Sun Dec 06 15:36:58 2020 +0100 @@ -26,6 +26,7 @@ void hide(void); void unhide(int); void newtile(int); +void confirmexit(void); Image* sweep(void); Image* bandsize(Window*); Image* drag(Window*); @@ -124,10 +125,6 @@ Image *i; Rectangle r; - if(strstr(argv[0], ".out") == nil){ - menu3str[Exit] = nil; - Hidden--; - } initstr = nil; kbdin = nil; maxtab = 0; @@ -731,11 +728,8 @@ hide(); break; case Exit: - if(Hidden > Exit){ - send(exitchan, nil); - break; - } - /* else fall through */ + confirmexit(); + break; default: unhide(i); break; @@ -1006,6 +1000,26 @@ } void +confirmexit(void) +{ + menuing = TRUE; + riosetcursor(&confirmcursor); + while(mouse->buttons == 0) + readmouse(mousectl); + if(mouse->buttons != 4) + goto nope; + while(mouse->buttons){ + if(mouse->buttons != 4) + goto nope; + readmouse(mousectl); + } + send(exitchan, nil); +nope: + riosetcursor(nil); + menuing = FALSE; +} + +void resize(void) { Window *w;