Path: utzoo!utgpu!watmath!clyde!bellcore!rutgers!mailrus!tut.cis.ohio-state.edu!bloom-beacon!husc6!rice!sun-spots-request From: vern@sequoia.ee.lbl.gov (Vern Paxson) Newsgroups: comp.sys.sun Subject: Re: SunView again and again Message-ID: <1312@helios.ee.lbl.gov> Date: 10 Dec 88 07:17:36 GMT References: <8811151426.AA27702@rice.edu> Sender: usenet@rice.edu Organization: Rice University, Houston, Texas Lines: 43 Approved: Sun-Spots@rice.edu Original-Date: 25 Nov 88 22:31:02 GMT X-Sun-Spots-Digest: Volume 7, Issue 42, message 8 of 13 In article <8811151426.AA27702@rice.edu> Sun-Spots@Rice.edu writes: >X-Sun-Spots-Digest: Volume 7, Issue 25, message 5 of 16 > >....What I need is the >ability to use SunView's buttons, panels, cycles, etc TOGETHER with a >graphics package without using extremely low level stuff. I must be very >dumb 'cause I have read the CGI and CORE manuals and couldn't find out how >to do just that. Is anyone listening? .... Here's a sketch of the way I got this to work. Use two separate programs, one SunView and one SunCore, which communicate with each other via pipes (or sockets). The SunView program creates a canvas in which the SunCore program writes, and the canvas' WIN_EVENT_PROC looks like: char canvas_name[WIN_NAMESIZE]; win_fdtoname( (int) window_get( win, WIN_FD ), canvas_name ); we_setgfxwindow( canvas_name ); /* set up IPC here and fork the SunCore program. If the graphics * is only for output display, then a popen() is all that's needed. * If the SunCore program does both input that needs to be * communicated to the SunView program and output then either * two pipes or a socket need to be created, followed by an exec(). */ When forked the SunCore program does a normal get_view_surface(), and then uses the view surface struct's windowfd field along with the file descriptor of its input pipe from the SunView program as arguments to select() in order to listen to both activities like mouse motion and picks in its window, and commands from the SunView program. This approach allows quite flexible interactions. For example, if the SunCore program gets a button down event it can send a message to the SunView program telling it the location and the SunView program can pop up a menu at that spot. Or the SunView program can have a button labeled "Restore Zoom" and when it's hit the SunView program sends an IPC message to the SunCore program telling it to adjust its viewport accordingly. Vern Vern Paxson vern@lbl-csam.arpa Real Time Systems ucbvax!lbl-csam.arpa!vern Lawrence Berkeley Laboratory (415) 486-6411