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_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 30139 invoked from network); 19 Jan 2021 00:50:22 -0000 Received: from 1ess.inri.net (216.126.196.35) by inbox.vuxu.org with ESMTPUTF8; 19 Jan 2021 00:50:22 -0000 Received: from mail-ed1-f49.google.com ([209.85.208.49]) by 1ess; Mon Jan 18 19:22:43 -0500 2021 Received: by mail-ed1-f49.google.com with SMTP id f1so5395228edr.12 for <9front@9front.org>; Mon, 18 Jan 2021 16:22:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=39TyIrdfkP6qDyx4Buc2N32Rw/pADVJb6HFik8RA4Pw=; b=Oe1LbcgYgiZI6B6Gqbwoai5YGOm9WOLFllxN1vclIlJm+E7TQfaKMnICSoZ4dGK/U2 v+UIaCUM6kIGoiU0k1H5q7pYtZ0+GYLs9ZlT9cdIu8qmaAWvVq+Tt0BZcaK3heJjpegG oVygzNfbZE+lE98j4VgZa2cwGAX81bOtjj78DRpo5Ycf8WxU41iB5LgSlpCL1xlDe8al Fpl72k9s2LeLWFEkArF4hT0YGV75sqrMbbB05hZXgTVCsrg4e+bffnG7qMq+C9lSCzE/ I4E/1/sedVFHbsXyIVHfzL9pJTDtGM4MdI1yBdgUY6lYnLqfwLMpCsPdJAOcUnWdgv7o 3EfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=39TyIrdfkP6qDyx4Buc2N32Rw/pADVJb6HFik8RA4Pw=; b=rf7a1gV5gDdJWt+wLKC0N3wi5SrqtR+sG800AcMMvXpjXs+6JousEBbCwuySfeaHQA JIfTNS22HX7xtKuM3WglQTUDs7LYx67z6iSnI2OXeB0++HrKOqhR42CEUE34NpExCiOk yXk2BhhPj/KpfKkhoK1kKRsNVR8I4csLQe2NyQD7TZ/KISVY3+KNL5089CBmvdkif72u bfA2Ka5A0Ch+/MekOuCjgGMqU5+1MbA4wLW6nFCXAcgy0TvNpu1GDI3ghBF/0YCR2zMJ Z3QF23H7rTZ6p8sboNZuX5xgRO65FIIv1PN5B9HVPMVVvkz9mDSuG7kmSdUuilpTOHF7 VRbw== X-Gm-Message-State: AOAM532MSYTNMwnVmMzIMnsOycigiqGI88Xw9CAL1Ja9YrM8fAgQiJdF pPfb0qXQrT9JwL/HwvDJW3ZnR94bt4RbyEzWiPLCsEMYBqk= X-Google-Smtp-Source: ABdhPJzXpJjg5R/kuJkziLnqHAthuJFNC/dnwMlnsfQi7b2eKMAusy2fE9XHPKlET5Tfc42hz/Z7PGt5iXrKhvjuAhI= X-Received: by 2002:a50:84e7:: with SMTP id 94mr1463053edq.87.1611015753273; Mon, 18 Jan 2021 16:22:33 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a17:906:c1b:b029:300:a1a3:c7b6 with HTTP; Mon, 18 Jan 2021 16:22:32 -0800 (PST) From: Stuart Morrow Date: Tue, 19 Jan 2021 00:22:32 +0000 Message-ID: To: 9front@9front.org Content-Type: text/plain; charset="UTF-8" List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: self-healing virtual descriptor singleton extension Subject: [9front] rio-dependence of screenlock Reply-To: 9front@9front.org Precedence: bulk How screenlock works: 1. Get screen size 2. Create new Rio window with that size, ignore return value 3. for(;;) warp mouse to centre. There are two ways to do 1. From the shell, they are: A% file /dev/screen B% awk '{print $7"x"$8}' /dev/draw/new Screenlock uses A. On the system console, you can in fact run screenlock by binding any static image over stub(4)'s /dev/screen. Recall that we don't check if we *actually got* a Rio window. My patch uses B. Runs on the system console just fine. In a nested Rio, no different from current. It also tops itself so that a popup's right-click menu can't be used to delete it. Popups aren't really the style on Plan 9, but one can easily imagine a script that catches kprints and tops a normally-hidden window. I'll throw you a quid, whoever writes that. I'd like to test that I know how to use Bitcoin, which seems the best way to do bounties (everyone can verify in blockchain.info, or in a local copy of the blockchain, that the payment was made and received). Or Bitcoin Cash if you insist on something you can actually run on Plan 9. diff -r 63eee0700f09 sys/src/cmd/screenlock.c --- a/sys/src/cmd/screenlock.c Sun Jan 17 14:02:17 2021 +0100 +++ b/sys/src/cmd/screenlock.c Mon Jan 18 23:54:12 2021 +0000 @@ -17,6 +17,7 @@ exits("usage"); } +/* ^D, Delete, Enter, Backspace, ^U */ void readline(char *buf, int nbuf) { @@ -116,27 +117,38 @@ } void +top(void*) +{ + int fd; + + if((fd = open("/dev/wctl", OWRITE)) < 0) + return; + + for(;;){ + write(fd, "current", 7); + sleep(500); + } +} + +void lockscreen(void) { - enum { Nfld = 5, Fldlen = 12, Cursorlen = 2*4 + 2*2*16, }; + enum { Cursorlen = 2*4 + 2*2*16 }; char *s; - char buf[Nfld*Fldlen], *flds[Nfld], newcmd[128], cbuf[Cursorlen]; + char newcmd[128], cbuf[Cursorlen]; int fd, dx, dy; Image *i; Point p; Rectangle r; Tm *tm; - if((fd = open("/dev/screen", OREAD)) < 0) - sysfatal("can't open /dev/screen: %r"); - if(read(fd, buf, Nfld*Fldlen) != Nfld*Fldlen) - sysfatal("can't read /dev/screen: %r"); - close(fd); - buf[sizeof buf-1] = 0; - if(tokenize(buf, flds, Nfld) != Nfld) - sysfatal("can't tokenize /dev/screen header"); - snprint(newcmd, sizeof newcmd, "-r %s %s %s %s", - flds[1], flds[2], flds[3], flds[4]); + display = initdisplay(nil, nil, nil); + if(display == nil) + sysfatal("can't open /dev/draw: %r"); + r = display->image->r; + snprint(newcmd, sizeof newcmd, "-r %d %d %d %d", + r.min.x, r.min.y, r.max.x, r.max.y); + closedisplay(display); newwindow(newcmd); if((fd = open("/dev/consctl", OWRITE)) >= 0) @@ -179,6 +191,7 @@ flushimage(display, 1); /* screen is now open and covered. grab mouse and hold on tight */ + procrfork(top, nil, 8*1024, RFFDG); procrfork(grabmouse, nil, 8*1024, RFFDG); procrfork(blanker, nil, 8*1024, RFFDG);