[comp.sys.next] display postscript questions

dwatola@EECS.WSU.EDU (12/29/90)

i wrote a screensaver-type application that paints a large, all-black window
over the screen.  in doing so, in encountered a few problems that i cannot
explain--any dps gurus out there?

first, here is the code:

-------------------------- black.psw -----------------

defineps PSblackwindow()

/mywidth 1200 def /myheight 900 def 
/mywin 0 0 mywidth myheight Nonretained window def
Lmousedownmask Rmousedownmask Keydownmask Flagschangedmask
   or or or mywin seteventmask
Above frontwindow mywin orderwindow mywin windowdeviceround	
0 setgray 0 0 mywidth myheight rectfill 

endps

defineps PSkillwindow()

/mywin termwindow 

endps

------------------------- paint.m -------------------

#import <stdlib.h>
#import <appkit/Application.h>
#import <appkit/appkit.h>
#import <dpsclient/event.h>
#import <dpsclient/dpsclient.h>

DPSContext theContext; 

extern void PSblackwindow();
extern void PSkillwindow();
 
DPSEventFilterFunc theFunction(NXEvent *theEvent)
{ DPSshowcursor(theContext); [NXApp terminate:NXApp]; return 0; }
 
void main(int argc, char *argv[])
{
    [NXApp=[Application new] activateSelf:YES];
    DPSSetContext(theContext=[NXApp context]);
    PSblackwindow(); DPSSetEventFunc(theContext, theFunction);
    DPShidecursor(theContext);
    [NXApp run]; PSkillwindow(); [NXApp free];
    exit(0);
}

------------------- my Makefile ----------------------------

default:
	pswrap -a -o black.c black.psw
	cc -O -segcreate __ICON __header black.iconheader -segcreate __ICON app black.tiff black.c paint.m -o black -lNeXT_s -lsys_s -ldpsops
	strip black



Question #1:  why did i have to include libdpsops.a?  i had to discover this
library the hard way.  is it documented ANYWHERE that i need this library to
use all of the DPSxxxxxx versions of the PSxxxxxx functions?

Questions #2: why did i have to use DPShidecursor() and DPSshowcursor() at
all?  i tried placing hidecursor and showcursor in my wrap, and also using
PShidecursor and PSshowcursor in the main program, and also placing
PSshowcursor in my event filter.  my cursor would not be made visible again.
is there some reason my current context is being switched when i dont expect 
it to?

Question #3:  this comes from my previous attempts at writing this a program
which paints the screen black and waits for an event ENTIRELY in postscript.
can this be done?  is there any way to intercept key (etc) events from
postscript and specify event handlers (other than checking buttondown and
stilldown)?  and is there any equivalent of sleep() in postscript so that i
can wait for a simple mousedown without chomping all of my cpu time?

thanks.