Page 1 of 1

Sleep desk accessory

Posted: January 16th, 1985, 12:44 am
by Info-Mac
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site uw-beaver
Path: utzoo!watmath!clyde!cbosgd!ulysses!mhuxr!mhuxt!mhuxj!houxm!vax135!cornell!uw-beaver!info-mac
From: info-mac@uw-beaver
Newsgroups: fa.info-mac
Subject: Sleep desk accessory
Message-ID:
Date: Fri, 21-Dec-84 18:20:22 EST
Article-I.D.: uw-beave.278
Posted: Fri Dec 21 18:20:22 1984
Date-Received: Sat, 22-Dec-84 07:37:42 EST
Sender: daemon@uw-beaver
Organization: U of Washington Computer Science
Lines: 508

From: Walter.Smith@CMU-CS-K

[EDITOR: Please remove the data from the bottom of this message and
archive it (as SLEEP.HCX and SLEEP.SH, I suppose). Thanks.]

I have written a desk accessory reminiscent of the Xerox memory test
programs; it clears the screen completely and bounces an apple character
randomly about the screen. It doesn't actually test memory or anything,
but it keeps your display from being burned in. It lasts until you click
the mouse, then restores the screen.

So far it works with everything except MacTerminal. I don't know why
MacTerm doesnt like it. If anyone knows, please tell me.

Included in this message are two files: a Desk Accessory Mover 1.4 file
containing the accessory, and a shell archive containing the source (it
requires the traditional desk and device.h).

- Walter Smith (wrs@cmu-cs-k)

