[comp.sys.sun] Clean Exit From Sunview Environment

MEYERS1@ll.ll.mit.edu (05/30/90)

Is there a means to exit the SunView desktop environment from within a
SunWindows application?  The intended application would have the pressing
of a SunWindows button cause exit from SunView.  Currently, the only way I
know to exit SunView is via the pop-up rootmenu.

jason@cs.odu.edu (Jason C Austin) (06/02/90)

In article <8287@brazos.Rice.edu> MEYERS1@ll.ll.mit.edu writes:
-> Is there a means to exit the SunView desktop environment from within a
-> SunWindows application?  The intended application would have the pressing
-> of a SunWindows button cause exit from SunView.  Currently, the only way I
-> know to exit SunView is via the pop-up rootmenu.

One thing you could do is find what process you need to kill to exit
sunview and have your program hunt down and kill it.

[[Ed's Note: That'd do the trick, though I doubt cleanly :) -bdg]]

Jason C. Austin
jason@cs.odu.edu

graham@relay.eu.net (Graham Underwood) (06/05/90)

In article <8439@brazos.Rice.edu> you write:
>
>In article <8287@brazos.Rice.edu> MEYERS1@ll.ll.mit.edu writes:
>-> Is there a means to exit the SunView desktop environment from within a
>-> SunWindows application?  The intended application would have the pressing
>-> of a SunWindows button cause exit from SunView.  Currently, the only way I
>-> know to exit SunView is via the pop-up rootmenu.
>
>One thing you could do is find what process you need to kill to exit
>sunview and have your program hunt down and kill it.

Yeuch! Far cleaner solution is as follows:

#include <suntool/sunview.h>
#include <sunwindow/window_hs.h>
#include <stdio.h>

static Frame	frame;

main()
{
	frame = (Frame) window_create(NULL, FRAME, 0);
	SunViewExit();
}

static
SunViewExit()
{
	int	rootfd = SunViewOpen();

	win_screendestroy(rootfd);
	close(rootfd);
}

static 
SunViewOpen()
{
	int             myfd, rootfd;
	struct screen   rootscreen;

	myfd = (int) window_get(frame, WIN_FD);
	win_screenget(myfd, &rootscreen);
	rootfd = open(rootscreen.scr_rootname, 1);
	return (rootfd);
}

In practice frame would be the base frame of your application.

poffen@sj.ate.slb.com (Russ Poffenberger) (06/05/90)

In article <8439@brazos.Rice.edu> jason@cs.odu.edu (Jason C Austin) writes:
>In article <8287@brazos.Rice.edu> MEYERS1@ll.ll.mit.edu writes:
>> Currently, the only way I
>> know to exit SunView is via the pop-up rootmenu.

There is another way to exit Sunview, though probably not exactly what is
ultimately desired. With the mouse pointer on positioned on the
background, type CTRL-D CTRL-Q (^D ^Q). This will exit WITHOUT the pop-up
menu.

Russ Poffenberger               DOMAIN: poffen@sj.ate.slb.com
Schlumberger Technologies       UUCP:   {uunet,decwrl,amdahl}!sjsca4!poffen
1601 Technology Drive		CIS:	72401,276
San Jose, Ca. 95110             (408)437-5254

rklatt@uunet.uu.net (Randolf E. Klatt) (06/07/90)

First, thanks for a solution to a problem that had been troubling me in
our application. 8^)

However, note that on an SS1 under 4.0.3 the program trashes the colormap
so badly that clear_colormap doesn't seem to be able to recover it. I also
tested it on a 3/260 and it trashes the colormap there too (not
surprisingly) but a clear_colormap brings the screen back to normal. On
the SS1 the only colors left are white and a sort of fuzzy light blue
which is almost illegible.

Does someone know why this should be so? Both machines are running 4.0.3,
by the way .. If there is interest I will summarize.

Randolf Klatt
Westinghouse Electric
ittc!rklatt@uunet.uu.net

thp@relay.eu.net (Timothy H Panton.) (06/08/90)

> Is there a means to exit the SunView desktop environment from within a
> SunWindows application?  The intended application would have the pressing
> of a SunWindows button cause exit from SunView.  Currently, the only way I
> know to exit SunView is via the pop-up rootmenu.

I needed to do this on a 386i, from a shell script.  What I did was to put
the process id of the shell that execs suntools in an environment
variable, and then send a TERM sig to that process, suntools on the 386i
has a signal handler that catches SIGTERM and cleans up.  You can get the
386i behavior on 3's and 4's by compiling
/usr/share/src/sun/suntool/suntools.c with -Decd.suntools.

Tim Panton, Westhawk Ltd.
Phone: +44 92822574
uucp : ..!mcvax!ukc!westhawk!thp

MEYERS1@ll.ll.mit.edu (06/12/90)

Thanks to the various people who replied to my query regarding "clean"
exit from the SunView environment via a button in a SunWindows
application.  The basic technique we implemented was to issue a kill for
the pid under which SunView was running.  We had passed the pid via an
environmental variable.