From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 1624 invoked from network); 4 Aug 2022 20:20:23 -0000 Received: from 9front.inri.net (168.235.81.73) by inbox.vuxu.org with ESMTPUTF8; 4 Aug 2022 20:20:23 -0000 Received: from wopr.sciops.net ([216.126.196.60]) by 9front; Thu Aug 4 16:18:42 -0400 2022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sciops.net; s=20210706; t=1659644271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to; bh=TM7Ld1yoSpKA2cMKa4P0geLF+owEbX5bsNxmSIOdMGY=; b=cZACtDtcTwU01Vjs2Xed9vGFgVkuGXpwSBivNn0FnrOuIYwmOLlXY8pq4VElQe+xtkz1dF bLVsrWfJ0tac4zJT2OfNB1/XHh0eeBlC0+pCZaeHvp11oYb9zluUUV7U6pHDuv2QiyRHYi U4LRSnLJFW5hX0+30bp0RGrJbelB53M= Received: by wopr.sciops.net (OpenSMTPD) with ESMTPSA id c537a815 (TLSv1.2:ECDHE-RSA-CHACHA20-POLY1305:256:NO) for <9front@9front.org>; Thu, 4 Aug 2022 13:17:51 -0700 (PDT) Message-ID: Date: Thu, 04 Aug 2022 22:18:35 +0200 From: qwx@sciops.net To: 9front@9front.org In-Reply-To: <9009aa07-2c7a-9dee-7b3c-63bb01af31f9@posixcafe.org> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: service deep-learning app storage control Subject: Re: [9front] [PATCH] better rio exit menu entry check Reply-To: 9front@9front.org Precedence: bulk On Thu Aug 4 16:36:38 +0200 2022, moody@mail.posixcafe.org wrote: > Checking for if the binary name contains .out always seemed a bit > like a hack. What I seem to want most of the time is for the > Exit option to show up on subrios, but not my "main" rio. > This patch does this by checking for an existing > rio mounted on /mnt/wsys. I've been using subrios heavily for years now, and I find that an Exit entry is massively useful for me, but with a safeguard: a second click for confirmation like in mothra. Thanks to this, I have never had an accidental discharge despite being a total klutz. Personally I'd prefer the Exit to be present regardless of context, but this is a nice idea. Cheers, qwx 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;