------------sleep.hcx----------------------
(This file must be converted with BinHex.Hex)
#DESKDAMV$0000
***COMPRESSED
***DATA FORK
( - )3 53;&5EI)"A?( QF"$AMOHBH46 .#&P 0!L
(&\&2&V^B*A1*%].7DYU3E8 $)G3KH$A! ?0JX #$Y>
("Z?3G5.5O[>3KK_LJFT0FDAN_N*I+#U?__XP+O_^4T!G%%-
(&DAM_I"I)6 20 0! R
( "0 #P 0 #( X #0 -@ R 8 4VQE97
( & L K@
(
( $CG__]#^O^:(@E#^O_()%G5P1X2 H(#P$ %J8!8@/ 0 :!@#B \
( 0 ;1@!B \'0 !R$CG/_PO"2\(($!.D%"/3-\__ R
($ !F!$* 3G4O.0 "/Q.=0# !.5O_\2.X /_\
($IY!@ (=&8N2&[__$ZY! $(%B/+SP# B$3KD& 0
(%B/+R[__$ZY!0 $$%B/,_P 14 "'0@;@ ,2J@ 'F8&
("\(87Y8CR \0 $Y>3G5.5@ 2.X +SD# CT
($ZY" %(%B/(&X #$*H !Y">0, "').N3
($YU3E;__$CN #__"\\ !@2\\ " B\\_____B\\
(/____XO/ , "'A.N14 !*#?_ !0O/ O/
( !+SS_____+SP "+SP !+SP# AH+SP& AX
("\\ $ZY!@ %$-_\ ("/ !P (]"!N @A0 >
("\Y P (]$ZY! $$%B/+SP# AX3KD' 3 6(\O/
( *3KD' 106(\O/ I.N008 "/0S: 8 &PO/ , "(1.N00
( 006(\O/ , "'A.N00 !+!8CTZY P $,$ZY! $X& :
($ZY!P $X+"N__QM$F%:3KD( 3@!H \+4#__$ZY
( L !/!*@&?8+SP +SP "3KD$ 4 4(].N0,
( 1 0GD# AR+SD# CT3KD( 4@6(\@;@ (0J@ 'DZY
( H !3!.7DYU3E8 $CN "\Y P (]$ZY! $$%B/
($IY! (X #")N 0@&4(N
(/\ ,_Q.1P
( !YG#"\53KES >*6(]@X")5
(# 12, B@&#6,B[_ M)!,CL0!D[[$ ( '@ 0 !8 '@ >
( : !X 'C ?2,!@"" ?8 1"@! ?3.X@!/_X3EY8CTYU
( (E\@'S!?+PF@+S] 1.=2)?(!\O": R3G4B7S/?
( 41.T2)?(%\P'R\)H#!*0&3G4@7R)?0AD2N0 @@O"$YU0?D, C\
("%\ !@ D,7S__ 80J@ #$/Y>0 )/"%) " @'R(?
("\ ,OP 2+!H -.=4Y6_^!![O_@,7S__ [email protected]
(#\O 2IR"!?WOP D[0(&\ !#)\ 0&$H 9PH2$!#
(! !4HE@\B )(&\ !!" 3G4@;P $(DA"@! 84X!M"A+8
(&8"4XE1R/_X0A%.=2!O 1"@! 0T*
(.*! H!_____ H%_____#($ 0 ; #_Z(#! H /__
("\ +P-.N?\ "#A0C[2 ; *0@Y""1(!,WP ,3EY.=4Y6
( 2.L %@'K "&A@ ARX /*&
( !9B\ !X !6M 5K0
( " !8!ZP$& >P 5K4 $ ,7@! "[8
('@> @! '4X RL ._A_@! (K8@% !
(!U, $ 2+$13 P0 ! !0 &" &[@ ,?
(!AZ ,/_^0 , "#U $@
("?^ &% X"( #^]P &0A$ %[ !,'( ,!@ '_^#\
( &1Q$ %[ !,'( P 8 %__#\ 9/EP.!P3, $P0 5
( X@@ @" 4'GP@ ((( 1Q#^ &% !43(( $ @ %#XAP@ ((( (" $#
( 5$R! 00 !3R'" @0@ ?P 0, % L@0 $ 4X
((P 5 R # 8#^ 2 " P _X ! 1Q 7L $ (@ /[]
( !__CZ .( (4 F 4 1L!, $= 0 + "#T 4!4?Q4 0#_
(/__ )3 53;&5EI)"A?( QF"$AMOHBH46 .#&P 0!L
(&\&2&V^B*A1*%].7DYU3E8 $)G3KH$A! ?0JX #$Y>
("Z?3G5.5O[>3KK_LJFT0FDAN_N*I+#U?__XP+O_^4T!G%%-
(&DAM_I"I)6 20 0! R
!@
***END OF DATA
***CRC:3150
--------------cut-here---------------------

------------sleep.sh-----------------------
#
# type sh sleep.sh to unpack this archive.
#
echo extracting Makefile...
cat >Makefile $*.ln

sleep: sleep.b crtsleep.b
$(BIN)ld68 -X -r -d -e drvr -T 0 crtsleep.b sleep.b -lmac -lc68 -x -o sleep

desk: desk.b
$(BIN)cc68 -m desk.b -o desk

desk.rsrc: sleep desk desk.rc
$(BIN)rmaker desk.rc

all: desk.rsrc

put: desk.rsrc
$(BIN)macput -r desk

lint: sleep.ln desk.ln

desk.shar: $(CFILES) $(SFILES) $(HFILES)
csh shar desk.shar $(CFILES) $(SFILES) $(HFILES) desk.rc Makefile

clean:
rm -f *.b *.rsrc sleep desk
!E!O!F!
#
# type sh /usrk0/wrs/mac/cone/sleep to unpack this archive.
#
echo extracting crtsleep.s...
cat >crtsleep.s desk.rc sleep.c dCtlWindow) createWindow(dce);
return(IOrts);
}

/* Unfortunately, this routine never gets called... */
drvrClose(pb, dce)
ControlParam *pb;
struct dce *dce;
{
DisposeWindow(window);
dce->dCtlWindow = NIL;
pigvisible = 0;
DrawMenuBar();
return(IOrts);
}

drvrCtl(pb, dce)
ControlParam *pb;
struct dce *dce;
{
return(IOrts);
}

drvrStatus(pb, dce)
ControlParam *pb;
struct dce *dce;
{
return(IOrts);
}

drvrPrime(pb, dce)
ControlParam *pb;
struct dce *dce;
{
return(IOrts);
}

/* Real routines */

/* Create our window and wait for a click. */

createWindow(dce)
struct dce *dce;
{
int nextTick;

SetRect(&windowRect, -2, -2, 514, 385); /* a very large window */
window = NewWindow((WindowPeek) NIL, &windowRect, title, TRUE,
2, (WindowPtr) -1, TRUE, 0);
dce->dCtlWindow = window;

SetPort(window);
InvertRect(&windowRect); /* Black out all but the menu bar */
PenMode(patXor);
TextMode(patXor);
TextFont(0);
((WindowPeek) window)->windowKind = dce->dCtlRefNum;

SetPort(&bigport);
PaintRect(&windowRect); /* Kill off the menu bar, too */

HideCursor();
nextTick = TickCount();

/* Move the apple every second, waiting for a click */
for (;!Button();) {
if (TickCount() >= nextTick) {
doSomething();
nextTick = TickCount() + 60;
}
}
FlushEvents(mDownMask, 0); /* Kill the mouseDown event from the click */
ShowCursor();
pigvisible = 0;

DisposeWindow(window); /* Destroy the window */
dce->dCtlWindow = NIL;
DrawMenuBar(); /* and put the menu bar back */
}

/* Make random apples wander around the screen */
doSomething()
{
SetPort(window);
if (pigvisible) {
MoveTo(coneh, conev);
DrawChar('\024');
}
else pigvisible = 1;
coneh = (((unsigned) Random() & 0x7fff) % 450) + 20;
conev = (((unsigned) Random() & 0x7fff) % 320) + 40;
MoveTo(coneh, conev);
DrawChar('\024');
}
!E!O!F!

--------------------cut-here-------------------------