summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio/rio.c
diff options
context:
space:
mode:
authorJacob Moody <moody@posixcafe.org>2022-08-18 11:44:46 +0000
committerJacob Moody <moody@posixcafe.org>2022-08-18 11:44:46 +0000
commitf508dfaab17c0ec9519078db82c9d5b5f1ba76a5 (patch)
tree54554fde6aab9c55c14f5d1242096573b572a74a /sys/src/cmd/rio/rio.c
parente7d03d19100fe3180906c8ce3f2cab3ba9387fe8 (diff)
rio: require a confirmation for Exit
Even accidentally killing a subrio can be annoying. So instead of only showing this on subrios, show it always but always require an additional click to actually exit.
Diffstat (limited to 'sys/src/cmd/rio/rio.c')
-rw-r--r--sys/src/cmd/rio/rio.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/sys/src/cmd/rio/rio.c b/sys/src/cmd/rio/rio.c
index ce64baba7..9d666bf15 100644
--- a/sys/src/cmd/rio/rio.c
+++ b/sys/src/cmd/rio/rio.c
@@ -26,6 +26,7 @@ void delete(void);
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 @@ threadmain(int argc, char *argv[])
Image *i;
Rectangle r;
- if(access("/dev/wctl", AEXIST) != 0){
- menu3str[Exit] = nil;
- Hidden--;
- }
initstr = nil;
kbdin = nil;
maxtab = 0;
@@ -786,11 +783,8 @@ button3menu(void)
hide();
break;
case Exit:
- if(Hidden > Exit){
- send(exitchan, nil);
- break;
- }
- /* else fall through */
+ confirmexit();
+ break;
default:
unhide(i);
break;
@@ -1061,6 +1055,26 @@ delete(void)
}
void
+confirmexit(void)
+{
+ menuing = TRUE;
+ riosetcursor(&skull);
+ 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;