* [9fans] rotzoomer -- another xscreensaver hack @ 2003-01-21 7:06 andrey mirtchovski 0 siblings, 0 replies; 11+ messages in thread From: andrey mirtchovski @ 2003-01-21 7:06 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: TEXT/PLAIN, Size: 544 bytes --] saw this on somebody else's machine and just wanted to have it... the best way to see it is to start in a small window and then resize to full screen as soon as it has grabbed the screenshot. it didn't take that long to convert all the X calls to draw ones, but much longer to clean it up into viewable form. i'm sure i haven't cleaned everything :) the non-plan9 code is gnu, so have that in mind if you decide to play with it. andrey ps: other xscreensaver stuff for plan9: http://www.acl.lanl.gov/plan9/xscreensaver [-- Attachment #2: Type: APPLICATION/octet-stream, Size: 99848 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* [9fans] rotzoomer -- another xscreensaver hack @ 2003-01-21 7:02 andrey mirtchovski 2003-01-21 10:17 ` geoff 2003-01-21 17:32 ` Russ Cox 0 siblings, 2 replies; 11+ messages in thread From: andrey mirtchovski @ 2003-01-21 7:02 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: TEXT/PLAIN, Size: 534 bytes --] i saw this one on somebody else's computer and just wanted to have it :) start it up in a small window and then resize to full screen for complete satisfaction... it doesn't take all that much to convert the X drawing calls to draw ones, took me longer to clean it up into some sort of viewable form. i'm sure i haven't managed to do so completely. non-plan9 code is GNU, so have that in mind if you decide to play with it. andrey ps: other xscreensaver hacks here: http://www.acl.lanl.gov/plan9/xscreensaver/ [-- Attachment #2: Type: APPLICATION/octet-stream, Size: 99848 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 7:02 andrey mirtchovski @ 2003-01-21 10:17 ` geoff 2003-01-21 15:03 ` andrey mirtchovski 2003-01-21 17:32 ` Russ Cox 1 sibling, 1 reply; 11+ messages in thread From: geoff @ 2003-01-21 10:17 UTC (permalink / raw) To: 9fans I've got a sped-up version of rotzoomer at http://collyer.net/~geoff/9, along with faster (though still slow) versions of maze and mandel. I also found a few bugs in maze by inspection and fixed them. I suspect that rotzoomer should build up new images in memory and push them out in large fractions of a window, rather than pixel by pixel. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 10:17 ` geoff @ 2003-01-21 15:03 ` andrey mirtchovski 2003-01-21 21:49 ` geoff 0 siblings, 1 reply; 11+ messages in thread From: andrey mirtchovski @ 2003-01-21 15:03 UTC (permalink / raw) To: 9fans that's how it originally operated. i didn't find it too fast on my own machine and opted for simplicity... do you want me to add your modifications to www.acl.lanl.gov's xscreensaver archive? i just tried your web site and the link to rotzoomer.bun appears to be broken... On Tue, 21 Jan 2003 geoff@collyer.net wrote: > I've got a sped-up version of rotzoomer at > http://collyer.net/~geoff/9, along with faster (though still slow) > versions of maze and mandel. I also found a few bugs in maze by > inspection and fixed them. > > I suspect that rotzoomer should build up new images in memory and push > them out in large fractions of a window, rather than pixel by pixel. > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 15:03 ` andrey mirtchovski @ 2003-01-21 21:49 ` geoff 0 siblings, 0 replies; 11+ messages in thread From: geoff @ 2003-01-21 21:49 UTC (permalink / raw) To: 9fans > do you want me to add your modifications to www.acl.lanl.gov's > xscreensaver archive? Sure, that would be fine. > i just tried your web site and the link to rotzoomer.bun appears to be > broken... Sorry about that; I had the link working and then broke it. It's fixed now. I've also incorporated your suggested changes into my rotzoomer bundle. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 7:02 andrey mirtchovski 2003-01-21 10:17 ` geoff @ 2003-01-21 17:32 ` Russ Cox 2003-01-21 17:43 ` andrey mirtchovski 2003-01-21 18:42 ` Scott Schwartz 1 sibling, 2 replies; 11+ messages in thread From: Russ Cox @ 2003-01-21 17:32 UTC (permalink / raw) To: 9fans you know, you could read /dev/vgactl in a daemon to figure out how long the terminal has been idle and then invoke the screensaver automatically. if you were into that sort of thing. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 17:32 ` Russ Cox @ 2003-01-21 17:43 ` andrey mirtchovski 2003-01-21 17:55 ` Russ Cox 2003-01-21 18:42 ` Scott Schwartz 1 sibling, 1 reply; 11+ messages in thread From: andrey mirtchovski @ 2003-01-21 17:43 UTC (permalink / raw) To: 9fans I don't know how to write over the entire screen instead of just in a window... plus, I'm not sure whether rio will be forgiving enough if I sidestep it, or whether you guys will accept modified rio sources (like adding extra controls to rio itself) i wouldn't mind converting all those hacks into screensavers, just never really thought about it seriously enough.. On Tue, 21 Jan 2003, Russ Cox wrote: > you know, you could read /dev/vgactl in a daemon > to figure out how long the terminal has been idle > and then invoke the screensaver automatically. > > if you were into that sort of thing. > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 17:43 ` andrey mirtchovski @ 2003-01-21 17:55 ` Russ Cox 0 siblings, 0 replies; 11+ messages in thread From: Russ Cox @ 2003-01-21 17:55 UTC (permalink / raw) To: 9fans you don't need to write to the screen. allocate a new window as big as the screen. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 17:32 ` Russ Cox 2003-01-21 17:43 ` andrey mirtchovski @ 2003-01-21 18:42 ` Scott Schwartz 2003-01-21 18:55 ` Russ Cox 2003-01-21 19:00 ` rob pike, esq. 1 sibling, 2 replies; 11+ messages in thread From: Scott Schwartz @ 2003-01-21 18:42 UTC (permalink / raw) To: 9fans Russ writes: > if you were into that sort of thing. Let me put in a vote for the opposite sort of thing: using DPMS to powersave the monitor. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 18:42 ` Scott Schwartz @ 2003-01-21 18:55 ` Russ Cox 2003-01-21 19:00 ` rob pike, esq. 1 sibling, 0 replies; 11+ messages in thread From: Russ Cox @ 2003-01-21 18:55 UTC (permalink / raw) To: 9fans > Let me put in a vote for the opposite sort of thing: using DPMS to powersave > the monitor. every time i have tried to do dpms by the vesa spec, the screens never come back correctly when i turn them back on. the code is in /sys/src/9/pc/vga.c:/^vgablank, but it breaks so many setups that it's not used. some video cards have their own ways to get at dpms (see /sys/src/9/pc/vgasavage.c:/^savageblank, also s3, mga6xx, nvidia) and that seems to work better. it's still not perfect though. mach64xx, for example, doesn't behave right even using the mach64xx-specific blanking. it's just a nightmare. the lcds tend to work better because they have an explicit signal to do blanking rather than infer something from the horizontal and vertical sync pulses. both laptops and digital cards like t2r4 seem to work well. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [9fans] rotzoomer -- another xscreensaver hack 2003-01-21 18:42 ` Scott Schwartz 2003-01-21 18:55 ` Russ Cox @ 2003-01-21 19:00 ` rob pike, esq. 1 sibling, 0 replies; 11+ messages in thread From: rob pike, esq. @ 2003-01-21 19:00 UTC (permalink / raw) To: 9fans [-- Attachment #1: Type: text/plain, Size: 324 bytes --] On a related note, here's a screen locker. I intended to wrap it in a shell script to watch the idle time in vgactl but bounced off a bug in an early version of that code and never returned. I just run it by hand. /lib/bunny.bit is a cropped version of glenda from the web site and too large to attach here. -rob [-- Attachment #2: lock.c --] [-- Type: text/plain, Size: 5802 bytes --] #include <u.h> #include <libc.h> #include <libsec.h> #include <draw.h> char pic[] = "/lib/bunny.bit"; int vgactl; int debug; uchar storedhash[SHA1dlen]; uchar thishash[SHA1dlen]; char user[256]; char home[256]; char hashfile[256]; void error(char *fmt, ...) { Fmt f; char buf[64]; va_list arg; fmtfdinit(&f, 1, buf, sizeof buf); fmtprint(&f, "lock: "); va_start(arg, fmt); fmtvprint(&f, fmt, arg); va_end(arg); fmtprint(&f, "\n"); fmtfdflush(&f); postnote(PNGROUP, getpid(), "die"); exits("fatal error"); } void usage(void) { fprint(2, "usage: lock [-p]\n"); exits("usage"); } void readfile(char *name, char *buf, int nbuf, int addnul) { int fd; fd = open(name, OREAD); if(fd == -1) error("%s: can't open: %r", name); nbuf = read(fd, buf, nbuf-addnul); close(fd); if(nbuf == -1) error("%s: can't can't read: %r", name); if(addnul) buf[nbuf] = '\0'; } int readstoredhash(int mustexist) { if(access(hashfile, AEXIST) < 0){ if(!mustexist) return 0; error("no password set; use lock -p to set password"); } readfile(hashfile, (char*)storedhash, sizeof storedhash, 0); return 1; } void readline(char *buf, int nbuf) { char c; int i; i = 0; while(i < nbuf-1){ if(read(0, &c, 1) != 1 || c == '\04' || c == '\177'){ buf[0] = '\0'; return; } if(c == '\n'){ buf[i] = '\0'; return; } if(c == '\b' && i > 0){ --i; continue; } if(c == '\025'){ i = 0; continue; } buf[i++] = c; } } void checkpassword(int must) { char buf[256]; static int opened; int fd, consctl; if(!opened){ fd = open("/dev/cons", OREAD); if(fd == -1) error("can't open cons: %r"); dup(fd, 0); close(fd); fd = open("/dev/cons", OWRITE); if(fd == -1) error("can't open cons: %r"); dup(fd, 1); dup(1, 2); close(fd); consctl = open("/dev/consctl", OWRITE); if(consctl == -1) error("can't open consctl: %r"); if(write(consctl, "rawon", 5) != 5) error("can't turn off echo\n"); opened = 1; } for(;;){ fprint(2, "password: "); readline(buf, sizeof buf); fprint(2, "\n"); if(buf[0] == '\0' || buf[0] == '\04'){ if(must) continue; error("no password typed"); } sha1((uchar*)buf, strlen(buf), thishash, nil); memset(buf, 0, sizeof buf); if(memcmp(thishash, storedhash, sizeof storedhash) == 0) break; fprint(2, "password mismatch\n"); } } void changepassword(void) { int fd; char buf[256]; if(readstoredhash(0)) checkpassword(0); for(;;){ fprint(2, "password: "); readline(buf, sizeof buf); fprint(2, "\n"); if(buf[0] == '\0' || buf[0] == '\04') exits("no password typed"); sha1((uchar*)buf, strlen(buf), thishash, nil); memset(buf, 0, sizeof buf); fprint(2, "re-type password: "); readline(buf, sizeof buf); fprint(2, "\n"); if(buf[0] == '\0' || buf[0] == '\04') exits("no password typed"); sha1((uchar*)buf, strlen(buf), storedhash, nil); memset(buf, 0, sizeof buf); if(memcmp(storedhash, thishash, sizeof storedhash) != 0){ fprint(2, "password mismatch\n"); continue; } fd = create(hashfile, OWRITE, 0600); if(fd < 0) error("can't create hashfile: %r"); if(write(fd, storedhash, sizeof storedhash) != sizeof storedhash) error("error writing hashfile: %r"); break; } } void grabmouse(void) { int fd; char ibuf[256], obuf[256]; if(debug) return; fd = open("/dev/mouse", ORDWR); if(fd < 0) error("can't open /dev/mouse: %r"); switch(fork()){ case -1: error("can't fork mouse process: %r"); default: return; case 0: break; } snprint(obuf, sizeof obuf, "m %d %d", screen->r.min.x+Dx(screen->r)/2, screen->r.min.y+Dy(screen->r)/2); while(read(fd, ibuf, sizeof ibuf) > 0) fprint(fd, "%s", obuf); } void lockscreen(void) { enum { Nfld=5, Fldlen = 12 }; char buf[Nfld*Fldlen], *flds[Nfld], newcmd[128]; enum { Cursorlen=2*4+2*2*16 }; char cbuf[Cursorlen]; int fd, dx, dy; Image *i; Rectangle r; fd = open("/dev/screen", OREAD); if(fd < 0) error("can't open /dev/screen: %r"); if(read(fd, buf, Nfld*Fldlen) != Nfld*Fldlen) error("can't read /dev/screen: %r"); close(fd); buf[sizeof buf-1] = 0; if(tokenize(buf, flds, Nfld) != Nfld) error("can't tokenize /dev/screen header"); snprint(newcmd, sizeof newcmd, "-r %s %s %d %d", flds[1], flds[2], atoi(flds[3])-1, atoi(flds[4])-1); newwindow(newcmd); initdraw(nil, nil, "lock"); /* screen is now open and covered. grab mouse and hold on tight */ grabmouse(); fd = open(pic, OREAD); if(fd > 0){ i = readimage(display, fd, 0); if(i){ r = screen->r; dx = (Dx(screen->r)-Dx(i->r))/2; r.min.x += dx; r.max.x -= dx; dy = (Dy(screen->r)-Dy(i->r))/2; r.min.y += dy; r.max.y -= dy; draw(screen, r, i, nil, i->r.min); flushimage(display, 1); } close(fd); } /* clear the cursor */ fd = open("/dev/cursor", OWRITE); if(fd > 0){ memset(cbuf, 0, sizeof cbuf); write(fd, cbuf, sizeof cbuf); /* leave it open */ } fprint(vgactl, "blank"); } void main(int argc, char *argv[]) { readfile("#c/user", user, sizeof user, 1); readfile("#e/home", home, sizeof home, 1); snprint(hashfile, sizeof hashfile, "%s/lib/lockhash", home); vgactl = open("#v/vgactl", OWRITE); if(vgactl == -1) error("can't open vgactl: %r"); ARGBEGIN{ case 'd': debug++; break; case 'p': changepassword(); exits(nil); default: usage(); }ARGEND if(argc != 0) usage(); readstoredhash(1); rfork(RFNOTEG); lockscreen(); checkpassword(1); postnote(PNGROUP, getpid(), "die"); exits(nil); } ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2003-01-21 21:49 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2003-01-21 7:06 [9fans] rotzoomer -- another xscreensaver hack andrey mirtchovski -- strict thread matches above, loose matches on Subject: below -- 2003-01-21 7:02 andrey mirtchovski 2003-01-21 10:17 ` geoff 2003-01-21 15:03 ` andrey mirtchovski 2003-01-21 21:49 ` geoff 2003-01-21 17:32 ` Russ Cox 2003-01-21 17:43 ` andrey mirtchovski 2003-01-21 17:55 ` Russ Cox 2003-01-21 18:42 ` Scott Schwartz 2003-01-21 18:55 ` Russ Cox 2003-01-21 19:00 ` rob pike, esq.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).